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
Use ReadWritePropertiesExtensions in MissingReadOnlyPropertyAssignRule
#1357
Use ReadWritePropertiesExtensions in MissingReadOnlyPropertyAssignRule
#1357
Conversation
hmmm, had the same phpstan errors ( |
acaeb2b
to
aa97cab
Compare
Though about this again, not verified yet, but I assume that simply autoloading those PHP 8.1 files won't work in earlier versions. Will check that later and fix it then by conditionally passing the extension. |
Yeah, should be tested only on 8.1 😊 |
3fbbfa2
to
ebf4b37
Compare
still not sure how to solve the static analysis error, any ideas? any additional checks added will always resolve to ConstBooleanTypes before PHP 8.1. It's not a simple case of not running the test on earlier versions unfortunately.. btw the problem is indeed the autoloading, the phpstan checks are all correct here, the class simply cannot be autoloaded and therefore is not a valid class-string before 8.1. |
c7586b6
to
933c0f0
Compare
I used your first commit and I'm trying to solve the failure in a similar way to how I solved these in the past: 933c0f0 |
aaah, thx Ondrej! I actually remember now touching something close to that ignore-by-php-version file already once in the past.. |
Perfect, thank you! |
.. and
MissingReadOnlyByPhpDocPropertyAssignRuleTest
.Should close phpstan/phpstan#6632
Should close phpstan/phpstan#7337
I kept it simple and chose a similar testing approach as
UnusedPrivatePropertyRuleTest
uses. I also double-checked - these 2 classes were the only ones wereClassPropertiesNode::getUninitializedProperties
was used without passing extensions.A dedicated test-case in the doctrine extension using
readonly
might be a good idea too maybe? I assume there are already cases where theReadWritePropertiesExtension
from there is used.