Skip to content

Migrate rector.php to RectorConfig::configure() builder#420

Merged
turegjorup merged 2 commits into
release/3.0.0from
feature/rector-fix-calendar-feed
May 1, 2026
Merged

Migrate rector.php to RectorConfig::configure() builder#420
turegjorup merged 2 commits into
release/3.0.0from
feature/rector-fix-calendar-feed

Conversation

@turegjorup

@turegjorup turegjorup commented May 1, 2026

Copy link
Copy Markdown
Contributor

Description

Two commits, primary scope is migrating rector.php to the modern builder pattern. The Rector failure on CalendarApiFeedType (which CI surfaced after 987ae75c) is fixed in passing.

1. Migrate rector.php to RectorConfig::configure() builder

The legacy callable-config style is being phased out in Rector's docs in favour of the fluent builder. Same paths, same single rule (InlineConstructorDefaultToPropertyRector), same set list (LevelSetList::UP_TO_PHP_82 and the Doctrine/Symfony sets). One chained return statement so the file reads top-down. No semantic change.

2. Skip NullToStrictStringFuncCallArgRector on CalendarApiFeedType

987ae75c ("7329: Omit event on PCRE error in title modifier") removed three (string) $title casts in applyModifiersToEvents because they silently turned a preg_replace null return (PCRE runtime error) into an empty string, letting an event through with no filter applied. The current code stores the result into $replaced, null-checks it, and continue 2s with an error log on PCRE error.

Rector wants the casts back. Applying them re-introduces the silent coercion 987ae75c set out to remove. Suppressing the rule for that one file is the honest answer — comment in rector.php explains why. Two more invasive alternatives exist (PHPDoc'ing the modifier array shape, or narrowing the type at the assignment with is_string), both viable follow-ups if the team wants to lift the suppression later.

Verification

docker compose run --rm phpfpm vendor/bin/rector --dry-run returns [OK] Rector is done! locally. CI on this PR is the canonical check.

Checklist

  • My code is covered by test cases. (Rector itself is the test.)
  • My code passes our test (all our tests).
  • My code passes our static analysis suite.
  • My code passes our continuous integration process.

turegjorup and others added 2 commits May 1, 2026 09:48
The legacy callable-config style (return static function (RectorConfig
$rectorConfig)) is being phased out in Rector's docs in favour of the
fluent builder. Same paths, same single rule, same sets — just folded
into one chained return statement so the file reads top-down.

No semantic change: LevelSetList::UP_TO_PHP_82 stays the same and
covers PHP improvements through 8.2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
987ae75 removed the (string) casts around preg_match / preg_replace /
trim in applyModifiersToEvents because they silently turned a
preg_replace null return (PCRE runtime error) into an empty title,
letting an event through with no filter applied. Rector wants the
casts back; applying them re-introduces the silent coercion the
commit specifically set out to remove. Suppressing the rule on this
file alone is the honest answer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@turegjorup
turegjorup force-pushed the feature/rector-fix-calendar-feed branch from af9cb78 to e8cc53b Compare May 1, 2026 07:49
@turegjorup turegjorup changed the title Skip NullToStrictStringFuncCallArgRector on CalendarApiFeedType Migrate rector.php to RectorConfig::configure() builder May 1, 2026
@tuj
tuj self-requested a review May 1, 2026 09:45
@turegjorup
turegjorup merged commit 144d4b6 into release/3.0.0 May 1, 2026
17 checks passed
@turegjorup
turegjorup deleted the feature/rector-fix-calendar-feed branch May 1, 2026 09:46
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