Handles custom error messages to not be overwrite by function with multiple args.
@param StaticCall|MethodCall $node
964062
private function moveFunctionArgumentsUp(Node $node): void
    {
        /** @var FuncCall $secondArgument */
        $secondArgument = $node->args[1]->value;
        $node->args[1] = $secondArgument->args[0];
    }
343238
protected function handleControlStructure($node) {
    $this->handleParens($node);
    $colons = $node->children(Filter::isTokenType(':'));
    foreach ($colons as $colon) {
      $this->removeSpaceBefore($colon);
    }
    if ($colons->isNotEmpty()) {
      $this->newlineBefore($node->lastChild()->previous());
    }
  }
670503
public function callErrorTrait($message, int $code, ?Exception $previous, $thrower): void
    {
        $message = $this->createMessage($message, $code);
        /** @noinspection PhpUndefinedMethodInspection */
        /** @noinspection PhpUndefinedClassInspection */
        parent::__construct($message, $code, $previous);
        $this->truncateTrace($thrower);
    }
1085228
protected function isStaticMethodCall(AbstractNode $methodCall): bool
    {
        return $methodCall->getChild(0)->getNode() instanceof ASTClassOrInterfaceReference &&
            $methodCall->getChild(1)->getNode() instanceof ASTMethodPostfix &&
            !$this->isCallingParent($methodCall) &&
            !$this->isCallingSelf($methodCall);
    }
107426
public function callError() {
        if (!($this->error instanceof Error)) {
            $this->error = new Error();
        }

        $status = $this->error->getStatus();
        $this->app->response->status($status);

        if (is_callable($this->options["error"])) {
            $this->options["error"]($this->error);
        }
    }
552701
public function enterNode(Node $node)
    {
        if ($node instanceof Class_) {
            if ($node->extends) {
                $extends = (string) $node->extends;
                if ($this->isFinalClass($extends)) {
                    $msg = \sprintf('Class %s may not inherit from final class (%s)', $node->name, $extends);
                    throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
                }
            }

            if ($node->isFinal()) {
                $this->finalClasses[\strtolower($node->name)] = true;
            }
        }
    }
1042148
public function apply(AbstractNode $node)
    {
        if (!$this->isFacade($node)) {
            return;
        }

        $this->applyStatelessThereAreNoProperties($node);

        foreach ($node->getMethods() as $method) {
            $this->applyNoInstantiationsWithNew($method);
        }
    }
380234
public function leaveNode(Node $node)
    {
        if ($node instanceof ClassMethod && $node->name === $this->nodeName) {
            // Build arguments.
            $args = [];
            foreach ($this->args as $arg) {
                $args[] = new Arg(
                    is_string($arg)
                        ? new String_($arg)
                        : (is_float($arg)
                            ? new DNumber($arg)
                            : new LNumber($arg)
                        ) 
                );
            }
            // ADD comment
            $nop = new Nop;
            $nop->setAttribute('comments', [
                new Comment(sprintf('// Ayuco: addition %s', date('Y-m-d h:i a')))
            ]);
            $node->stmts[] = $nop;
            // ADD statement
            $node->stmts[] = new MethodCall(
                empty($this->variable) ? null : new Variable($this->variable),
                $this->methodName,
                $args
            );
        }
    }
35977
protected void addViolation(MethodCallExpression node, String message) {
        if (node.getLineNumber() >= 0) {
            int lineNumber = AstUtil.findFirstNonAnnotationLine(node, sourceCode);
            String sourceLine = sourceCode.line(AstUtil.findFirstNonAnnotationLine(node, sourceCode) - 1);
            Violation violation = new Violation();
            violation.setRule(rule);
            violation.setLineNumber(lineNumber);
            violation.setSourceLine(sourceLine);
            if (currentClassNode != null) {
                violation.setMessage(String.format(
                        "Violation in class %s. %s", currentClassNode.getName(), message
                ));
            } else {
                violation.setMessage(message);
            }
            violations.add(violation);
        }
    }
601043
public function apply(AbstractNode $node)
    {
        if (preg_match('#^SprykerShop\\\\Client\\\\#', $node->getFullQualifiedName()) === 0) {
            return;
        }

        if ($this->isClassDeprecated($node)) {
            return;
        }

        $this->addViolation(
            $node,
            [
                sprintf(
                    'The %s class is in Client layer which violates rule "' . static::RULE . '"',
                    $node->getFullQualifiedName()
                ),
            ]
        );
    }
27995
public function enterNode(Node $node)
    {
        if ($node instanceof Class_ || $node instanceof Trait_) {
            $this->inClass = true;
        } elseif ($node instanceof FuncCall && !$this->inClass) {
            // We'll give any args at all (besides null) a pass.
            // Technically we should be checking whether the args are objects, but this will do for now.
            //
            // @todo switch this to actually validate args when we get context-aware code cleaner passes.
            if (!empty($node->args) && !$this->isNull($node->args[0])) {
                return;
            }

            // We'll ignore name expressions as well (things like `$foo()`)
            if (!($node->name instanceof Name)) {
                return;
            }

            $name = \strtolower($node->name);
            if (\in_array($name, ['get_class', 'get_called_class'])) {
                $msg = \sprintf('%s() called without object from outside a class', $name);
                throw new ErrorException($msg, 0, E_USER_WARNING, null, $node->getLine());
            }
        }
    }
568782
public function pExpr_MethodCall(Expr\MethodCall $node)
    {
        return sprintf(
            '%s%s%s%s%s%s',
            $this->pDereferenceLhs($node->var),
            $this->color('->', SyntaxHighlighterConfig::TYPE_VAR_DEREF),
            $this->pObjectProperty($node->name),
            $this->color('(', SyntaxHighlighterConfig::TYPE_CALL_PARENTHESIS),
            $this->pCommaSeparated($node->args),
            $this->color(')', SyntaxHighlighterConfig::TYPE_CALL_PARENTHESIS)
        );
    }
11191
protected function _handleDirectCall($methodCalled) {
        // this doesn't actually do anything because _real_toHtml() won't be
        // called in this request context (unless the flash message isn't
        // actually supposed to be ajax/esi'd in)
        $this->_directCall = $methodCalled;
        if ($this->_fixMessages()) {
            $layout = $this->getLayout();
            $layoutUpdate = $layout->getUpdate()->load('default');
            if (Mage::app()->useCache('layout')) {
                // this is skipped in the layout update load() if the "layout"
                // cache is enabled, which seems to cause the esi layout stuff
                // to not load, so we manually do it here
                foreach ($layoutUpdate->getHandles() as $handle) {
                    $layoutUpdate->merge($handle);
                }
            }
            $layout->generateXml();
            $layoutShim = Mage::getSingleton('turpentine/shim_mage_core_layout');
            foreach ($layout->getNode()->xpath(
                    sprintf('//reference[@name=\'%s\']/action',
                        $this->getNameInLayout()) ) as $node) {
                $layoutShim->shim_generateAction($node);
            }
        }
        return $this;
    }
1352984
public function invoke($node, NodeInterface $parent): void
    {
        if (! $node instanceof Node\Stmt\Function_ || ! $parent instanceof PhpFileModelInterface) {
            throw new Exception('FunctionNodeParser is made to parse a function node');
        }

        $function = new FunctionModel();
        $function->setParentNode($parent);
        $function->setName($node->name);
        $function->setIsGlobal(true);

        $this->parseFunction($node, $function);

        if (($documentation = $node->getDocComment()) !== null) {
            $this->documentationNodeParser->invoke($documentation, $function);
        }

        $parent->addFunction($function);
    }
1041731
private function hasCorrectPrefix(MethodNode $node)
    {
        foreach ($this->allowedPrefixes as $prefix) {
            if ($prefix === substr($node->getImage(), 0, strlen($prefix))) {
                return true;
            }
        }

        return false;
    }
239533
public function leaveNode(Node $node)
    {
        if (self::isConditional($node)) {
            $this->conditionalScopes--;
        } elseif ($node instanceof FuncCall) {
            // if function name is an expression or a variable, give it a pass for now.
            $name = $node->name;
            if (!$name instanceof Expr && !$name instanceof Variable) {
                $shortName = \implode('\\', $name->parts);
                $fullName  = $this->getFullyQualifiedName($name);
                $inScope   = isset($this->currentScope[\strtolower($fullName)]);
                if (!$inScope && !\function_exists($shortName) && !\function_exists($fullName)) {
                    $message = \sprintf('Call to undefined function %s()', $name);
                    throw new FatalErrorException($message, 0, E_ERROR, null, $node->getLine());
                }
            }
        }
    }
295897
public static function error(callable $callback = null){
        $callback
          ? is_callable($callback) && static::$error = $callback
          : static::$error && call_user_func(static::$error);
    }