Skip to content

Commit

Permalink
[CodingStyle] Skip inside readonly class on AddArrayDefaultToArrayPro…
Browse files Browse the repository at this point in the history
…pertyRector (#3612)
  • Loading branch information
samsonasik committed Apr 13, 2023
1 parent edf54c8 commit f81f92c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Rector\Tests\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector\Fixture;

final readonly class SkipInReadonlyClass
{
/** @var string[] */
private array $arr;
}

Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ public function getNodeTypes(): array
*/
public function refactor(Node $node): ?Node
{
if ($node->isReadonly()) {
return null;
}

$changedProperties = $this->collectPropertyNamesWithMissingDefaultArray($node);
if ($changedProperties === []) {
return null;
Expand Down

0 comments on commit f81f92c

Please sign in to comment.