Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add ReadWritePropertiesExtension for Gedmo annotations/attributes #361

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

Merged
ondrejmirtes merged 1 commit into phpstan:1.3.x from acrobat:fix-gedmo-unused-properties
Sep 6, 2022

Conversation

@acrobat
Copy link
Contributor

@acrobat acrobat commented Aug 14, 2022
edited
Loading

Gedmo annotations (attributes) are used by gedmo listeners to automatically write data to properties and some of the properties are only used by gedmo internally. This ReadWritePropertiesExtension solves the unused property errors for these cases.

 ------ ----------------------------------------------------------------------------------
 Line Example.php
 ------ ----------------------------------------------------------------------------------
 22 Property App\Entity\Example::$locale is unused.
 💡 See: https://phpstan.org/developing-extensions/always-read-written-properties
 ------ ----------------------------------------------------------------------------------

Fixes #231
Related to phpstan/phpstan#7758

@acrobat acrobat force-pushed the fix-gedmo-unused-properties branch 8 times, most recently from e37b23f to 5057e05 Compare August 14, 2022 09:49
Copy link
Contributor Author

acrobat commented Aug 14, 2022

The failing php 8.2 checks don't seem to be related to my change

Copy link
Member

One more idea - if the class isn't an entity, the extension should return false even if the annotations are present. Please implement this with a test.

Please use ObjectMetadataResolver::isTransient() for this.

@acrobat acrobat force-pushed the fix-gedmo-unused-properties branch 2 times, most recently from 665f80f to e725541 Compare August 15, 2022 12:39
Copy link
Contributor Author

acrobat commented Aug 15, 2022

@ondrejmirtes I've implemented the requested changes, thanks for the suggestions!

@acrobat acrobat force-pushed the fix-gedmo-unused-properties branch from e725541 to 5afea15 Compare August 15, 2022 12:52
Copy link
Contributor Author

acrobat commented Sep 6, 2022

@ondrejmirtes are there any other changes needed here?

Copy link
Member

I like this, thank you :)

acrobat reacted with hooray emoji

@ondrejmirtes ondrejmirtes merged commit 62a3b42 into phpstan:1.3.x Sep 6, 2022
@acrobat acrobat deleted the fix-gedmo-unused-properties branch September 6, 2022 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ondrejmirtes ondrejmirtes ondrejmirtes approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[RFC] Support by default that Gedmo properties are always written

AltStyle によって変換されたページ (->オリジナル) /