File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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) {}
2424CODE_SAMPLE
2525,
2626 <<<'CODE_SAMPLE'
27- try {
28- rmdir($dirname);
29- } catch (Exception $e) {}
27+ try {
28+ rmdir($dirname);
29+ } catch (Exception $e) {}
3030CODE_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 ;
You can’t perform that action at this time.
0 commit comments