mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-10 21:22:21 +00:00
add to README
This commit is contained in:
parent
8853ac5957
commit
c1b4084d3b
34
README.md
34
README.md
|
@ -64,8 +64,8 @@ vendor/bin/rector
|
|||
|
||||
### Extra Autoloading
|
||||
|
||||
Rector relies on project and autoloading of its classes. To specify own autoload file, use `--autoload-file` option:
|
||||
|
||||
Rector relies on project and autoloading of its classes. To specify own autoload file, use `--autoload-file` option:
|
||||
|
||||
```bash
|
||||
vendor/bin/rector process ../project --autoload-file ../project/vendor/autoload.php
|
||||
```
|
||||
|
@ -259,29 +259,51 @@ rectors:
|
|||
rectors:
|
||||
Rector\Rector\Dynamic\ValueObjectRemoverRector:
|
||||
# type: new simple type
|
||||
'ValueObjects\Name': 'string'
|
||||
'ValueObject\Name': 'string'
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```diff
|
||||
- $value = new ValueObjects\Name('Tomas');
|
||||
- $value = new ValueObject\Name('Tomas');
|
||||
+ $value = 'Tomas';
|
||||
```
|
||||
|
||||
```diff
|
||||
/**
|
||||
-* @var ValueObjects\Name
|
||||
-* @var ValueObject\Name
|
||||
+* @var string
|
||||
*/
|
||||
private $name;
|
||||
```
|
||||
|
||||
```diff
|
||||
- public function someMethod(ValueObjects\Name $name) { ...
|
||||
- public function someMethod(ValueObject\Name $name) { ...
|
||||
+ public function someMethod(string $name) { ...
|
||||
```
|
||||
|
||||
## Replace Property and Methods Annotations
|
||||
|
||||
```yml
|
||||
rectors:
|
||||
Rector\Rector\Dynamic\AnnotationReplacerRector:
|
||||
PHPUnit\Framework\TestCase:
|
||||
scenario: test
|
||||
```
|
||||
|
||||
```diff
|
||||
final class SomeTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
- * @scenario
|
||||
+ * @test
|
||||
*/
|
||||
public function test()
|
||||
{
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Turn Magic to Methods
|
||||
|
||||
### Replace `get/set` magic methods with real ones
|
||||
|
|
|
@ -21,7 +21,7 @@ final class AnnotationReplacerRector extends AbstractPHPUnitRector
|
|||
/**
|
||||
* @var string[][]
|
||||
*/
|
||||
private $classToAnnotationMap;
|
||||
private $classToAnnotationMap = [];
|
||||
|
||||
/**
|
||||
* @var DocBlockAnalyzer
|
||||
|
|
Loading…
Reference in New Issue
Block a user