1 | <?php |
||
17 | class ItemPatcher implements EntityPatcherStrategy { |
||
18 | |||
19 | /** |
||
20 | * @var FingerprintPatcher |
||
21 | */ |
||
22 | private $fingerprintPatcher; |
||
23 | |||
24 | /** |
||
25 | * @var StatementListPatcher |
||
26 | */ |
||
27 | private $statementListPatcher; |
||
28 | |||
29 | /** |
||
30 | * @var SiteLinkListPatcher |
||
31 | */ |
||
32 | private $siteLinkListPatcher; |
||
33 | |||
34 | public function __construct() { |
||
39 | 4 | ||
40 | /** |
||
41 | * @param string $entityType |
||
42 | * |
||
43 | * @return boolean |
||
44 | */ |
||
45 | public function canPatchEntityType( $entityType ) { |
||
48 | |||
49 | /** |
||
50 | * @param EntityDocument $entity |
||
51 | * @param EntityDiff $patch |
||
52 | * |
||
53 | * @throws InvalidArgumentException |
||
54 | */ |
||
55 | public function patchEntity( EntityDocument $entity, EntityDiff $patch ) { |
||
60 | 2 | ||
61 | 2 | private function assertIsItem( EntityDocument $item ) { |
|
66 | |||
67 | 2 | private function patchItem( Item $item, EntityDiff $patch ) { |
|
82 | 2 | ||
83 | } |
||
84 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.