1 | <?php |
||
21 | class PropertyAnnotator { |
||
22 | |||
23 | use LoggerAwareTrait; |
||
24 | |||
25 | /** |
||
26 | * @var ServicesFactory |
||
27 | */ |
||
28 | private $servicesFactory; |
||
29 | |||
30 | /** |
||
31 | * @var PropertyAnnotator[] |
||
32 | */ |
||
33 | private $propertyAnnotators = []; |
||
34 | |||
35 | /** |
||
36 | * @since 1.0 |
||
37 | * |
||
38 | * @param ServicesFactory $servicesFactory |
||
39 | */ |
||
40 | 3 | public function __construct( ServicesFactory $servicesFactory ) { |
|
43 | |||
44 | /** |
||
45 | * @since 1.0 |
||
46 | * |
||
47 | * @param SemanticData $semanticData |
||
48 | */ |
||
49 | 2 | public function addAnnotation( SemanticData $semanticData ) { |
|
50 | |||
51 | 2 | $time = microtime( true ); |
|
52 | |||
53 | 2 | if ( !$this->canAnnotate( $semanticData->getSubject() ) ) { |
|
54 | 1 | return; |
|
55 | } |
||
56 | |||
57 | 1 | if ( $this->propertyAnnotators === [] ) { |
|
58 | 1 | $this->initPropertyAnnotators(); |
|
59 | } |
||
60 | |||
61 | 1 | foreach ( $this->propertyAnnotators as $propertyAnnotator ) { |
|
62 | 1 | $propertyAnnotator->addAnnotation( $semanticData ); |
|
63 | } |
||
64 | |||
65 | 1 | $this->logger->info( |
|
66 | 1 | [ 'SemanticApprovedRevs', 'procTime:{procTime}' ], |
|
|
|||
67 | 1 | [ 'procTime' => round( ( microtime( true ) - $time ), 5 ) ] |
|
68 | ); |
||
69 | 1 | } |
|
70 | |||
71 | 2 | private function canAnnotate( $subject ) { |
|
72 | |||
73 | 2 | if ( $subject === null || $subject->getTitle() === null || $subject->getTitle()->isSpecialPage() ) { |
|
74 | 1 | return false; |
|
75 | } |
||
76 | |||
77 | 1 | return true; |
|
78 | } |
||
79 | |||
80 | 1 | private function initPropertyAnnotators() { |
|
86 | |||
87 | } |
||
88 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: