Skip to content

Update Rector - #59

Merged
vjik merged 2 commits into
masterfrom
fix-rector
Nov 1, 2026
Merged

vjik merged 2 commits into
masterfrom
fix-rector

Conversation

@vjik

@vjik vjik commented Nov 1, 2026 •

Copy link
Copy Markdown
Member
Q A
Is bugfix? ❌
New feature? ❌
Breaks BC? ❌

Summary by Sourcery

Update Rector tooling and modernize the related project configuration and test setup.

Enhancements:

  • Update the Rector development dependency and configuration to use the current PHP rule sets.
  • Modernize test connection initialization with null-coalescing assignment.

@sourcery-ai

sourcery-ai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR updates Rector to a newer release, aligns its configuration with modern PHP sets and formatting, and refactors test PDO initialization to use concise null-coalescing assignment while preserving connection behavior.

File-Level Changes

Change Details Files
Upgrade Rector tooling and modernize its PHP/configuration targets.
  • Bump the Rector development dependency from 2.5 to 2.8.3.
  • Replace the PHP 7.4-specific set with the broader modern PHP sets.
  • Normalize path concatenation formatting in the Rector configuration.
composer.json
rector.php
Simplify lazy test database connection initialization without changing behavior.
  • Use null-coalescing assignment to create the PDO connection only when it has not already been initialized.
  • Preserve the existing PostgreSQL DSN, credentials, and exception-mode options.
tests/TestCase.php

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sourcery assessment

Approved.

@codecov

codecov Bot commented Nov 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b4e70bf) to head (d05d257).

Additional details and impacted files
@@             Coverage Diff             @@
##              master       #59   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity         6         6           
===========================================
  Files              2         2           
  Lines             23        23           
===========================================
  Hits              23        23           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="rector.php" line_range="13" />
<code_context>
+        __DIR__ . '/tests',
     ])
-    ->withPhp74Sets()
+    ->withPhpSets()
     ->withSets([
         SetList::YII_CORE,
</code_context>
<issue_to_address>
**Local Rector targets newer PHP**

When rector is run locally with PHP 8.x, `withPhpSets()` uses the PHP version running Rector when no target is specified, so running it locally on PHP 8.x enables upgrades that can make the code incompatible with the package's PHP 7.4 minimum; callers then see failures on PHP 7.4.

Set the PHP-set target explicitly to the minimum supported PHP version, or derive it from a deliberate project target rather than the runtime.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: rector.php:13


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread rector.php
__DIR__ . '/tests',
])
->withPhp74Sets()
->withPhpSets()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Local Rector targets newer PHP

When rector is run locally with PHP 8.x, withPhpSets() uses the PHP version running Rector when no target is specified, so running it locally on PHP 8.x enables upgrades that can make the code incompatible with the package's PHP 7.4 minimum; callers then see failures on PHP 7.4.

Set the PHP-set target explicitly to the minimum supported PHP version, or derive it from a deliberate project target rather than the runtime.

Prompt for AI agents
In `rector.php` at line 13:

**Local Rector targets newer PHP**

When rector is run locally with PHP 8.x, `withPhpSets()` uses the PHP version running Rector when no target is specified, so running it locally on PHP 8.x enables upgrades that can make the code incompatible with the package's PHP 7.4 minimum; callers then see failures on PHP 7.4.

Set the PHP-set target explicitly to the minimum supported PHP version, or derive it from a deliberate project target rather than the runtime.

@vjik
vjik merged commit b00a9e4 into master Nov 1, 2026
28 checks passed
@vjik
vjik deleted the fix-rector branch November 1, 2026 16:31
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.

1 participant