assigning incompatible types to properties.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Hateoas\Configuration; |
||
4 | |||
5 | use Hateoas\Configuration\Provider\RelationProviderInterface as RelationProviderProviderInterface; |
||
6 | use Metadata\MetadataFactoryInterface; |
||
7 | |||
8 | /** |
||
9 | * @author Adrien Brault <[email protected]> |
||
10 | */ |
||
11 | class RelationsRepository |
||
12 | { |
||
13 | /** |
||
14 | * @var MetadataFactoryInterface |
||
15 | */ |
||
16 | private $metadataFactory; |
||
17 | |||
18 | /** |
||
19 | * @var RelationProviderProvider |
||
20 | */ |
||
21 | private $relationProvider; |
||
22 | |||
23 | /** |
||
24 | * @param MetadataFactoryInterface $metadataFactory |
||
25 | * @param RelationProviderProviderInterface $relationProvider |
||
26 | */ |
||
27 | public function __construct(MetadataFactoryInterface $metadataFactory, RelationProviderProviderInterface $relationProvider) |
||
28 | { |
||
29 | $this->metadataFactory = $metadataFactory; |
||
30 | $this->relationProvider = $relationProvider; |
||
0 ignored issues
–
show
|
|||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param object $object |
||
35 | * |
||
36 | * @return Relation[] |
||
37 | */ |
||
38 | public function getRelations($object) |
||
39 | { |
||
40 | $relations = array(); |
||
41 | |||
42 | if (null !== $classMetadata = $this->metadataFactory->getMetadataForClass(get_class($object))) { |
||
43 | $relations = array_merge($relations, $classMetadata->getRelations()); |
||
44 | } |
||
45 | |||
46 | $relations = array_merge($relations, $this->relationProvider->getRelations($object)); |
||
47 | |||
48 | return $relations; |
||
49 | } |
||
50 | } |
||
51 |
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..