Instant Upgrades and Automated Refactoring of any PHP 5.3+ code
Go to file
2017-09-27 17:02:54 +02:00
bin bin/rector: allow custom config 2017-09-27 17:02:54 +02:00
packages cs fixes 2017-09-27 17:02:54 +02:00
patches fix patch 2017-09-21 12:19:20 +02:00
src add own Appication with --config 2017-09-27 17:02:54 +02:00
tests [Rector] add CompilerAddPassPriorityRector 2017-09-20 18:18:42 +02:00
.coveralls.yml init meta files 2017-07-15 19:12:04 +02:00
.gitignore init 2017-07-15 19:01:21 +02:00
.travis.yml simplify travis.yml 2017-08-15 15:19:34 +02:00
CODE_OF_CONDUCT.md init meta files 2017-07-15 19:12:04 +02:00
composer.json add few php-parser patches; use MethodReflector to avoid class_exist code running 2017-09-21 11:44:04 +02:00
easy-coding-standard.neon cs fixes 2017-09-21 11:49:02 +02:00
LICENSE init meta files 2017-07-15 19:12:04 +02:00
phpstan.neon rename TriggerExtractor to DeprecationExtractor 2017-09-08 20:42:16 +02:00
phpunit.xml add /packages directory to static analysis check 2017-08-20 17:20:33 +02:00
README.md update README badges to new org 2017-09-21 12:40:27 +02:00
rector.neon cs fixes 2017-09-27 17:02:54 +02:00

Rector - Reconstruct your Legacy Code to Modern Codebase

Build Status Coverage Status

This tool will upgrade your application for you.

All Reconstructors

At the moment these packages are supported:

Install

composer require rector/rector --dev

Use (WIP)

vendor/bin/rector reconstruct src --level=nette24
vendor/bin/rector reconstruct src --level=symfony40

6 Steps to Add New Rector

Just extend Rector\Rector\AbstractRector. It will prepare 2 methods processing the node.

public function isCandidate(Node $node): bool
{
}

public function refactor(Node $node): ?Node
{
}
  1. Put it under namespace Rector\Contrib\<set>; namespace
<?php declare(strict_types=1);

namespace Rector\Contrib\Symfony;
    
use Rector\Rector\AbstractRector;

final class MyRector extends AbstractRector
{
    // ...
}
  1. Add a Test Case

  2. Add to specific level, e.g. /src/config/level/nette/nette24.yml

  3. Submit PR

  4. 👍

How to Contribute

Just follow 3 rules:

  • 1 feature per pull-request

  • New feature needs tests

  • Tests, coding standard and PHPStan checks must pass

    composer all
    

    Don you need to fix coding standards? Run:

    composer fix-cs
    

We would be happy to merge your feature then.