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
isset and empty constructs appears as PropertyWrites in propertyUsages of ClassPropertiesNode #5337
Comments
I'd like an example where this shows a false-negative/false-positive in a PHPStan core rule. It probably marks a property as written even if it's not. Based on the example I'll decide how sever this bug is. You can always filter it on your side. |
Biggest issue from core I see is that it affects UninitializedPropertyRule so this code is not reported to have uninitialized field |
This is coming from the |
@janedbal After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-No errors
+5: Property Clazz::$prefix is never read, only written. Full report
|
@janedbal After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-No errors
+5: Property Clazz::$prefix is never read, only written. Full report
|
@janedbal After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
- 6: Property Foo::$field is never read, only written.
+-1: Internal error: PHPStan\Rules\Methods\WrongCaseOfInheritedMethodRule::findMethod(): Argument #2 ($classReflection) must be of type PHPStan\Reflection\ClassReflection, null given, called in /var/task/vendor/phpstan/phpstan-strict-rules/src/Rules/Methods/WrongCaseOfInheritedMethodRule.php on line 40
+Run PHPStan with --debug option and post the stack trace to:
+https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md Full report
|
@janedbal After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-6: Property Foo::$field is never read, only written.
+6: Property Foo::$field is unused. Full report
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
Assuming following code, there will be two
PropertyWrite
elements in any custom rule hooked toClassPropertiesNode
(one for assign, one for empty). Detected by rule like this.Code snippet that reproduces the problem
https://phpstan.org/r/f9dee572-568e-462f-a4c1-24f56594f804
Expected output
Only one property write to appear.
The text was updated successfully, but these errors were encountered: