public function leaveNode($node) { /** * {Description} * These words have special meaning in PHP. Some of them represent * things which look like functions, some look like constants, and so * on - but they're not, really: they are language constructs. You * cannot use any of the following words as constants, class names, * function or method names. Using them as variable names is generally * OK, but could lead to confusion. * * {Reference} * http://php.net/manual/en/reserved.keywords.php */ $name = null; if ($node instanceof Stmt\ClassLike || $node instanceof Stmt\Function_ || $node instanceof Stmt\ClassMethod || $node instanceof Expr\MethodCall || $node instanceof Expr\StaticCall || $node instanceof Expr\ConstFetch || $node instanceof Expr\FuncCall && !ParserHelper::isDynamicCall($node)) { $name = $node->migName; } if (!is_null($name) && $this->wordTable->has($name)) { $this->addSpot('FATAL', true, 'Keyword "' . $name . '" is reserved'); } }
protected function populateCall($node, $type) { if (ParserHelper::isDynamicCall($node)) { return; } $posbit = $this->positionByValue($node); if (!$posbit) { return; } if ($type == 'func') { $callname = $node->name; } elseif ($type == 'static') { $class = $node->class->toString(); if ($class == 'self' && $this->visitor->inClass()) { $class = $this->visitor->getClassName(); } $callname = $class . '::' . $node->name; } elseif ($type == 'method') { if ($node->var instanceof Expr\Variable && $node->var->name == 'this' && $this->visitor->inClass()) { $oname = $this->visitor->getClassName(); } else { $oname = ''; } $callname = $oname . '->' . $node->name; } $this->callList[] = ['name' => $callname, 'pos' => $posbit, 'file' => $this->visitor->getFile(), 'line' => $node->getLine()]; }