Skip to content

Commit

Permalink
[CodingStyle] Remove AddArrayDefaultToArrayPropertyRector as based on…
Browse files Browse the repository at this point in the history
… docblock types and public contract, better use type declaration set instad (#5298)
  • Loading branch information
TomasVotruba committed Nov 28, 2023
1 parent c384032 commit 84bcfeb
Show file tree
Hide file tree
Showing 20 changed files with 6 additions and 702 deletions.
29 changes: 2 additions & 27 deletions build/target-repository/docs/rector_rules_overview.md
@@ -1,4 +1,4 @@
# 352 Rules Overview
# 351 Rules Overview

<br>

Expand All @@ -8,7 +8,7 @@

- [CodeQuality](#codequality) (72)

- [CodingStyle](#codingstyle) (28)
- [CodingStyle](#codingstyle) (27)

- [DeadCode](#deadcode) (42)

Expand Down Expand Up @@ -1572,31 +1572,6 @@ Use ===/!== over ==/!=, it values have the same type

## CodingStyle

### AddArrayDefaultToArrayPropertyRector

Adds array default value to property to prevent foreach over null error

- class: [`Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector`](../rules/CodingStyle/Rector/Class_/AddArrayDefaultToArrayPropertyRector.php)

```diff
class SomeClass
{
/**
* @var int[]
*/
- private $values;
+ private $values = [];

public function isEmpty()
{
- return $this->values === null;
+ return $this->values === [];
}
}
```

<br>

### ArraySpreadInsteadOfArrayMergeRector

Change `array_merge()` to spread operator
Expand Down
2 changes: 0 additions & 2 deletions config/set/coding-style.php
Expand Up @@ -5,7 +5,6 @@
use Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector;
use Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector;
use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
use Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector;
use Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector;
use Rector\CodingStyle\Rector\ClassConst\SplitGroupedClassConstantsRector;
use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector;
Expand Down Expand Up @@ -58,7 +57,6 @@
EncapsedStringsToSprintfRector::class,
WrapEncapsedVariableInCurlyBracesRector::class,
NewlineBeforeNewAssignSetRector::class,
AddArrayDefaultToArrayPropertyRector::class,
MakeInheritedMethodVisibilitySameAsParentRector::class,
CallUserFuncArrayToVariadicRector::class,
VersionCompareFuncCallToConstantRector::class,
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.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 84bcfeb

Please sign in to comment.