Skip to content

Commit

Permalink
InlineConstructorDefaultToPropertyRector Readonly Class (#5085)
Browse files Browse the repository at this point in the history
  • Loading branch information
beschoenen committed Sep 27, 2023
1 parent 1a65049 commit 5fb68b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
@@ -0,0 +1,13 @@
<?php

namespace Rector\Tests\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector\Fixture;

readonly class DoNotChangeReadonlyClass
{
private string $name;

public function __construct()
{
$this->name = 'John';
}
}
Expand Up @@ -162,7 +162,7 @@ private function refactorProperty(
}

// readonly property cannot have default value
if ($classStmt->isReadonly()) {
if ($classStmt->isReadonly() || $class->isReadonly()) {
continue;
}

Expand Down

0 comments on commit 5fb68b4

Please sign in to comment.