From 657df317dcbb19f759da53d1cb917f741e460436 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 19 Sep 2026 08:12:30 +0200 Subject: [PATCH 1/2] Fix methods with has an unused parameters --- composer.json | 2 +- src/Symfony/XmlParameterMapFactory.php | 1 - src/Type/Symfony/ParameterDynamicReturnTypeExtension.php | 6 ++---- src/Type/Symfony/ServiceDynamicReturnTypeExtension.php | 6 ++---- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 7dcc1e6b..f0dddf3a 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "require": { "php": "^7.4 || ^8.0", "ext-simplexml": "*", - "phpstan/phpstan": "^2.1.13" + "phpstan/phpstan": "2.3.x-dev" }, "conflict": { "symfony/framework-bundle": "<3.0" diff --git a/src/Symfony/XmlParameterMapFactory.php b/src/Symfony/XmlParameterMapFactory.php index 4d3d3578..14516dac 100644 --- a/src/Symfony/XmlParameterMapFactory.php +++ b/src/Symfony/XmlParameterMapFactory.php @@ -70,7 +70,6 @@ private function getNodeValue(SimpleXMLElement $def) /** @var SimpleXMLElement $attrs */ $attrs = $def->attributes(); - $value = null; switch ((string) $attrs->type) { case 'collection': $value = []; diff --git a/src/Type/Symfony/ParameterDynamicReturnTypeExtension.php b/src/Type/Symfony/ParameterDynamicReturnTypeExtension.php index 687b0c33..618e0f6b 100644 --- a/src/Type/Symfony/ParameterDynamicReturnTypeExtension.php +++ b/src/Type/Symfony/ParameterDynamicReturnTypeExtension.php @@ -90,15 +90,14 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method { switch ($methodReflection->getName()) { case $this->methodGet: - return $this->getGetTypeFromMethodCall($methodReflection, $methodCall, $scope); + return $this->getGetTypeFromMethodCall($methodCall, $scope); case $this->methodHas: - return $this->getHasTypeFromMethodCall($methodReflection, $methodCall, $scope); + return $this->getHasTypeFromMethodCall($methodCall, $scope); } throw new ShouldNotHappenException(); } private function getGetTypeFromMethodCall( - MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope ): Type @@ -204,7 +203,6 @@ private function generalizeType(Type $type): Type } private function getHasTypeFromMethodCall( - MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope ): ?Type diff --git a/src/Type/Symfony/ServiceDynamicReturnTypeExtension.php b/src/Type/Symfony/ServiceDynamicReturnTypeExtension.php index 0667d30c..b9c23f91 100644 --- a/src/Type/Symfony/ServiceDynamicReturnTypeExtension.php +++ b/src/Type/Symfony/ServiceDynamicReturnTypeExtension.php @@ -62,15 +62,14 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method { switch ($methodReflection->getName()) { case 'get': - return $this->getGetTypeFromMethodCall($methodReflection, $methodCall, $scope); + return $this->getGetTypeFromMethodCall($methodCall, $scope); case 'has': - return $this->getHasTypeFromMethodCall($methodReflection, $methodCall, $scope); + return $this->getHasTypeFromMethodCall($methodCall, $scope); } throw new ShouldNotHappenException(); } private function getGetTypeFromMethodCall( - MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope ): ?Type @@ -120,7 +119,6 @@ private function tryCreateParameterBag(): ?ParameterBag } private function getHasTypeFromMethodCall( - MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope ): ?Type From 0ee3938ff39ba2c6e9147161b56baea8968c6413 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 19 Sep 2026 08:13:44 +0200 Subject: [PATCH 2/2] restore composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f0dddf3a..7dcc1e6b 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "require": { "php": "^7.4 || ^8.0", "ext-simplexml": "*", - "phpstan/phpstan": "2.3.x-dev" + "phpstan/phpstan": "^2.1.13" }, "conflict": { "symfony/framework-bundle": "<3.0"