[README] bit info added

This commit is contained in:
TomasVotruba 2017-08-21 12:12:51 +02:00
parent 8c3fc9a493
commit 8c3fdb6e84

View File

@ -32,28 +32,85 @@ This tool will *reconstruct* (change) your code - **run it only in a new clean g
composer require rector/rector --dev
```
## Use
## Use (WIP)
```bash
vendor/bin/rector reconstruct src
vendor/bin/rector reconstruct src --framework Nette --to-version 2.4
vendor/bin/rector reconstruct src --framework Symfony --to-version 3.3
```
### How to Add New Rector
Just extend `Rector\Rector\AbstractRector`.
It will prepare **4 methods** - 2 informative and 2 processing the node.
```php
/**
* A project that is related to this.
* E.g "Nette", "Symfony"
* Use constants from @see SetNames, if possible.
*/
public function getSetName(): string
{
}
/**
* Version this deprecations is active since.
* E.g. 2.3.
*/
public function sinceVersion(): float
{
}
public function isCandidate(Node $node): bool
{
}
public function refactor(Node $node): ?Node
{
}
```
2. Put it under `namespace Rector\Contrib\<set>;` namespace
```php
<?php declare(strict_types=1);
namespace Rector\Contrib\Symfony;
use Rector\Rector\AbstractRector;
final class MyRector extends AbstractRector
{
// ...
}
```
3. Add a Test Case
4. Submit PR
5. :check:
### How to Contribute
Just follow 3 rules:
- **1 feature per pull-request**
- **New feature needs tests**. [Coveralls.io](https://coveralls.io/) checks code coverage under every PR.
- **New feature needs tests**
- Tests, coding standard and PHPStan **checks must pass**
```bash
composer all
```
Often you don't need to fix coding standard manually, just run:
Don you need to fix coding standards? Run:
```bash
composer fs
composer fix-cs
```
We would be happy to merge your feature then.