Skip to content

Commit

Permalink
[Performance] [DeadCode] Early check no params in __construct() on Re…
Browse files Browse the repository at this point in the history
…moveUnusedPromotedPropertyRector (#5672)

* [Performance] [DeadCode] Early check no params in __construct() on RemoveUnusedPromotedPropertyRector

* fixture
  • Loading branch information
samsonasik committed Feb 28, 2024
1 parent c57c164 commit 827992a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
@@ -0,0 +1,13 @@
<?php

namespace Rector\Tests\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector\Fixture;

class SkipNoParams
{
public function __construct()
{
echo 'some stmt';
}
}

?>
Expand Up @@ -95,6 +95,10 @@ public function refactorWithScope(Node $node, Scope $scope): ?Node
return null;
}

if ($constructClassMethod->params === []) {
return null;
}

if ($this->shouldSkipClass($node)) {
return null;
}
Expand Down

0 comments on commit 827992a

Please sign in to comment.