Skip to content
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

Fix phpstan errors #2593

Merged
merged 3 commits into from
Dec 17, 2023
Merged

Fix phpstan errors #2593

merged 3 commits into from
Dec 17, 2023

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Nov 29, 2023

Q A
Type bug/feature/improvement
BC Break yes/no
Fixed issues

Summary

This fixes one error where the enumType mapping field gets rewritten to the class-string<UnitEnum> type because we don't ensure that the enum is backed before re-assigning enumType. The other issue in mapField is less obvious and I can't figure out where it takes the class-string<UnitEnum> type from, so I decided to ignore that for the time being. These issues started appearing with the latest phpstan release.

@alcaeus alcaeus self-assigned this Nov 29, 2023
@alcaeus alcaeus marked this pull request as draft November 29, 2023 14:57
@franmomu
Copy link
Contributor

franmomu commented Dec 6, 2023

I've changed to use ReflectionEnum::isBacked() call, this should eventually narrow the type of ReflectionEnum::getType() to class-string<BackedEnum> I guess, so I think we can ignore these errors for now.

I'll try to fix it in phpstan following phpstan/phpstan#10192 (comment)

@franmomu franmomu marked this pull request as ready for review December 17, 2023 19:45
Copy link
Member

@malarzm malarzm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no clue what's going on with ignored errors either :/

Ah, you fixed the bug in PHPStan, cool!

@malarzm malarzm merged commit a51bfc0 into doctrine:2.6.x Dec 17, 2023
16 checks passed
@malarzm
Copy link
Member

malarzm commented Dec 17, 2023

Thanks @alcaeus and @franmomu!

@alcaeus alcaeus deleted the fix-phpstan branch December 18, 2023 07:37
@alcaeus
Copy link
Member Author

alcaeus commented Dec 18, 2023

Thanks @franmomu for finishing this! 🎉

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.

None yet

3 participants