Skip to content

feat: update to use PHPStan Extension Installer - #108

Merged
owenvoke merged 1 commit into
mainfrom
feature/extension-installer
Oct 27, 2026
Merged

owenvoke merged 1 commit into
mainfrom
feature/extension-installer

Conversation

@owenvoke

Copy link
Copy Markdown
Member

No description provided.

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

📝 Summary

Summary by CodeRabbit

  • New Features
    • PHPStan now automatically discovers and loads supported extension configurations.
    • Optional Laravel analysis rules are enabled when the relevant Laravel analysis packages are installed, with stricter checks available when both packages are present.
    • Rector can use discovered PHPStan extensions and conditionally apply Laravel support.
  • Bug Fixes
    • PHPUnit usage checks now correctly account for abstract and anonymous classes.
  • Documentation
    • Added setup guidance, including a warning about duplicate PHPStan configuration includes.

The package now registers PHPStan configuration through Composer’s extension installer, conditionally loads Larastan configurations, and exposes discovered extension configurations to Rector. The Larastan strict rules use a separate configuration. DisallowPHPUnitRule now uses PHPStan class reflection to identify eligible classes and PHPUnit subclasses.

Changes: PHPStan extension setup

Layer / File(s) Summary
Register PHPStan and Larastan configurations
composer.json, extension.php, larastan-strict-rules.neon, larastan.neon, phpstan.neon, README.md
Composer registers the PHPStan extension installer and makes Larastan packages optional development dependencies. The extension configuration conditionally includes Larastan rules. The strict-rules settings are in a separate configuration. The README describes the setup and duplicate-inclusion warning.
Load discovered extensions in Rector
src/WorksomeRectorConfig.php, rector.php, stubs/phpstan.neon.stub
Rector collects include paths from registered PHPStan extensions and adds the Larastan bootstrap when the extension is registered. The Rector entry point and PHPStan stub no longer explicitly include Larastan configuration.

PHPUnit class detection

Layer / File(s) Summary
Use reflection for PHPUnit class detection
src/PHPStan/DisallowPHPUnitRule.php
The rule targets InClassNode and uses reflection to skip abstract or anonymous classes and check for PHPUnit test subclasses.

Priority: Pending latest changes

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Merge Risk: Moderate · up to e9432

Fix the failing style check before merging. Deployments that move an installed vendor tree may also be unable to start Rector until its extension paths are resolved relative to the installation.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@owenvoke
owenvoke force-pushed the feature/extension-installer branch from e9432d6 to 8be74a1 Compare October 27, 2026 13:02
@owenvoke
owenvoke merged commit 49b5856 into main Oct 27, 2026
6 checks passed
@owenvoke
owenvoke deleted the feature/extension-installer branch October 27, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant