Răsfoiți Sursa

Bump SimplePie (fix PHP 8.5 bug) (#8918)

* https://github.com/simplepie/simplepie/pull/979
Alexandre Alapetite 2 săptămâni în urmă
părinte
comite
d40917b6d8

+ 1 - 1
lib/composer.json

@@ -18,7 +18,7 @@
 		"marienfressinaud/lib_opml": "dev-main#f0e850b6394af90b898daf0e65fcc7363457b844",
 		"phpgt/cssxpath": "v1.5.0",
 		"phpmailer/phpmailer": "7.1.1",
-		"simplepie/simplepie": "dev-freshrss#bccd36e9eb1ff54133e6199200b17b5e27b4d7ab"
+		"simplepie/simplepie": "dev-freshrss#d63cb7b38b7fc4a89b2cf3dd4181331cfef50146"
 	},
 	"config": {
 		"sort-packages": true,

+ 1 - 1
lib/simplepie/simplepie/src/IRI.php

@@ -1023,7 +1023,7 @@ class 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) {

+ 16 - 10
lib/simplepie/simplepie/utils/PHPStan/RegistryCallMethodReturnTypeExtension.php

@@ -14,9 +14,6 @@ use PHPStan\Type\DynamicMethodReturnTypeExtension;
 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 @@ class RegistryCallMethodReturnTypeExtension implements DynamicMethodReturnTypeEx
 
         $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 @@ class RegistryCallMethodReturnTypeExtension implements DynamicMethodReturnTypeEx
         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();
             }