1 | <?php |
||
21 | class ApprovedByPropertyAnnotator implements PropertyAnnotator { |
||
22 | |||
23 | /** |
||
24 | * Predefined property ID |
||
25 | */ |
||
26 | const PROP_ID = '___APPROVEDBY'; |
||
27 | |||
28 | /** |
||
29 | * @var AppFactory |
||
30 | */ |
||
31 | private $appFactory; |
||
32 | |||
33 | /** |
||
34 | * @var Integer|null |
||
35 | */ |
||
36 | private $approvedBy; |
||
37 | |||
38 | /** |
||
39 | * @param AppFactory $appFactory |
||
40 | */ |
||
41 | public function __construct( AppFactory $appFactory ) { |
||
44 | |||
45 | /** |
||
46 | * @since 2.0 |
||
47 | * |
||
48 | * @param User $approvedBy |
||
49 | */ |
||
50 | public function setApprovedBy( $approvedBy ) { |
||
51 | $this->approvedBy = $approvedBy; |
||
|
|||
52 | } |
||
53 | |||
54 | /** |
||
55 | * {@inheritDoc} |
||
56 | */ |
||
57 | public function isAnnotatorFor( DIProperty $property ) { |
||
60 | |||
61 | public function getDataItem() { |
||
62 | if ( $this->approvedBy instanceof User ) { |
||
63 | $userPage = $this->approvedBy->getUserPage(); |
||
64 | |||
65 | if ( $userPage instanceof Title ) { |
||
66 | return DIWikiPage::newFromTitle( $userPage ); |
||
67 | } |
||
68 | } |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * {@inheritDoc} |
||
73 | */ |
||
74 | public function addAnnotation( |
||
91 | } |
||
92 |
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..