Inheritance: extends AbstractVisitor
コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function enterNode(Node $node)
 {
     parent::enterNode($node);
     if (($node instanceof Node\Stmt\Break_ || $node instanceof Node\Stmt\Continue_) && $this->getCurrentLoopStack()->isEmpty()) {
         $messageText = sprintf('%s not in the loop or switch context', $node instanceof Node\Stmt\Break_ ? 'break' : 'continue');
         $this->addContextMessage($messageText, $node);
     }
 }
コード例 #2
0
ファイル: ForeachVisitor.php プロジェクト: sstalle/php7cc
 /**
  * {@inheritdoc}
  */
 public function enterNode(Node $node)
 {
     parent::enterNode($node);
     if ($this->isTargetLoopNode($node)) {
         $this->checkNestedByReferenceForeach($node);
     } elseif (!$this->getCurrentLoopStack()->isEmpty()) {
         $this->checkInternalArrayPointerAccessInByValueForeach($node);
         $this->checkArrayModificationByFunctionInByReferenceForeach($node);
         $this->checkAddingToArrayInByReferenceForeach($node);
     }
 }