From 51a716faca595fcc4518046ee9c1c5e2136b9267 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 11 Jun 2026 05:50:22 +0200 Subject: [PATCH 1/2] IRI: Fix null warning on PHP 8.5 (#979) In PHP 8.5, `empty(my_array[null])` generates a warning: php > new SimplePie\IRI("//foo")->get_iri(); Deprecated: Using null as an array offset is deprecated, use an empty string instead --- src/IRI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IRI.php b/src/IRI.php index 8d7e2923b..b9c8d693e 100644 --- a/src/IRI.php +++ b/src/IRI.php @@ -1023,7 +1023,7 @@ public function get_iri() } if ($this->ipath !== '') { $iri .= $this->ipath; - } elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '') { + } elseif ($this->scheme !== null && !empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '') { $iri .= $this->normalization[$this->scheme]['ipath']; } if ($this->iquery !== null) { From 26903c439128ed523c55708b02ffa790519536f1 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 11 Jun 2026 06:46:08 +0200 Subject: [PATCH 2/2] utils/PHPStan: Fix `phpstanApi.instanceofType` (#969) This will be an error with PHPStan 2.0. https://phpstan.org/blog/why-is-instanceof-type-wrong-and-getting-deprecated https://phpstan.org/error-identifiers/phpstanApi.instanceofType --- .../RegistryCallMethodReturnTypeExtension.php | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/utils/PHPStan/RegistryCallMethodReturnTypeExtension.php b/utils/PHPStan/RegistryCallMethodReturnTypeExtension.php index 564ba0dfa..51b67b747 100644 --- a/utils/PHPStan/RegistryCallMethodReturnTypeExtension.php +++ b/utils/PHPStan/RegistryCallMethodReturnTypeExtension.php @@ -14,9 +14,6 @@ use PHPStan\Type\Type; use PHPStan\Reflection\ReflectionProvider; use PhpParser\Node\Expr\MethodCall; -use PHPStan\Type\Constant\ConstantStringType; -use PHPStan\Type\Constant\ConstantArrayType; -use PHPStan\Type\ArrayType; use PHPStan\Type\MixedType; /** @@ -58,19 +55,21 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method $classType = $scope->getType($classNameArg); $methodType = $scope->getType($methodNameArg); + $classStrings = $classType->getConstantStrings(); + $methodStrings = $methodType->getConstantStrings(); - if (!$classType instanceof ConstantStringType || !$methodType instanceof ConstantStringType) { + if (count($classStrings) !== 1 || count($methodStrings) !== 1) { return new MixedType(); } - $className = $classType->getValue(); + $className = $classStrings[0]->getValue(); if (!$this->reflectionProvider->hasClass($className)) { return new MixedType(); } $classReflection = $this->reflectionProvider->getClass($className); - $methodName = $methodType->getValue(); + $methodName = $methodStrings[0]->getValue(); if (!$classReflection->hasMethod($methodName)) { return new MixedType(); } @@ -81,10 +80,17 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method if ($argumentsArg !== null) { $argumentsType = $scope->getType($argumentsArg); - if ($argumentsType instanceof ConstantArrayType) { - $argumentTypes = $argumentsType->getValueTypes(); - } elseif ($argumentsType instanceof ArrayType) { - $argumentTypes = [$argumentsType->getItemType()]; + if ($argumentsType->isArray()->yes()) { + $constantArrays = $argumentsType->getConstantArrays(); + + if (count($constantArrays) === 0) { + $argumentTypes = [$argumentsType->getIterableValueType()]; + } elseif (count($constantArrays) === 1) { + $constantArray = $constantArrays[0]; + $argumentTypes = $constantArray->getValueTypes(); + } else { + return new MixedType(); + } } else { return new MixedType(); }