1 | <?php |
||
34 | abstract class AbstractRepository implements RepositoryInterface |
||
35 | { |
||
36 | /** |
||
37 | * @var FactoryInterface |
||
38 | */ |
||
39 | private $factory = null; |
||
40 | |||
41 | /** @var ComparatorInterface */ |
||
42 | private $comparator = null; |
||
43 | |||
44 | /** |
||
45 | * AbstractRepository constructor |
||
46 | * |
||
47 | * @param FactoryInterface $factory |
||
|
|||
48 | * @param ComparatorInterface $comparator |
||
49 | */ |
||
50 | 11 | public function __construct(FactoryInterface $factory = null, ComparatorInterface $comparator = null) |
|
62 | |||
63 | /** |
||
64 | * @return ComparatorInterface |
||
65 | */ |
||
66 | 5 | final private function getComparator() |
|
70 | |||
71 | /** |
||
72 | * Returns the migration factory. Creates a new SimpleFactory object for it if none was configured. |
||
73 | * |
||
74 | * @return FactoryInterface |
||
75 | */ |
||
76 | 10 | final protected function getMigrationFactory() |
|
80 | |||
81 | /** |
||
82 | * @inheritdoc |
||
83 | */ |
||
84 | 7 | final public function fetchAll() |
|
85 | { |
||
86 | 7 | $collection = $this->doFetchAll(); |
|
87 | 7 | if (!$collection instanceof Linked) { |
|
88 | RepositoryException::throwInvalidObjectException($collection, Linked::class); |
||
89 | } |
||
90 | |||
91 | return $collection->sort($this->getComparator()); |
||
92 | } |
||
93 | |||
94 | /** |
||
95 | * Must fetch all versions available to the repository, load them with their migrations, and return them as a |
||
96 | * Linked collection. It must use a factory (default or supplied by 'setMigrationFactory()') to instantiate |
||
97 | * each of the migrations. |
||
98 | * |
||
99 | * @return Linked |
||
100 | */ |
||
101 | abstract protected function doFetchAll(); |
||
102 | } |
||
103 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.