isInVariableAssign() 공개 메소드

public isInVariableAssign ( string $variableName ) : boolean
$variableName string
리턴 boolean
예제 #1
0
 /**
  * @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 [];
 }