Skip to content

Conversation

@mairo744
Copy link

@mairo744 mairo744 commented Aug 9, 2025

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

Description

This PR introduces strict typing enforcement using Rector.

  • Adds Rector to the project and configures it to enforce strict typing rules.
  • Applies readonly properties where applicable.
  • Adds scalar and class parameter types, return types, and property types throughout the codebase.
  • Updates psalm-baseline.xml to remove ignored issues that are now resolved through typing improvements.

@gsteel gsteel added BC Break QA Quality assurance tasks such as static analysis improvements labels Aug 14, 2025
@gsteel gsteel added this to the 5.0.0 milestone Aug 14, 2025
@gsteel gsteel requested a review from a team August 14, 2025 08:25
@gsteel gsteel changed the base branch from 4.12.x to 5.0.x August 14, 2025 08:25
@Xerkus
Copy link
Member

Xerkus commented Aug 14, 2025

This is potentially problematic due to no constraints on swoole versions. We test with a single swoole version while there are several major releases. This might be broken and we wouldn't even know it.

@Ocramius
Copy link
Member

Wait, ext-swoole is not even listed under require?!

@Xerkus
Copy link
Member

Xerkus commented Aug 14, 2025

@Ocramius what is worse it can be swoole or openswoole, which diverged and later is pretty much in maintenance only state for a while.

I did bring this up in TSC meeting last year although discussion went nowhere at the time iirc

@gsteel
Copy link
Member

gsteel commented Aug 14, 2025

We need to drop support for OpenSwoole IMO and require ext-swoole at specific versions for the next major.

I don't think we need a TSC vote to do that do we?

@Ocramius
Copy link
Member

The worst that can happen is blocking off an upgrade path: constraint reduction can always be done, while widening is more "definitive"

@mairo744
Copy link
Author

mairo744 commented Oct 5, 2025

Thanks everyone for the feedback.

I’ve updated this in #144 to use Swoole v6, which is now installed and tested in CI. Everything passes and the typing changes work correctly.

Let me know if there’s anything else needed to move this forward.

@Ocramius
Copy link
Member

Ocramius commented Oct 6, 2025

@mairo744 I'd say that a rebase of this one is needed then :-)

@Xerkus
Copy link
Member

Xerkus commented Oct 6, 2025

It was rebased.

For the record, I do not like addition of QA tooling to composer.json and to package workflows like here. It is something that needs to be done organization wide via shared CI workflows and actions to be consistent everywhere.

@mairo744
Copy link
Author

mairo744 commented Oct 7, 2025

I automated this using Rector and added it to the CI workflow to prevent newly added code from violating these rules. I think this is important to maintain code quality.

That said, I agree it would be better to handle this organization-wide through shared CI workflows for consistency.
I also noticed that dependency checking is currently missing, which I believe is an important part of QA as well.

Would you be able to bring this up with the Laminas TSC, or let me know how I can help move it forward? I’d really like to contribute, but I’m not sure what the best next step is.

@Ocramius
Copy link
Member

Ocramius commented Oct 8, 2025

I'm fine with adding tooling that is locked here: the maintainers of mezzio/mezzio-swoole can kick it out at any time, if needed.

Introducing it in a more generalized way would be nice, and can be proposed for the Laminas CI Matrix Action, IMO: I'd love to see it happen, and I never found the time to do it.

@Xerkus
Copy link
Member

Xerkus commented Oct 8, 2025

Psalm is not swoole aware so I do not have high confidence. I will need to carefully review this manually.

@mairo744 is this blocking any more work you want to do on this component?

@mairo744
Copy link
Author

mairo744 commented Oct 8, 2025

Thanks for taking the time to review this.

I can hold off on the Rector improvements for now and move to dependency analysis or other work. I think Psalm should be able to check most of the Swoole code with swoole/ide-helper, but I agree that manual review is important.

Looking forward to your feedback

Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

This is a lot of tiny BC breaks all over the place, but IMO should be go in as-is.

@Xerkus I think you should press the merge button, when happy about it.

@Xerkus
Copy link
Member

Xerkus commented Oct 12, 2025

Added couple more type declarations in tests and other minor QA improvements.

@Xerkus Xerkus merged commit 8c34085 into mezzio:5.0.x Oct 12, 2025
12 checks passed
@Xerkus
Copy link
Member

Xerkus commented Oct 12, 2025

@mairo744 thank you

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.

5 participants