From 109969034f08dd7606718603397090b7943b7bad Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 19 Apr 2025 11:29:33 +0200 Subject: [PATCH 01/15] Fix forgetting static property access after impure call --- src/Analyser/MutatingScope.php | 8 +++++ .../Analyser/nsrt/bug-12902-non-strict.php | 4 +-- tests/PHPStan/Analyser/nsrt/bug-12902.php | 31 +++++++++++++++++-- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/Analyser/MutatingScope.php b/src/Analyser/MutatingScope.php index 22a895e03c..a73dc901f8 100644 --- a/src/Analyser/MutatingScope.php +++ b/src/Analyser/MutatingScope.php @@ -4379,6 +4379,14 @@ private function shouldInvalidateExpression(string $exprStringToInvalidate, Expr $nodeFinder = new NodeFinder(); $expressionToInvalidateClass = get_class($exprToInvalidate); $found = $nodeFinder->findFirst([$expr], function (Node $node) use ($expressionToInvalidateClass, $exprStringToInvalidate): bool { + if ( + $exprStringToInvalidate === '$this' + && $node instanceof Name + && in_array($node->name, ['self', 'static', 'parent'], true) + ) { + return true; + } + if (!$node instanceof $expressionToInvalidateClass) { return false; } diff --git a/tests/PHPStan/Analyser/nsrt/bug-12902-non-strict.php b/tests/PHPStan/Analyser/nsrt/bug-12902-non-strict.php index d294016ec5..33f8a11e26 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-12902-non-strict.php +++ b/tests/PHPStan/Analyser/nsrt/bug-12902-non-strict.php @@ -72,8 +72,8 @@ public function __construct() assertNativeType('int', self::$i); $this->impureCall(); - assertType('int', self::$i); // should be float|int - assertNativeType('int', self::$i); // should be float|int + assertType('float|int', self::$i); + assertNativeType('float|int', self::$i); } public function doFoo(): void { diff --git a/tests/PHPStan/Analyser/nsrt/bug-12902.php b/tests/PHPStan/Analyser/nsrt/bug-12902.php index cbdc816074..2330c0c130 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-12902.php +++ b/tests/PHPStan/Analyser/nsrt/bug-12902.php @@ -72,8 +72,8 @@ public function __construct() assertNativeType('int', self::$i); $this->impureCall(); - assertType('int', self::$i); // should be float|int - assertNativeType('int', self::$i); // should be float|int + assertType('float|int', self::$i); + assertNativeType('float|int', self::$i); } public function doFoo(): void { @@ -85,6 +85,33 @@ public function doFoo(): void { public function impureCall(): void {} } +class BaseClass +{ + static protected int|float $i; +} + +class UsesBaseClass extends BaseClass +{ + public function __construct() + { + parent::$i = getInt(); + assertType('int', parent::$i); + assertNativeType('int', parent::$i); + + $this->impureCall(); + assertType('float|int', parent::$i); + assertNativeType('float|int', parent::$i); + } + + public function doFoo(): void { + assertType('float|int', parent::$i); + assertNativeType('float|int', parent::$i); + } + + /** @phpstan-impure */ + public function impureCall(): void {} +} + function getInt(): int { return 1; } From a128206dd0745be44b439cc29be8557d9e8ad8d4 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 19 Apr 2025 12:35:12 +0200 Subject: [PATCH 02/15] added regression test --- ...rictComparisonOfDifferentTypesRuleTest.php | 5 +++++ .../Rules/Comparison/data/bug-11019.php | 21 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/PHPStan/Rules/Comparison/data/bug-11019.php diff --git a/tests/PHPStan/Rules/Comparison/StrictComparisonOfDifferentTypesRuleTest.php b/tests/PHPStan/Rules/Comparison/StrictComparisonOfDifferentTypesRuleTest.php index 4c72f04c61..68cd2cc059 100644 --- a/tests/PHPStan/Rules/Comparison/StrictComparisonOfDifferentTypesRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/StrictComparisonOfDifferentTypesRuleTest.php @@ -1011,4 +1011,9 @@ public function testBug12748(): void $this->analyse([__DIR__ . '/data/bug-12748.php'], []); } + public function testBug11019(): void + { + $this->analyse([__DIR__ . '/data/bug-11019.php'], []); + } + } diff --git a/tests/PHPStan/Rules/Comparison/data/bug-11019.php b/tests/PHPStan/Rules/Comparison/data/bug-11019.php new file mode 100644 index 0000000000..c6a64cec05 --- /dev/null +++ b/tests/PHPStan/Rules/Comparison/data/bug-11019.php @@ -0,0 +1,21 @@ +reset(); + assert(static::$a === 1); + $this->reset(); + assert(static::$a === 1); + } +} From 2a79d7b196d47b2994e5e4b302e7aa1968b7f506 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 19 Apr 2025 12:38:44 +0200 Subject: [PATCH 03/15] Added regression test --- ...nexistentOffsetInArrayDimFetchRuleTest.php | 5 ++++ tests/PHPStan/Rules/Arrays/data/bug-3747.php | 27 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 tests/PHPStan/Rules/Arrays/data/bug-3747.php diff --git a/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php b/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php index 0198587347..941829a685 100644 --- a/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php +++ b/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php @@ -930,4 +930,9 @@ public function testBug12593(): void $this->analyse([__DIR__ . '/data/bug-12593.php'], []); } + public function testBug3747(): void + { + $this->analyse([__DIR__ . '/data/bug-3747.php'], []); + } + } diff --git a/tests/PHPStan/Rules/Arrays/data/bug-3747.php b/tests/PHPStan/Rules/Arrays/data/bug-3747.php new file mode 100644 index 0000000000..d1dea20e05 --- /dev/null +++ b/tests/PHPStan/Rules/Arrays/data/bug-3747.php @@ -0,0 +1,27 @@ + $x */ + private static array $x; + + public function y(): void { + + self::$x = []; + + $this->z(); + + echo self::$x['foo']; + + } + + private function z(): void { + self::$x['foo'] = 'bar'; + } + +} + +$x = new X(); +$x->y(); From 247db4c38e3699fb09627f9f5744e52271606c50 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 19 Apr 2025 13:18:53 +0200 Subject: [PATCH 04/15] Fix forgetting expressions on function calls / closure invoke --- src/Analyser/NodeScopeResolver.php | 12 +++++-- .../Methods/NullsafeMethodCallRuleTest.php | 10 ++++++ tests/PHPStan/Rules/Methods/data/bug-8523.php | 36 +++++++++++++++++++ .../PHPStan/Rules/Methods/data/bug-8523b.php | 24 +++++++++++++ 4 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 tests/PHPStan/Rules/Methods/data/bug-8523.php create mode 100644 tests/PHPStan/Rules/Methods/data/bug-8523b.php diff --git a/src/Analyser/NodeScopeResolver.php b/src/Analyser/NodeScopeResolver.php index 756ea8db31..ec18d7a795 100644 --- a/src/Analyser/NodeScopeResolver.php +++ b/src/Analyser/NodeScopeResolver.php @@ -2597,6 +2597,16 @@ static function (): void { $throwPoints[] = ThrowPoint::createImplicit($scope, $expr); } + if ( + ( + ($functionReflection !== null && $functionReflection->hasSideEffects()->yes()) + || $parametersAcceptor instanceof ClosureType && $parametersAcceptor->getReturnType()->isVoid()->yes() + ) + && $scope->isInClass() + ) { + $scope = $scope->invalidateExpression(new Variable('this'), true); + } + if ( $functionReflection !== null && in_array($functionReflection->getName(), ['json_encode', 'json_decode'], true) @@ -3022,13 +3032,11 @@ static function (): void { if ( $methodReflection !== null - && !$methodReflection->isStatic() && ( $methodReflection->hasSideEffects()->yes() || $methodReflection->getName() === '__construct' ) && $scopeFunction instanceof MethodReflection - && !$scopeFunction->isStatic() && $scope->isInClass() && $scope->getClassReflection()->is($methodReflection->getDeclaringClass()->getName()) ) { diff --git a/tests/PHPStan/Rules/Methods/NullsafeMethodCallRuleTest.php b/tests/PHPStan/Rules/Methods/NullsafeMethodCallRuleTest.php index b954794c6e..d4b48339c9 100644 --- a/tests/PHPStan/Rules/Methods/NullsafeMethodCallRuleTest.php +++ b/tests/PHPStan/Rules/Methods/NullsafeMethodCallRuleTest.php @@ -55,4 +55,14 @@ public function testBug6922b(): void $this->analyse([__DIR__ . '/data/bug-6922b.php'], []); } + public function testBug8523(): void + { + $this->analyse([__DIR__ . '/data/bug-8523.php'], []); + } + + public function testBug8523b(): void + { + $this->analyse([__DIR__ . '/data/bug-8523b.php'], []); + } + } diff --git a/tests/PHPStan/Rules/Methods/data/bug-8523.php b/tests/PHPStan/Rules/Methods/data/bug-8523.php new file mode 100644 index 0000000000..0cc8b3ad0a --- /dev/null +++ b/tests/PHPStan/Rules/Methods/data/bug-8523.php @@ -0,0 +1,36 @@ +foo(); + } + + public function bar(): void + { + self::$instance = null; + } + + public function baz(): void + { + self::$instance = new HelloWorld(); + + $this->bar(); + + self::$instance?->foo(); + } +} diff --git a/tests/PHPStan/Rules/Methods/data/bug-8523b.php b/tests/PHPStan/Rules/Methods/data/bug-8523b.php new file mode 100644 index 0000000000..a007fd2661 --- /dev/null +++ b/tests/PHPStan/Rules/Methods/data/bug-8523b.php @@ -0,0 +1,24 @@ +save(); + } +} + +(new HelloWorld())->save(); From b5cf7d307b589b88852fd0d451b3741080b50ec1 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 19 Apr 2025 13:24:42 +0200 Subject: [PATCH 05/15] Update NodeScopeResolver.php --- src/Analyser/NodeScopeResolver.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Analyser/NodeScopeResolver.php b/src/Analyser/NodeScopeResolver.php index ec18d7a795..49dd1460f9 100644 --- a/src/Analyser/NodeScopeResolver.php +++ b/src/Analyser/NodeScopeResolver.php @@ -2598,10 +2598,7 @@ static function (): void { } if ( - ( - ($functionReflection !== null && $functionReflection->hasSideEffects()->yes()) - || $parametersAcceptor instanceof ClosureType && $parametersAcceptor->getReturnType()->isVoid()->yes() - ) + $parametersAcceptor instanceof ClosureType && $parametersAcceptor->getReturnType()->isVoid()->yes() && $scope->isInClass() ) { $scope = $scope->invalidateExpression(new Variable('this'), true); From d17e41fd48c716f9548c3d5cc956c1248112dbcc Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 19 Apr 2025 15:38:29 +0200 Subject: [PATCH 06/15] Update MutatingScope.php --- src/Analyser/MutatingScope.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Analyser/MutatingScope.php b/src/Analyser/MutatingScope.php index a73dc901f8..e7140017ee 100644 --- a/src/Analyser/MutatingScope.php +++ b/src/Analyser/MutatingScope.php @@ -4382,7 +4382,7 @@ private function shouldInvalidateExpression(string $exprStringToInvalidate, Expr if ( $exprStringToInvalidate === '$this' && $node instanceof Name - && in_array($node->name, ['self', 'static', 'parent'], true) + && in_array($node->toLowerString(), ['self', 'static', 'parent'], true) ) { return true; } From 5725c3a1555a91564f33108f749dd8f139220231 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 20 Apr 2025 08:27:13 +0200 Subject: [PATCH 07/15] Update NodeScopeResolver.php --- src/Analyser/NodeScopeResolver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Analyser/NodeScopeResolver.php b/src/Analyser/NodeScopeResolver.php index 49dd1460f9..5c1f7c156e 100644 --- a/src/Analyser/NodeScopeResolver.php +++ b/src/Analyser/NodeScopeResolver.php @@ -2598,7 +2598,7 @@ static function (): void { } if ( - $parametersAcceptor instanceof ClosureType && $parametersAcceptor->getReturnType()->isVoid()->yes() + $parametersAcceptor instanceof ClosureType && count($parametersAcceptor->getImpurePoints()) > 0 && $scope->isInClass() ) { $scope = $scope->invalidateExpression(new Variable('this'), true); From ddbd27fdb01ebf86c396b2c31d11609a96980e89 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 20 Apr 2025 08:30:52 +0200 Subject: [PATCH 08/15] fix name resolving --- src/Analyser/MutatingScope.php | 5 +++- .../Methods/NullsafeMethodCallRuleTest.php | 5 ++++ .../PHPStan/Rules/Methods/data/bug-8523c.php | 26 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 tests/PHPStan/Rules/Methods/data/bug-8523c.php diff --git a/src/Analyser/MutatingScope.php b/src/Analyser/MutatingScope.php index e7140017ee..0f0db94d94 100644 --- a/src/Analyser/MutatingScope.php +++ b/src/Analyser/MutatingScope.php @@ -4382,7 +4382,10 @@ private function shouldInvalidateExpression(string $exprStringToInvalidate, Expr if ( $exprStringToInvalidate === '$this' && $node instanceof Name - && in_array($node->toLowerString(), ['self', 'static', 'parent'], true) + && ( + in_array($node->toLowerString(), ['self', 'static', 'parent'], true) + || $this->getClassReflection()->is($this->resolveName($node)) + ) ) { return true; } diff --git a/tests/PHPStan/Rules/Methods/NullsafeMethodCallRuleTest.php b/tests/PHPStan/Rules/Methods/NullsafeMethodCallRuleTest.php index d4b48339c9..5c308ea5ad 100644 --- a/tests/PHPStan/Rules/Methods/NullsafeMethodCallRuleTest.php +++ b/tests/PHPStan/Rules/Methods/NullsafeMethodCallRuleTest.php @@ -65,4 +65,9 @@ public function testBug8523b(): void $this->analyse([__DIR__ . '/data/bug-8523b.php'], []); } + public function testBug8523c(): void + { + $this->analyse([__DIR__ . '/data/bug-8523c.php'], []); + } + } diff --git a/tests/PHPStan/Rules/Methods/data/bug-8523c.php b/tests/PHPStan/Rules/Methods/data/bug-8523c.php new file mode 100644 index 0000000000..ea88940446 --- /dev/null +++ b/tests/PHPStan/Rules/Methods/data/bug-8523c.php @@ -0,0 +1,26 @@ +save(); + } +} + +(new HelloWorld())->save(); From 1b17eaf04aebe0353768597d3059f1ae4f288d6d Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 20 Apr 2025 08:33:33 +0200 Subject: [PATCH 09/15] Update MutatingScope.php --- src/Analyser/MutatingScope.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Analyser/MutatingScope.php b/src/Analyser/MutatingScope.php index 0f0db94d94..16a9c15f05 100644 --- a/src/Analyser/MutatingScope.php +++ b/src/Analyser/MutatingScope.php @@ -4384,7 +4384,7 @@ private function shouldInvalidateExpression(string $exprStringToInvalidate, Expr && $node instanceof Name && ( in_array($node->toLowerString(), ['self', 'static', 'parent'], true) - || $this->getClassReflection()->is($this->resolveName($node)) + || ($this->getClassReflection() !== null && $this->getClassReflection()->is($this->resolveName($node))) ) ) { return true; From 36dc4a40388c2867e794e7b06566a408b61b5806 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 20 Apr 2025 08:53:02 +0200 Subject: [PATCH 10/15] Added regression test --- .../IfConstantConditionRuleTest.php | 6 +++++ .../Rules/Comparison/data/bug-4864.php | 25 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 tests/PHPStan/Rules/Comparison/data/bug-4864.php diff --git a/tests/PHPStan/Rules/Comparison/IfConstantConditionRuleTest.php b/tests/PHPStan/Rules/Comparison/IfConstantConditionRuleTest.php index 1f03a122bd..5ce14e623a 100644 --- a/tests/PHPStan/Rules/Comparison/IfConstantConditionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/IfConstantConditionRuleTest.php @@ -173,4 +173,10 @@ public function testBug4912(): void $this->analyse([__DIR__ . '/data/bug-4912.php'], []); } + public function testBug4864(): void + { + $this->treatPhpDocTypesAsCertain = true; + $this->analyse([__DIR__ . '/data/bug-4864.php'], []); + } + } diff --git a/tests/PHPStan/Rules/Comparison/data/bug-4864.php b/tests/PHPStan/Rules/Comparison/data/bug-4864.php new file mode 100644 index 0000000000..288e19c21f --- /dev/null +++ b/tests/PHPStan/Rules/Comparison/data/bug-4864.php @@ -0,0 +1,25 @@ +isHandled = false; + $this->value = null; + + (function () { + $this->isHandled = true; + $this->value = 'value'; + })(); + + if ($this->isHandled) { + $f($this->value); + } + } +} From 54cf6ebf8a0114df9694f8ec237dfe4d499df72b Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 20 Apr 2025 08:57:16 +0200 Subject: [PATCH 11/15] Added regression test --- .../IfConstantConditionRuleTest.php | 6 ++++ .../Rules/Comparison/data/bug-8926.php | 32 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/PHPStan/Rules/Comparison/data/bug-8926.php diff --git a/tests/PHPStan/Rules/Comparison/IfConstantConditionRuleTest.php b/tests/PHPStan/Rules/Comparison/IfConstantConditionRuleTest.php index 5ce14e623a..25e362f6cc 100644 --- a/tests/PHPStan/Rules/Comparison/IfConstantConditionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/IfConstantConditionRuleTest.php @@ -179,4 +179,10 @@ public function testBug4864(): void $this->analyse([__DIR__ . '/data/bug-4864.php'], []); } + public function testBug8926(): void + { + $this->treatPhpDocTypesAsCertain = true; + $this->analyse([__DIR__ . '/data/bug-8926.php'], []); + } + } diff --git a/tests/PHPStan/Rules/Comparison/data/bug-8926.php b/tests/PHPStan/Rules/Comparison/data/bug-8926.php new file mode 100644 index 0000000000..c5d92bd1e0 --- /dev/null +++ b/tests/PHPStan/Rules/Comparison/data/bug-8926.php @@ -0,0 +1,32 @@ +test = false; + (function($arr) { + $this->test = count($arr) == 1; + })($arr); + + + if ($this->test) { + echo "...\n"; + } + } +} From 2327cc04874b991a6b13feb664f65a6a60a2c8ab Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 20 Apr 2025 09:00:30 +0200 Subject: [PATCH 12/15] Added regression test --- .../Rules/Methods/ReturnTypeRuleTest.php | 14 ++++++++++ tests/PHPStan/Rules/Methods/data/bug-4443.php | 26 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tests/PHPStan/Rules/Methods/data/bug-4443.php diff --git a/tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php b/tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php index 1c62efa0c0..b4b612f42a 100644 --- a/tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php +++ b/tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php @@ -1232,4 +1232,18 @@ public function testBug1O580(): void ]); } + public function testBug4443(): void + { + if (PHP_VERSION_ID < 80000) { + $this->markTestSkipped('Test requires PHP 8.0.'); + } + + $this->analyse([__DIR__ . '/data/bug-4443.php'], [ + [ + 'Method Bug4443\HelloWorld::getArray() should return array but returns array|null.', + 22 + ] + ]); + } + } diff --git a/tests/PHPStan/Rules/Methods/data/bug-4443.php b/tests/PHPStan/Rules/Methods/data/bug-4443.php new file mode 100644 index 0000000000..9f7ff6a28e --- /dev/null +++ b/tests/PHPStan/Rules/Methods/data/bug-4443.php @@ -0,0 +1,26 @@ + */ + private static ?array $arr = null; + + private static function setup(): void + { + self::$arr = null; + } + + /** @return array */ + public static function getArray(): array + { + if (self::$arr === null) { + self::$arr = []; + self::setup(); + } + return self::$arr; + } +} + +HelloWorld::getArray(); From 8107134dd047ed7ff83468ebd8ca118337f3bcee Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 20 Apr 2025 09:01:31 +0200 Subject: [PATCH 13/15] Update ReturnTypeRuleTest.php --- tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php b/tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php index b4b612f42a..bc3a1b1fae 100644 --- a/tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php +++ b/tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php @@ -1241,8 +1241,8 @@ public function testBug4443(): void $this->analyse([__DIR__ . '/data/bug-4443.php'], [ [ 'Method Bug4443\HelloWorld::getArray() should return array but returns array|null.', - 22 - ] + 22, + ], ]); } From f090339b3e1caf58f1b2affae788889ee76e986d Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 20 Apr 2025 09:15:38 +0200 Subject: [PATCH 14/15] Update NodeScopeResolver.php --- src/Analyser/NodeScopeResolver.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Analyser/NodeScopeResolver.php b/src/Analyser/NodeScopeResolver.php index 5c1f7c156e..bd8bee0a7f 100644 --- a/src/Analyser/NodeScopeResolver.php +++ b/src/Analyser/NodeScopeResolver.php @@ -3031,7 +3031,10 @@ static function (): void { $methodReflection !== null && ( $methodReflection->hasSideEffects()->yes() - || $methodReflection->getName() === '__construct' + || ( + !$methodReflection->isStatic() + && $methodReflection->getName() === '__construct' + ) ) && $scopeFunction instanceof MethodReflection && $scope->isInClass() From 733d88313b69e9acee7ada940791d6ceace583da Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 20 Apr 2025 09:19:28 +0200 Subject: [PATCH 15/15] cleanup --- src/Analyser/NodeScopeResolver.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Analyser/NodeScopeResolver.php b/src/Analyser/NodeScopeResolver.php index bd8bee0a7f..b43f0298cc 100644 --- a/src/Analyser/NodeScopeResolver.php +++ b/src/Analyser/NodeScopeResolver.php @@ -3036,7 +3036,6 @@ static function (): void { && $methodReflection->getName() === '__construct' ) ) - && $scopeFunction instanceof MethodReflection && $scope->isInClass() && $scope->getClassReflection()->is($methodReflection->getDeclaringClass()->getName()) ) {