Skip to content

Commit

Permalink
Change early returns
Browse files Browse the repository at this point in the history
  • Loading branch information
parijke committed Feb 13, 2024
1 parent 88636c4 commit d75beff
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Surfnet/NoDebugFunctionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ public function processNode(Node $node, Scope $scope): array
return [];
}

if ($node->name instanceof Node\Name) {
$functionName = $node->name->toString();
if (in_array($functionName, ['dd', 'dump', 'var_dump', 'print_r', 'exit', 'die'])) {
return ["Do not use {$functionName} function"];
}
if (!$node->name instanceof Node\Name) {
return [];
}

$functionName = $node->name->toString();
if (in_array($functionName, ['dd', 'dump', 'var_dump', 'print_r', 'exit', 'die'])) {
return ["Do not use {$functionName} function"];
}

return [];
Expand Down

0 comments on commit d75beff

Please sign in to comment.