/** * @param Node $node * A node to parse * * @return Context * A new or an unchanged context resulting from * parsing the node */ public function visitMethodCall(Node $node) : Context { $method_name = $node->children['method']; if (!is_string($method_name)) { return $this->context; } try { $method = (new ContextNode($this->code_base, $this->context, $node))->getMethod($method_name, false); } catch (IssueException $exception) { $exception->getIssueInstance()(); return $this->context; } catch (NodeException $exception) { // If we can't figure out the class for this method // call, cry YOLO and mark every method with that // name with a reference. if (Config::get()->dead_code_detection) { foreach ($this->code_base->getMethodListByName($method_name) as $method) { $method->addReference($this->context); } } // Swallow it return $this->context; } // Check the call for paraemter and argument types $this->analyzeCallToMethod($this->code_base, $method, $node); return $this->context; }