nonSimplifiableProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace PPP\Module\TreeSimplifier;
4
5
use PPP\DataModel\FirstNode;
6
use PPP\DataModel\IntersectionNode;
7
use PPP\DataModel\ResourceListNode;
8
use PPP\DataModel\StringResourceNode;
9
use PPP\DataModel\UnionNode;
10
11
/**
12
 * @covers PPP\Module\TreeSimplifier\RecursiveOperatorNodeSimplifier
13
 *
14
 * @licence MIT
15
 * @author Thomas Pellissier Tanon
16
 */
17
class RecursiveOperatorNodeSimplifierTest extends NodeSimplifierBaseTest {
18
19
	protected function buildSimplifier() {
20
		return new RecursiveOperatorNodeSimplifier(new NodeSimplifierFactory());
21
	}
22
23
	public function simplifiableProvider() {
24
		return array(
25
			array(
26
				new UnionNode(array())
27
			),
28
			array(
29
				new IntersectionNode(array())
30
			)
31
		);
32
	}
33
34
	public function nonSimplifiableProvider() {
35
		return array(
36
			array(
37
				new FirstNode(array())
0 ignored issues
show
Documentation introduced by
array() is of type array, but the function expects a object<PPP\DataModel\AbstractNode>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
38
			)
39
		);
40
	}
41
42
	public function simplificationProvider() {
43
		return array(
44
			array(
45
				new UnionNode(array(
46
					new ResourceListNode(array(new StringResourceNode('foo')))
47
				)),
48
				new UnionNode(array(
49
					new FirstNode(new ResourceListNode(array(new StringResourceNode('foo'))))
50
				))
51
			),
52
			array(
53
				new IntersectionNode(array(
54
					new ResourceListNode(array(new StringResourceNode('foo')))
55
				)),
56
				new IntersectionNode(array(
57
					new FirstNode(new ResourceListNode(array(new StringResourceNode('foo'))))
58
				))
59
			)
60
		);
61
	}
62
}
63