Skip to content

Commit

Permalink
[DOCS] Generate documentation
Browse files Browse the repository at this point in the history
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
wernerkrauss authored and github-actions[bot] committed Oct 22, 2024
1 parent 85a7992 commit 5d2388a
Showing 1 changed file with 43 additions and 3 deletions.
46 changes: 43 additions & 3 deletions docs/all_rectors_overview.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,67 @@
# 3 Rules Overview

## AddConfigPropertiesRector
<br>

## Categories

- [Rector](#rector) (3)

<br>

## Rector

### AddConfigPropertiesRector

Adds `@config` property to predefined private statics, e.g. `$db` or `$allowed_actions`

:wrench: **configure it!**

- class: [`Netwerkstatt\SilverstripeRector\Rector\Misc\AddConfigPropertiesRector`](../src/Rector/Misc/AddConfigPropertiesRector.php)

```diff
class SomeClass extends \SilverStripe\ORM\DataObject
{
+ /**
+ * @config
+ */
private static $db = [];
}
```

<br>

## EnsureTableNameIsSetRector
### EnsureTableNameIsSetRector

DataObject subclasses must have "$table_name" defined

- class: [`Netwerkstatt\SilverstripeRector\Rector\DataObject\EnsureTableNameIsSetRector`](../src/Rector/DataObject/EnsureTableNameIsSetRector.php)

```diff
class SomeClass extends \SilverStripe\ORM\DataObject
{
+ private static $table_name = 'SomeClass';
+
private static $db = [];
}
```

<br>

## UseCreateRector
### UseCreateRector

Change new Object to static call for classes that use Injectable trait

- class: [`Netwerkstatt\SilverstripeRector\Rector\Injector\UseCreateRector`](../src/Rector/Injector/UseCreateRector.php)

```diff
class SomeClass
{
public function run()
{
- new InjectableClass($name);
+ InjectableClass::create($name);
}
}
```

<br>

0 comments on commit 5d2388a

Please sign in to comment.