Sstalle\php7cc\NodeVisitor\BitwiseShiftVisitor::enterNode PHP Method

enterNode() public method

public enterNode ( PhpParser\Node $node )
$node PhpParser\Node
    public function enterNode(Node $node)
    {
        $isLeftShift = $node instanceof Node\Expr\BinaryOp\ShiftLeft;
        $isRightShift = $node instanceof Node\Expr\BinaryOp\ShiftRight;
        if (!$isLeftShift && !$isRightShift) {
            return;
        }
        $rightOperand = $node->right;
        if ($rightOperand instanceof Node\Expr\UnaryMinus && $rightOperand->expr instanceof Node\Scalar\LNumber && $rightOperand->expr->value > 0) {
            $this->addContextMessage('Bitwise shift by a negative number', $node);
        } elseif ($rightOperand instanceof Node\Scalar\LNumber && $rightOperand->value >= $this->intSize) {
            $this->addContextMessage(sprintf('Bitwise shift by %d bits', $rightOperand->value), $node);
        }
    }
BitwiseShiftVisitor