Skip to content

Commit

Permalink
[docs] getRuleDefinition() no longer required
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Nov 15, 2024
1 parent 4d3f35f commit c7d27f1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,26 @@ final class SimpleRector extends AbstractRector
}
}
```


### 2. `AbstractRector` get focused on code, the `getRuleDefinition()` is no longer required

Core rules need documentation, so people can read their feature and [search through](https://getrector.com/find-rule) them. Yet for writing custom rules and local rules, its not necessary. People often filled it empty, just to make Rector happy.

This is no longer needed. Now The `getRuleDefinition()` method has been removed:

```diff
use Rector\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;

class SimpleRector extends AbstractRector
{
- public function getRuleDefinition(): RuleDefinition
- {
- return new RuleDefinition('Make Rector happy', []);
- }
}
```

If you need description yourself to understand rule after many months, use the common place for documentation - docblock above class.

0 comments on commit c7d27f1

Please sign in to comment.