Failed Conditions
Push — mixed-collections ( 23b545 )
by Michael
03:24
created

Collection   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 5
dl 0
loc 27
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getIterator() 0 3 1
A count() 0 3 1
A __construct() 0 3 1
A dispatch() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Annotations\Parser\Ast\Collection;
6
7
use Countable;
8
use Doctrine\Annotations\Parser\Ast\ValuableNode;
9
use Doctrine\Annotations\Parser\Ast\Value;
10
use Doctrine\Annotations\Parser\Visitor\Visitor;
11
use IteratorAggregate;
12
use function count;
13
14
final class Collection implements Value, IteratorAggregate, Countable
15
{
16
17
    /** @var ValuableNode[] */
18
    private $items;
19
20
    public function __construct(Entry ...$items)
21
    {
22
        $this->items = $items;
23
    }
24
25
    /**
26
     * @return Collection[]
27
     */
28
    public function getIterator() : iterable
29
    {
30
        yield from $this->items;
0 ignored issues
show
Bug Best Practice introduced by
The expression YieldFromNode returns the type Generator which is incompatible with the documented return type Doctrine\Annotations\Par...Collection\Collection[].
Loading history...
31
    }
32
33
    public function count() : int
34
    {
35
        return count($this->items);
36
    }
37
38
    public function dispatch(Visitor $visitor) : void
39
    {
40
        $visitor->visitCollection($this);
41
    }
42
}
43