[Php74] Skip readonly on RestoreDefaultNullToNullableTypePropertyRector (#1713)

* [Php74] Skip readonly on RestoreDefaultNullToNullableTypePropertyRector

* Fixed 🎉
This commit is contained in:
Abdul Malik Ikhsan 2022-01-22 16:38:37 +07:00 committed by GitHub
parent 369c2f7dfe
commit 88a32076c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,8 @@
<?php
namespace Rector\Tests\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector\Fixture;
class SkipReadonly
{
public readonly ?string $name;
}

View File

@ -90,6 +90,10 @@ CODE_SAMPLE
return true;
}
if ($property->isReadonly()) {
return true;
}
// is variable assigned in constructor
$propertyName = $this->getName($property);