public hasVariableType ( string $variableName ) : boolean | ||
$variableName | string | |
Результат | boolean |
/** * @param \PhpParser\Node\Expr\ClosureUse $node * @param \PHPStan\Analyser\Scope $scope * @return string[] */ public function processNode(Node $node, Scope $scope) : array { if ($node->byRef) { return []; } if (!$scope->hasVariableType($node->var)) { return [sprintf('Undefined variable: $%s', $node->var)]; } return []; }
/** * @param \PhpParser\Node\Expr\Variable $node * @param \PHPStan\Analyser\Scope $scope * @return string[] */ public function processNode(Node $node, Scope $scope) : array { if (!is_string($node->name)) { return []; } if (in_array($node->name, ['GLOBALS', '_SERVER', '_GET', '_POST', '_FILES', '_COOKIE', '_SESSION', '_REQUEST', '_ENV'], true)) { return []; } if ($scope->isInVariableAssign($node->name)) { return []; } if (!$scope->hasVariableType($node->name)) { return [sprintf('Undefined variable: $%s', $node->name)]; } return []; }