Skip to content

[BUGFIX] Ship own value objects removed in Rector 2.9 - #4958

Merged
simonschaufi merged 2 commits into
sabbelasichon:mainfrom
konradmichalik:fix/rector-2.9-method-call-to-static-call
Nov 25, 2026
Merged

simonschaufi merged 2 commits into
sabbelasichon:mainfrom
konradmichalik:fix/rector-2.9-method-call-to-static-call

Conversation

@konradmichalik

@konradmichalik konradmichalik commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4957.

Rector 2.9 removed AddPropertyTypeDeclaration, RenameStaticMethod and MethodCallToStaticCall together with their deprecated rules. The rules in this package stay, but their configuration objects came from Rector, so 24 of 614 tests fail on 2.9.2.

This copies the three value objects to src/<Domain>/ValueObject/ (same place and namespace pattern as AddPropertyTypeWithDefaultValueDeclaration) and repoints the use statements in four rules, five set configs and six test configs. The copies are verbatim from Rector 2.8.5, including the validation (MethodCallToStaticCall checks method names with RectorAssert::className, as the original did).

The three new files are the only new code. The rest is a one-line import change per file.

Users who configure these rules in their own rector.php have to switch the import to the Ssch\TYPO3Rector\...\ValueObject class.

Verified on PHP 8.5 with Rector 2.9.2 and 2.8.3 (the lower bound of ^2.8.3): 614 tests, 45 skipped, no errors. ci:php:lint, ci:check-style, composer validate --strict and ci:check-typo3-rector pass. ci:php:stan still reports one error in rector.php:49 (LevelSetList is deprecated in 2.9), which this PR does not touch. The suite also passes on PHP 7.4.33 (614 tests, no errors, dependencies resolved for 7.4); style and PHPStan only ran on 8.5, so the CI matrix is the first run for those on 7.4.

Kanti added a commit to andersundsehr/grumphp-config that referenced this pull request Nov 25, 2026
The CI shows that ssch/typo3-rector 3.17.0 does not work with
Rector 2.9 (sabbelasichon/typo3-rector#4957) until a fixed release is
out (sabbelasichon/typo3-rector#4958).
@simonschaufi

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Can you please fix all the remaining issues?

@konradmichalik

Copy link
Copy Markdown
Contributor Author

Fixed the remaining PHPStan error in rector.php (the deprecated LevelSetList::UP_TO_PHP_74). It now uses withPhpSets() with positional arguments, because named arguments are not allowed on PHP 7.4. The result of Rector on the project itself is unchanged. The CI needs another approval to run.

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.

Incompatible with rector/rector 2.9: Rector\Transform\ValueObject\MethodCallToStaticCall not found

2 participants