Passed
Push — master ( 9787f7...8354ea )
by Tomáš
02:37
created

Binary::visit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 3
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types = 1);
2
3
namespace Apicart\FQL\Tests\Integration\Generator\SQL\Visitor;
4
5
use Apicart\FQL\Generator\Common\AbstractVisitor;
6
use Apicart\FQL\Token\Node\LogicalAnd;
7
use Apicart\FQL\Token\Node\LogicalOr;
8
use Apicart\FQL\Value\AbstractNode;
9
10
final class Binary extends AbstractVisitor
11
{
12
13
	public function accept(AbstractNode $node): bool
14
	{
15
		return $node instanceof LogicalAnd || $node instanceof LogicalOr;
16
	}
17
18
19
	public function visit(AbstractNode $node, ?AbstractVisitor $subVisitor = null, ?array $options = null): string
20
	{
21
		/** @var LogicalAnd|LogicalOr $logicalNode */
22
		$logicalNode = $node;
23
		$clauses = [
24
			$subVisitor->visit($logicalNode->getLeftOperand(), $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

24
			$subVisitor->/** @scrutinizer ignore-call */ 
25
                visit($logicalNode->getLeftOperand(), $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...
25
			$subVisitor->visit($logicalNode->getRightOperand(), $subVisitor, $options),
26
		];
27
28
		return implode(" {$logicalNode->getToken()->getLexeme()} ", $clauses);
29
	}
30
31
}
32