Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[PropertyAccess] Readonly properties must have no PropertyWriteInfo#48108
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[PropertyAccess] Readonly properties must have no PropertyWriteInfo#48108
Uh oh!
There was an error while loading.Please reload this page.
Conversation
carsonbot commentedNov 4, 2022
Hey! I see that this is your first PR. That is great! Welcome! Symfony has acontribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
carsonbot commentedNov 5, 2022
Hey! I think@Tomanhez has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
CasvanDongen commentedMar 21, 2023
@dunglas or@nicolas-grekas is it possible to review this PR? |
nikophil commentedApr 4, 2023
@dunglas@nicolas-grekas any chance to see this merged? 🙏 |
| if ($reflClass->hasProperty($property) && ($reflClass->getProperty($property)->getModifiers() &$this->propertyReflectionFlags)) { | ||
| $reflProperty =$reflClass->getProperty($property); | ||
| if (\PHP_VERSION_ID <80100 || (false ===$reflProperty->isReadOnly() &&false ===$reflProperty->isPromoted())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
If I remove the part about$reflProperty->isPromoted() (which I just did and pushed), tests still pass. This makes me wonder what how this relates to property promotion? Isn't this only about readonly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
That's my mistake. I've missed the part that readonly properties in the constructor are automatically promoted. The change above indeed is correct.
d0d1096 to813b950Comparesrc/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
813b950 to2aa6c7dComparenicolas-grekas commentedApr 17, 2023
Thank you@CasvanDongen. |
The reported WriteInfo of readonly promoted properties is incorrectly returned as a writeable property when constructor extraction is disabled. This PR fixes that by correctly returning
PropertyWriteInfo::TYPE_NONEwhenenable_constructor_extractionisfalse.Obviously, this fix only applies to PHP8.1 or higher.