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

Check that doctrine entities are not final #143

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:master from enumag:feature/final-entities
Sep 25, 2020

Conversation

@enumag
Copy link
Contributor

@enumag enumag commented Sep 24, 2020

I create all my classes as final by default. This however can cause issues with Doctrine:

 [Doctrine\Common\Proxy\Exception\InvalidArgumentException]
 Unable to create a proxy for a final class "<entity class>".

What do you think about a rule to avoid final entities?

mhujer and TomasVotruba reacted with thumbs up emoji
Copy link
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

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

Yeah, I'm fine with this. Please add it as a bleeding edge rule similar to here: https://github.com/phpstan/phpstan-strict-rules/blob/334898a32217e4605e0f9cfa3d3fc3101bda26be/rules.neon#L67-L69

@enumag enumag force-pushed the feature/final-entities branch 2 times, most recently from 2b17ca7 to 7cc794d Compare September 24, 2020 09:11
@enumag enumag marked this pull request as ready for review September 24, 2020 09:11
Copy link
Contributor Author

enumag commented Sep 24, 2020

@ondrejmirtes Updated according to your suggestions. Also added a test case.

Copy link
Contributor Author

enumag commented Sep 24, 2020

Hmm... there is already a similar pull request: #84

Except I slightly disagree with the statement that entities shouldn't have final methods. I have a case where I'm actually using final method on purpose. But then again I could just disable that particular rule in my codebase.

Copy link
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

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

I'm fine with the rule in this PR as it is.

@enumag enumag force-pushed the feature/final-entities branch 2 times, most recently from d52b474 to 30f2b9e Compare September 24, 2020 12:52
Copy link
Contributor Author

enumag commented Sep 24, 2020

Done. :-)

@enumag enumag force-pushed the feature/final-entities branch from 30f2b9e to 89c2186 Compare September 25, 2020 13:23
Copy link
Contributor Author

enumag commented Sep 25, 2020

Should be okay now.

@ondrejmirtes ondrejmirtes merged commit 207a6ae into phpstan:master Sep 25, 2020
Copy link
Member

Thank you!

Copy link
Member

Tagged as 0.12.20.

Copy link
Contributor

mhujer commented Sep 28, 2020

@enumag thanks! 👍

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

Reviewers

@ondrejmirtes ondrejmirtes Awaiting requested review from ondrejmirtes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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