Passed
Push — master ( f4b885...602f00 )
by stéphane
02:42
created

NodeList::__debugInfo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Dallgoot\Yaml;
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
4
use Dallgoot\Yaml\Yaml as Y;
5
6
/**
7
 * TODO
8
 * @author [email protected]
0 ignored issues
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
9
 * @license Apache 2.0
10
 * @link TODO : url to specific online doc
11
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
12
class NodeList extends \SplDoublyLinkedList
13
{
14
    /* @var null|int */
15
    public $type = null;
16
17
    /**
18
     * NodeList constructor
19
     */
20
    public function __construct()
21
    {
22
        $this->setIteratorMode(NodeList::IT_MODE_KEEP);
23
    }
24
25
    /**
26
     * Gets the types of the elements in this NodeList
27
     *
28
     * @return integer  The &-sum of all the types.
29
     */
30
    public function getTypes():int
31
    {
32
        $types = 0;
33
        foreach ($this as $child) {
34
            $types &= $child->type;
35
        }
36
        return $types;
37
    }
38
39
    public function __debugInfo()
0 ignored issues
show
Coding Style introduced by
Missing function doc comment
Loading history...
40
    {
41
        return ['type'=> Y::getName($this->type), 'dllist'=> $this->dllist];
0 ignored issues
show
Bug introduced by
It seems like $this->type can also be of type null; however, parameter $typeInteger of Dallgoot\Yaml\Yaml::getName() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

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

41
        return ['type'=> Y::getName(/** @scrutinizer ignore-type */ $this->type), 'dllist'=> $this->dllist];
Loading history...
Bug Best Practice introduced by
The property dllist does not exist on Dallgoot\Yaml\NodeList. Did you maybe forget to declare it?
Loading history...
42
    }
43
}
44