Skip to content

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Oct 2, 2024

Closes phpstan/phpstan#11775
Docs PR: phpstan/phpstan#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.

@herndlm herndlm changed the base branch from 2.0.x to 1.12.x October 2, 2024 12:46
@phpstan-bot
Copy link
Collaborator

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.

@herndlm herndlm force-pushed the readonly-class-phpdoc branch from 4e1be28 to cb31b0a Compare October 2, 2024 12:46
@herndlm herndlm force-pushed the readonly-class-phpdoc branch 2 times, most recently from 951ab20 to 7b449ed Compare October 2, 2024 12:53
@herndlm herndlm force-pushed the readonly-class-phpdoc branch from 7b449ed to 8d193e4 Compare October 14, 2024 16:31
@keradus
Copy link
Contributor

keradus commented Oct 14, 2024

love it!

@ondrejmirtes ondrejmirtes merged commit bf85e9d into phpstan:1.12.x Nov 6, 2024
451 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@readonly above class

4 participants