Skip to content

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented May 31, 2022

Closes phpstan/phpstan#7361

If I understood the code here correctly, the constructor PHPDoc is only needed to get the $phpDocType for a property (it's actually only resolved if $phpDocType is null). Currently though, it overwrites $resolvedPhpDoc completely, also e.g. @readonly, meaning that at the moment it would be possible to add @readonly to the constructor making all promoted props readonly, which is weird I guess? And, on the other hand of course, if there's no constructor PHPDoc, then it basically resets the promoted prop PHPDoc, ignoring e.g. @readonly as it was the case in the linked bug.

I have to admit though, that I'm not using promoted properties heavily, maybe I'm missing something..

@herndlm herndlm marked this pull request as ready for review May 31, 2022 19:46
@ondrejmirtes
Copy link
Member

Thank you, it makes sense, I added a commit that moves a piece of code :)

@ondrejmirtes ondrejmirtes merged commit 981f549 into phpstan:1.7.x Jun 1, 2022
@herndlm herndlm deleted the fix-7361 branch June 1, 2022 12:34
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 PHPDoc tag ignored for promoted property
2 participants