Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia committed Oct 11, 2023
1 parent 13ab90f commit 413b74b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/Rules/BannedNodesRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class BannedNodesRule implements Rule
{
/**
* @var array<mixed>
* @var array<string, mixed>
*/
private $bannedNodes;

Expand All @@ -36,7 +36,7 @@ class BannedNodesRule implements Rule
private $bannedFunctions;

/**
* @param array<array<string, string|string[]>> $bannedNodes
* @param array<array{type: string, functions?: array<string>}> $bannedNodes
*/
public function __construct(array $bannedNodes)
{
Expand Down Expand Up @@ -85,20 +85,16 @@ public function processNode(Node $node, Scope $scope): array
*
* php-parser makes the same normalization.
*
* @param array<array<string, string[]>> $bannedNodes
* @param array<string, mixed> $bannedNodes
* @return array<string>
*/
protected function normalizeFunctionNames(array $bannedNodes): array
{
if(! isset($bannedNodes['Expr_FuncCall']['functions'])) {
return [];
}

return array_map(
static function (string $function): string {
return ltrim($function, '\\');
},
$bannedNodes['Expr_FuncCall']['functions']
$bannedNodes['Expr_FuncCall']['functions'] ?? []
);
}
}

0 comments on commit 413b74b

Please sign in to comment.