Skip to content

Commit e1a225e

Browse files
committed
improve ClassPropertyAssignToConstructorPromotionRector not to use stmts key
1 parent c7053b2 commit e1a225e

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,7 @@ public function refactor(Node $node): ?Node
209209
continue;
210210
}
211211

212-
if ($property->type instanceof Node
213-
&& $param->type instanceof Node
214-
&& $property->hooks !== []
215-
&& ! $this->nodeComparator->areNodesEqual($property->type, $param->type)) {
212+
if ($this->shouldSkipPropertyOrParam($property, $param)) {
216213
continue;
217214
}
218215

@@ -367,4 +364,12 @@ private function isCallableTypeIdentifier(?Node $node): bool
367364
{
368365
return $node instanceof Identifier && $this->isName($node, 'callable');
369366
}
367+
368+
private function shouldSkipPropertyOrParam(Property $property, Param $param): bool
369+
{
370+
return $property->type instanceof Node
371+
&& $param->type instanceof Node
372+
&& $property->hooks !== []
373+
&& ! $this->nodeComparator->areNodesEqual($property->type, $param->type);
374+
}
370375
}

0 commit comments

Comments
 (0)