Passed
Push — master ( 6654ff...6f7f1a )
by Tomáš
12:08
created

BaseListCollection::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Inspirum\Arrayable;
6
7
use Inspirum\Arrayable\Arrayable as TValue;
8
use function array_values;
9
10
/**
11
 * @template TItemKey of array-key
12
 * @template TItemValue
13
 * @template TValue of \Inspirum\Arrayable\Arrayable<TItemKey,TItemValue>
14
 * @extends  \Inspirum\Arrayable\BaseCollection<TItemKey,TItemValue,int,TValue>
15
 */
16
abstract class BaseListCollection extends BaseCollection
17
{
18
    /**
19
     * @param list<TValue> $items
20
     */
21
    public function __construct(array $items = [])
22
    {
23
        parent::__construct($items);
24
    }
25
26
    /**
27
     * @return list<TValue>
28
     */
29
    public function getItems(): array
30
    {
31
        return array_values(parent::getItems());
0 ignored issues
show
Bug Best Practice introduced by
The expression return array_values(parent::getItems()) returns the type array which is incompatible with the documented return type Inspirum\Arrayable\list.
Loading history...
32
    }
33
34
    /**
35
     * @return list<array<TItemKey,TItemValue>>
36
     */
37
    public function __toArray(): array
38
    {
39
        return array_values(parent::__toArray());
0 ignored issues
show
Bug Best Practice introduced by
The expression return array_values(parent::__toArray()) returns the type array which is incompatible with the documented return type Inspirum\Arrayable\list.
Loading history...
40
    }
41
42
    /**
43
     * @return list<array<TItemKey,TItemValue>>
44
     */
45
    public function toArray(): array
46
    {
47
        return array_values(parent::toArray());
0 ignored issues
show
Bug Best Practice introduced by
The expression return array_values(parent::toArray()) returns the type array which is incompatible with the documented return type Inspirum\Arrayable\list.
Loading history...
48
    }
49
50
    /**
51
     * @return list<array<TItemKey,TItemValue>>
52
     */
53
    public function jsonSerialize(): array
54
    {
55
        return array_values(parent::jsonSerialize());
0 ignored issues
show
Bug Best Practice introduced by
The expression return array_values(parent::jsonSerialize()) returns the type array which is incompatible with the documented return type Inspirum\Arrayable\list.
Loading history...
56
    }
57
}
58