Skip to content

Commit 1698c7f

Browse files
Use isConstructor and hasConstructor functions
1 parent dfe1a00 commit 1698c7f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Rules/Classes/UnusedConstructorParametersRule.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use function array_values;
1717
use function count;
1818
use function sprintf;
19-
use function strtolower;
2019

2120
/**
2221
* @implements Rule<InClassMethodNode>
@@ -37,7 +36,7 @@ public function processNode(Node $node, Scope $scope): array
3736
{
3837
$method = $node->getMethodReflection();
3938
$originalNode = $node->getOriginalNode();
40-
if (strtolower($method->getName()) !== '__construct' || $originalNode->stmts === null) {
39+
if (!$method->isConstructor() || $originalNode->stmts === null) {
4140
return [];
4241
}
4342

@@ -49,7 +48,7 @@ public function processNode(Node $node, Scope $scope): array
4948
}
5049

5150
foreach ($node->getClassReflection()->getInterfaces() as $interface) {
52-
if ($interface->hasMethod('__construct')) {
51+
if ($interface->hasConstructor()) {
5352
return [];
5453
}
5554
}

0 commit comments

Comments
 (0)