Skip to content

Commit

Permalink
[Php74] Skip property hook on RestoreDefaultNullToNullableTypePropert…
Browse files Browse the repository at this point in the history
…yRector (#6736)
  • Loading branch information
samsonasik authored Feb 14, 2025
1 parent aca623e commit 6137332
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\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector\Fixture;

final class SkipPropertyHook
{
public ?string $bar {
get => 'bar';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ private function shouldSkipProperty(Property $property, Class_ $class): bool
return true;
}

if ($property->hooks !== []) {
return true;
}

// is variable assigned in constructor
$propertyName = $this->getName($property);
return $this->constructorAssignDetector->isPropertyAssignedConditionally($class, $propertyName);
Expand Down

0 comments on commit 6137332

Please sign in to comment.