PHPSA\Analyzer\Pass\Expression\NestedTernary::pass PHP Method

pass() public method

public pass ( PhpParser\Node\Expr\Ternary $expr, Context $context ) : boolean
$expr PhpParser\Node\Expr\Ternary
$context PHPSA\Context
return boolean
    public function pass(Expr\Ternary $expr, Context $context)
    {
        if ($expr->if instanceof Expr\Ternary || $expr->else instanceof Expr\Ternary) {
            $context->notice('nested_ternary', 'Nested ternaries are confusing you should use if instead.', $expr);
            return true;
        }
        return false;
    }
NestedTernary