Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 6 additions & 77 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 393 Rules Overview
# 391 Rules Overview

<br>

Expand Down Expand Up @@ -50,7 +50,7 @@

- [Php82](#php82) (3)

- [Privatization](#privatization) (6)
- [Privatization](#privatization) (5)

- [Removing](#removing) (6)

Expand All @@ -60,7 +60,7 @@

- [Strict](#strict) (6)

- [Transform](#transform) (28)
- [Transform](#transform) (27)

- [TypeDeclaration](#typedeclaration) (40)

Expand Down Expand Up @@ -2219,7 +2219,9 @@ return static function (RectorConfig $rectorConfig): void {
{
public static function provideData()
{
- return [['some text']];
- return [
- ['some text']
- ];
+ yield ['some text'];
}
}
Expand Down Expand Up @@ -6334,36 +6336,6 @@ Change global `$variables` to private properties

<br>

### ChangeReadOnlyPropertyWithDefaultValueToConstantRector

Change property with read only status with default value to constant

- class: [`Rector\Privatization\Rector\Property\ChangeReadOnlyPropertyWithDefaultValueToConstantRector`](../rules/Privatization/Rector/Property/ChangeReadOnlyPropertyWithDefaultValueToConstantRector.php)

```diff
class SomeClass
{
/**
* @var string[]
*/
- private $magicMethods = [
+ private const MAGIC_METHODS = [
'__toString',
'__wakeup',
];

public function run()
{
- foreach ($this->magicMethods as $magicMethod) {
+ foreach (self::MAGIC_METHODS as $magicMethod) {
echo $magicMethod;
}
}
}
```

<br>

### FinalizeClassesWithoutChildrenRector

Finalize every class that has no children
Expand Down Expand Up @@ -7840,49 +7812,6 @@ return static function (RectorConfig $rectorConfig): void {

<br>

### NewToMethodCallRector

Replaces creating object instances with "new" keyword with factory method.

:wrench: **configure it!**

- class: [`Rector\Transform\Rector\New_\NewToMethodCallRector`](../rules/Transform/Rector/New_/NewToMethodCallRector.php)

```php
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Transform\Rector\New_\NewToMethodCallRector;
use Rector\Transform\ValueObject\NewToMethodCall;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(NewToMethodCallRector::class, [
new NewToMethodCall('MyClass', 'MyClassFactory', 'create'),
]);
};
```


```diff
class SomeClass
{
+ /**
+ * @var \MyClassFactory
+ */
+ private $myClassFactory;
+
public function example() {
- new MyClass($argument);
+ $this->myClassFactory->create($argument);
}
}
```

<br>

### NewToStaticCallRector

Change new Object to static call
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading