Skip to content

Commit

Permalink
Re-print on constructor promotion (#3051)
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Nov 11, 2022
1 parent 21b1ff9 commit a8fd5aa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Rector\Tests\Php80\Rector\FunctionLike\MixedTypeRector\Fixture;

final class OnConstructorPromotion
{
/** @param mixed $foo*/
public function __construct(public $foo): void
{
}
}

?>
-----
<?php

namespace Rector\Tests\Php80\Rector\FunctionLike\MixedTypeRector\Fixture;

final class OnConstructorPromotion
{
public function __construct(public mixed $foo): void
{
}
}

?>
3 changes: 3 additions & 0 deletions rules/Php80/Rector/FunctionLike/MixedTypeRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ private function refactorParamTypes(

$this->hasChanged = true;
$param->type = new Identifier('mixed');
if ($param->flags !== 0) {
$param->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::ORIGINAL_NODE, null);
}
}
}
}

0 comments on commit a8fd5aa

Please sign in to comment.