-
Notifications
You must be signed in to change notification settings - Fork 515
Simplify property memoization for Flyweight pattern by replacing it with ??=
#4084
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
Would be great to have an auto-fixable rule that would enforce this under https://github.com/phpstan/phpstan-src/tree/2.1.x/build/PHPStan/Build. Do you think it'd be easy for you to implement that? And verify it by actually using it to make these changes. And compare it to your manual changes 😊 (Yeah, RuleErrorBuilder has |
I hadn't noticed that they added |
Yeah, just detect if === null and assignment to the same thing in the only statement. |
c3a52ed
to
d51316c
Compare
d51316c
to
2154e33
Compare
This pull request has been marked as ready for review. |
This pull request has been marked as ready for review. |
29b8dc6
to
23939e1
Compare
23939e1
to
3c4bcf2
Compare
@ondrejmirtes The refactoring feature integrated into PHPStan is a game changer. 🎉 |
Now that PHP 7.2 has been dropped, this pattern can be replaced.