コード例 #1
0
 public function leaveNode(Node $node)
 {
     if ($node->getType() === 'Expr_MethodCall') {
         $called = $node->name;
         if (!$this->hasMethod($called)) {
             $this->nestedCall--;
         }
     }
     parent::leaveNode($node);
 }
コード例 #2
0
 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);
 }