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

BaseListCollection   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 40
ccs 0
cts 10
cp 0
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getItems() 0 3 1
A jsonSerialize() 0 3 1
A __construct() 0 3 1
A __toArray() 0 3 1
A toArray() 0 3 1
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