Passed
Push — master ( 44542b...077e9d )
by Tomáš
03:58
created

UnaryOperator::visit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types = 1);
2
3
namespace Apicart\FQL\Generator\SQL;
4
5
use Apicart\FQL\Generator\Common\AbstractVisitor;
6
use Apicart\FQL\Token\Node\LogicalNot;
7
use Apicart\FQL\Value\AbstractNode;
8
9
class UnaryOperator extends AbstractVisitor
10
{
11
12 1
    public function accept(AbstractNode $node): bool
13
    {
14 1
        return $node instanceof LogicalNot;
15
    }
16
17
18 1
    public function visit(AbstractNode $node, ?AbstractVisitor $subVisitor = null, ?array $options = null): string
19
    {
20
        /** @var LogicalNot $logicalNotNode */
21 1
        $logicalNotNode = $node;
22
23 1
        return 'NOT (' . $subVisitor->visit($logicalNotNode->getOperand(), $subVisitor, $options) . ')';
0 ignored issues
show
Bug introduced by
The method visit() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
        return 'NOT (' . $subVisitor->/** @scrutinizer ignore-call */ visit($logicalNotNode->getOperand(), $subVisitor, $options) . ')';

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
24
    }
25
26
}
27