Completed
Push — master ( e0017c...6b1304 )
by Tom
14s queued 11s
created

DoctrineModule/Paginator/Adapter/Collection.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineModule\Paginator\Adapter;
6
7
use Doctrine\Common\Collections\Collection as DoctrineCollection;
8
use Laminas\Paginator\Adapter\AdapterInterface;
9
use function array_values;
10
use function count;
11
12
class Collection implements AdapterInterface
13
{
14
    /** @var Doctrine\Common\Collections\Collection */
15
    protected $collection;
16
17
    /**
18
     * @param mixed[] $collection
19
     */
20 4
    public function __construct(DoctrineCollection $collection)
21
    {
22 4
        $this->collection = $collection;
0 ignored issues
show
Documentation Bug introduced by
It seems like $collection of type object<Doctrine\Common\Collections\Collection> is incompatible with the declared type object<DoctrineModule\Pa...Collections\Collection> of property $collection.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
23 4
    }
24
25
    /**
26
     * {@inheritDoc}
27
     */
28 3
    public function getItems($offset, $itemCountPerPage)
29
    {
30 3
        return array_values($this->collection->slice($offset, $itemCountPerPage));
31
    }
32
33
    /**
34
     * {@inheritDoc}
35
     */
36 1
    public function count()
37
    {
38 1
        return count($this->collection);
39
    }
40
}
41