-
Notifications
You must be signed in to change notification settings - Fork 546
FNSR false positive: Call to method X on a separate line has no effect #4738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.1.x
Are you sure you want to change the base?
Conversation
|
I think the bug does not reproduce in tests (but it does when running the repro script standalone), because in tests a method is filtered out because it is reported to have impure point, while it doesn't have a impure point when running standalone phpstan-src/src/Rules/DeadCode/MethodWithoutImpurePointsCollector.php Lines 34 to 36 in a951ac0
|
|
applying this diff makes the test fail, with the same error we get when run standalone: diff --git a/src/Rules/DeadCode/CallToMethodStatementWithoutImpurePointsRule.php b/src/Rules/DeadCode/CallToMethodStatementWithoutImpurePointsRule.php
index a04d151ad9..65d63f8d29 100644
--- a/src/Rules/DeadCode/CallToMethodStatementWithoutImpurePointsRule.php
+++ b/src/Rules/DeadCode/CallToMethodStatementWithoutImpurePointsRule.php
@@ -34,6 +34,11 @@ final class CallToMethodStatementWithoutImpurePointsRule implements Rule
}
}
+ $methods['bug13956\foo'] = [
+ 'addsuccess' => 'Bug13956\Foo::addSuccess',
+ 'getsuccessmessages' => 'Bug13956\Foo::getSuccessMessages',
+ ];
+
$errors = [];
foreach ($node->get(PossiblyPureMethodCallCollector::class) as $filePath => $data) {
foreach ($data as [$classNames, $method, $line]) { |
|
interessting.. I can see that in
a impure point is generated and appended to the by-ref array
I can see the array is still empty. so I suspect either xdebug is lying/buggy or php-src somehow looses the by-ref appended array content. |
|
Fibers are not threads, they still work with the same objects and values, they are just "functions that can be paused and resumed later". I'll look into it later, but caching of FileTypeMapper and releasing the current performance improvements is a priority 😊 |


closes phpstan/phpstan#13956