Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Rector\Tests\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector\Fixture;

class SkipNotMatchPropertyHookType {
protected \stdClass $origin {
set(array|\stdClass $origin) {
$this->origin = is_array($origin) ? (object) $origin : clone $origin;
}
}

public function __construct(
array|\stdClass $origin
) {
$this->origin = $origin;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ public function refactor(Node $node): ?Node
continue;
}

if ($property->type instanceof Node
&& $param->type instanceof Node
&& $property->hooks !== []
&& ! $this->nodeComparator->areNodesEqual($property->type, $param->type)) {
continue;
}

$hasChanged = true;

// remove property from class
Expand Down
Loading