public function leaveNode(Node $node) { if ($node->getType() === 'Expr_MethodCall') { $called = $node->name; if (!$this->hasMethod($called)) { $this->nestedCall--; } } parent::leaveNode($node); }
public function leaveNode(Node $node) { if ($node->getType() === 'Stmt_ClassMethod') { // filters param without type-hint $filtered = []; foreach ($node->params as $param) { if (is_null($param->type)) { $filtered[$param->name] = true; } } // intersect with variable called with method $result = array_intersect_key($this->objectName, $filtered); foreach ($result as $key => $calling) { $this->pushViolation($calling, "Method is called on parameter \${$key} without type-hint"); } $this->objectName = []; } parent::leaveNode($node); }