Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Rector Rules Laravel Package

ergebnis/rector-rules

A curated set of custom Rector rules from ergebnis to automate PHP refactoring and style consistency. Includes rules for sorting arrays and match arms, simplifying call arguments, Faker updates, namespace symbol references, and PHPUnit attribute-to-prefix changes.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Code Modernization & Refactoring: Accelerates adoption of PHP 8.x+ features (e.g., named arguments, match expressions) by automating backward-compatible refactors. Aligns with roadmaps for PHP 8.5+ migration or legacy code cleanup.
  • Consistency Enforcement: Enables standardized code patterns (e.g., sorted associative arrays, alphabetized match arms) via CI/CD pipelines, reducing manual review overhead.
  • Build vs. Buy: Buy for niche refactoring needs (e.g., Faker property deprecations, PHPUnit attribute migration) instead of building custom scripts. Build only if rules require custom domain logic.
  • Use Cases:
    • Onboarding: Standardize new codebases to team conventions (e.g., test* method prefixes).
    • Tech Debt: Automate fixes for deprecated APIs (e.g., Faker properties, Symfony components).
    • Performance: Optimize namespace imports (e.g., use Example\Core instead of use Example\Core\Routing\Attribute).

When to Consider This Package

  • Adopt if:

    • Your codebase uses Rector for refactoring (or plans to).
    • You need specific PHP 8.x+ syntax migrations (e.g., named args, match expressions).
    • Maintaining consistent code style is a priority (e.g., sorted arrays, alphabetized match arms).
    • You rely on deprecated libraries (e.g., Faker properties, Symfony 5.x components) and want automated fixes.
    • Your team lacks bandwidth for manual refactoring but needs compliance with new standards.
  • Look elsewhere if:

    • You’re not using Rector (this package is a Rector plugin).
    • Your refactoring needs are broad (e.g., full architecture overhauls) rather than syntax/style-specific.
    • You require custom business logic in refactors (consider building a custom Rector rule).
    • Your codebase is already PHP 8.5+ compliant with no legacy dependencies.
    • You prioritize runtime performance over static analysis (Rector runs at dev time).

How to Pitch It (Stakeholders)

For Executives: "This package automates tedious, error-prone code refactoring—like updating deprecated APIs or enforcing consistent syntax—saving dev time and reducing technical debt. For example, it can migrate PHPUnit’s new #[Test] attributes to legacy test* methods in hours, not weeks. It’s a low-risk way to modernize our codebase while maintaining backward compatibility."

For Engineering: *"Rector + ergebnis/rector-rules lets us:

  • Enforce conventions (e.g., sorted match arms, relative namespace imports) via CI.
  • Fix deprecated code (e.g., Faker properties, Symfony 5.x) with a single command.
  • Future-proof the codebase for PHP 8.5+ without manual effort. Example: Run rector process src --dry-run to preview changes before merging. Rules like RemoveNamedArgumentForSingleParameterRector clean up verbose calls like strlen(string: 'hello') to strlen('hello')."*

Key Metrics to Highlight:

  • Time saved: Automates hours of manual refactoring per release.
  • Risk reduction: Dry-run mode validates changes before deployment.
  • Consistency: Enforces team standards (e.g., alphabetized match arms) automatically.
  • Cost: Free (MIT license), with minimal maintenance overhead.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony