Skip to content

Conversation

@mairo744
Copy link

Q A
Documentation no
Bugfix no
BC Break yes
New Feature no
RFC yes
QA yes

Description

This PR makes all eligible classes final.
Some classes remain non-final because they are required for mocking in tests or represent intentional extension points.

What was done

  • Declared final on all classes that are not designed for inheritance.
  • Excluded classes that:
    • Are mocked in tests and require non-final status.
    • Are explicitly intended as extension points.
  • Updated tests where necessary to account for final declarations.

Impact

  • This is a backwards-incompatible change: projects extending classes that are now final will need to refactor.

@gsteel
Copy link
Member

gsteel commented Sep 15, 2025

@mairo744 - We could do with getting #94 merged first, having a bit of a tidy-up, releasing a minor and then rebasing this once 2.x is merged up into 3.x so that this and future work doesn't end up with loads of conflicts.

I'll try and get to that ASAP 👍

@mairo744
Copy link
Author

@mairo744 - We could do with getting #94 merged first, having a bit of a tidy-up, releasing a minor and then rebasing this once 2.x is merged up into 3.x so that this and future work doesn't end up with loads of conflicts.

I'll try and get to that ASAP 👍

Thanks for the update. No worries and take your time. Once #94 is merged into 3.x, I’ll rebase, resolve any conflicts if they come up, and update this PR. I’ll be ready to help when the time comes. 👍

@gsteel
Copy link
Member

gsteel commented Sep 16, 2025

Ready for a rebase now @mairo744 👍

@mairo744
Copy link
Author

I’ve already rebased the branch and resolved the conflicts. Some @Final annotations remain because converting them to final class declarations breaks tests with is declared final and cannot be doubled.

I'm prepared to do this, but it will be a more involved task to rewrite the tests without using mocks.

@gsteel gsteel added this to the 3.0.0 milestone Sep 17, 2025
@gsteel gsteel added BC Break QA Quality assurance tasks such as static analysis improvements labels Sep 17, 2025
@gsteel gsteel self-assigned this Sep 17, 2025
Copy link
Member

@gsteel gsteel left a comment

Choose a reason for hiding this comment

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

Thanks @mairo744

Talking about mocks - ideally we'd rid this library of Prophecy in favour of regular PHPUnit mocks as per #70

It might be an opportunity to improve things by introducing interfaces where necessary.

@gsteel gsteel merged commit 5ccfea7 into mezzio:3.0.x Sep 17, 2025
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BC Break QA Quality assurance tasks such as static analysis improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants