chore: add Rector and modernize code#1528
Merged
Merged
Conversation
- Add Rector tool to Makefile with rector and rector-check targets - Enable PHP 8.1 prepared set in rector.php; drop deprecated withPhpLevel - Update tests to use ::class constants instead of FQCN strings - Prefer arrow functions and first-class callables (e.g. strval(...), Path::normalize(...)) for array_map and callbacks - Remove redundant parent::setUp/tearDown calls in tests - Add explicit (string) casts where needed and tweak JUnit formatter tests to use correct implode glue This aligns the project with PHP 8.1, improves readability, and prepares codebase for automated refactoring with Rector.
patrickkusebauch
approved these changes
Jan 3, 2026
patrickkusebauch
left a comment
Collaborator
There was a problem hiding this comment.
So far looks fine.
patrickkusebauch
approved these changes
Jan 3, 2026
patrickkusebauch
left a comment
Collaborator
There was a problem hiding this comment.
So far so good.
xabbuh
reviewed
Jan 7, 2026
|
|
||
| foreach ($refs as $ref) { | ||
| $name = preg_replace('/^.*\\\\(\w+(\(\))?)$/', '$1', $ref->getToken()->toString()); | ||
| $name = preg_replace('/^.*\\\\(\w+(\(\))?)$/', '$1', (string) $ref->getToken()->toString()); |
Contributor
There was a problem hiding this comment.
Can the string type not be enforced on the toString() method instead?
Collaborator
Author
There was a problem hiding this comment.
I went down the rabbit hole :-).
The problem is that we don't enforce array-shapes (see refsByName signature), therefore rector does not know what $ref is and adds the cast.
Contributor
There was a problem hiding this comment.
Makes sense, thanks for digging. :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This aligns the project with PHP 8.1, improves readability, and prepares codebase for automated refactoring with Rector.