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

Use final and readonly where possible #532

Merged
merged 1 commit into from
Sep 26, 2023

Conversation

derrabus
Copy link
Member

Finalizing classes/methods or flagging properties as readonly helps a reader understand how a class is used and what impact a code change may have. I propose to make final and readonly the default in this codebase.

@SenseException
Copy link
Member

Why are some classes "just" /** @final */?

@derrabus
Copy link
Member Author

Because we create mocks for those classes. 😢

Copy link
Member

@SenseException SenseException 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 currently working on increasing the test coverage. I'll come back to the final-annotation in case a mock is serviceable. I don't want to use nunomaduro/mock-final-classes on new tests.

@SenseException SenseException merged commit 82d7d1e into doctrine:master Sep 26, 2023
@derrabus derrabus deleted the improvement/final-readonly branch September 26, 2023 23:21
@derrabus
Copy link
Member Author

Sure, whenever you need to create a mock, feel free to un-finalize classes.

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.

2 participants