Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report

rector/rector 1.0.3

Instant Upgrade and Automated Refactoring of any PHP code
Package summary
Share
0
issues
0
licenses
Package created
15 Jul 2017
Version published
14 Mar 2024
Maintainers
2
Total deps
0
Direct deps
0
License
MIT
Generating a report...
Hold on while we generate a fresh audit report for this package.

Frequently Asked Questions

What does rector/rector do?

Rector, also known as rector/rector, is an exceptional tool designed to instantly upgrade and refactor your PHP code. It effectively serves two main purposes. Firstly, it offers instant upgrades from PHP 5.3 to 8.2 and supports major open-source projects such as Symfony, PHPUnit and Doctrine. This ensures that you can have your code constantly at the cutting-edge level of PHP and frameworks without exerting any effort. Secondly, Rector allows for automated refactoring. If you want to maintain high code quality, especially when introducing new developers to your team, Rector can streamlines this process. Simply add Rector to your CI and let it continuously refactor your code to maintain a high code quality.

How do you use rector/rector?

To use Rector/rector, start by installing it using composer with the following command: composer require rector/rector --dev. After installing, there are two main ways to use Rector, either by a single rule for controlled changes, or by groups of rules known as sets. This can be done by creating a rector.php file in your root directory with the command vendor/bin/rector, and modifying it as follows:

use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;

return static function (RectorConfig $rectorConfig): void {
    // register single rule
    $rectorConfig->rule(TypedPropertyFromStrictConstructorRector::class);

    // here we can define, what sets of rules will be applied
    // tip: use "SetList" class to autocomplete sets with your IDE
    $rectorConfig->sets([
        SetList::CODE_QUALITY
    ]);
};

You can then run Rector using the command: vendor/bin/rector process src. If you prefer to verify the changes that would be made first, use the --dry-run option as follows: vendor/bin/rector process src --dry-run.

Where are the rector/rector docs?

For complete documentation and additional details on how to use Rector/rector, you can visit the official documentation. You can also explore the find variety of Rector Rules through the Rector Rules overview page. For a more in-depth understanding of how Rector works, creating your own rules, and more, consider reading Rector - The Power of Automated Refactoring book. This book guides you step by step through the Rector setup and how to create your own rules.