-
Notifications
You must be signed in to change notification settings - Fork 672
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
Detect mutable in immutable class on definition level #2933
Comments
I found these snippets: https://psalm.dev/r/74b7779d86<?php
/** @psalm-immutable */
class Foo {
public DateTime $datetime;
public function __construct(DateTime $datetime) {
$this->datetime = $datetime;
}
}
|
I don’t see the problem here - can you provide an example where purity/immutability promises are broken? |
If Foo is only used externally (is a part of library API) and your tests are not type-checked Psalm wouldn't highlight the issue above. |
Yeah, but the same goes for a lot of Psalm's issues. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixes introduced here #2805 works on class usage. But IMO it should be detected on class definitions.
https://psalm.dev/r/74b7779d86
The text was updated successfully, but these errors were encountered: