Support `@readonly` PHPDoc on the class as alternative to `@immutable`
Closes https://github.com/phpstan/phpstan/issues/11775 Docs PR: https://github.com/phpstan/phpstan/pull/11783
I decided to directly adapt ClassReflection::isImmutable() because there is already ClassReflection::isReadonly() for native readonly and that would clash. An alternative would be to add a new ClassReflection::isReadonlyPhpDoc() or so, but I dislike that isImmutable is also PHPDoc only and it then feels somewhat inconsistent / even more complicated :)
the rules are still, as before, only enabled with the readOnlyByPhpDoc feature toggle.
You've opened the pull request against the latest branch 2.0.x. PHPStan 2.0 is not going to be released for months. If your code is relevant on 1.12.x and you want it to be released sooner, please rebase your pull request and change its target to 1.12.x.
love it!
Thank you.