-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add Psalm immutability annotations #32
base: master
Are you sure you want to change the base?
Conversation
By the way, the psalm CI job rightly fails, because
These problems can either be fixed by adding them into a psalm-baseline file, or by adding
|
596664d
to
24986dc
Compare
Hi, thanks for your PR. I would love to annotate immutable classes as such, however it looks like your attempt outlined a number of issues that may prevent us from doing so:
|
This helps to ensure that classes marked as immutable will actually be immutable[^1]. Downstream projects using both `brick/date-time` and Psalm will have the benefit of allowing for more thorough analysis. [^1]: https://psalm.dev/docs/annotating_code/supported_annotations/#psalm-immutable
24986dc
to
341a7bc
Compare
Hey @BenMorel, |
Hi, thanks for round 2! I'm not sure to keep I'm wondering though: how is it a problem to call getters on a mutable class from a factory method of an immutable class? |
4d0a530
to
7407a79
Compare
Hi, I just found out about this library by searching for JSR310-inspired libraries for PHP.
This patch helps to ensure that classes marked as immutable will actually be
immutable1. Downstream projects using both
brick/date-time
andPsalm will have the benefit of allowing for more thorough analysis.
Footnotes
https://psalm.dev/docs/annotating_code/supported_annotations/#psalm-immutable ↩