Skip to content

Commit 4c860dc

Browse files
committed
apply code review
1 parent be8b803 commit 4c860dc

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

utils/Rector/RemoveErrorSuppressInTryCatchStmtsRector.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ final class RemoveErrorSuppressInTryCatchStmtsRector extends AbstractRector
1515
{
1616
public function getRuleDefinition(): RuleDefinition
1717
{
18-
return new RuleDefinition('Remove error suppress @', [
18+
return new RuleDefinition('Remove error suppression operator `@` inside try...catch blocks', [
1919
new CodeSample(
2020
<<<'CODE_SAMPLE'
21-
try {
22-
@rmdir($dirname);
23-
} catch (Exception $e) {}
21+
try {
22+
@rmdir($dirname);
23+
} catch (Exception $e) {}
2424
CODE_SAMPLE
2525
,
2626
<<<'CODE_SAMPLE'
27-
try {
28-
rmdir($dirname);
29-
} catch (Exception $e) {}
27+
try {
28+
rmdir($dirname);
29+
} catch (Exception $e) {}
3030
CODE_SAMPLE
3131
),
3232
]);
@@ -52,11 +52,11 @@ public function refactor(Node $node): ?Node
5252
return null;
5353
}
5454

55-
// not in stmts, means it in catch or finally
56-
$inStmts = (bool) $this->betterNodeFinder->findFirst((array) $tryCatch->stmts, function (Node $n) use ($node) : bool {
55+
$inStmts = (bool) $this->betterNodeFinder->findFirst((array) $tryCatch->stmts, static function (Node $n) use ($node) : bool {
5756
return $n === $node;
5857
});
5958

59+
// not in stmts, means it in catch or finally
6060
if (! $inStmts)
6161
{
6262
return null;

0 commit comments

Comments
 (0)