1 | <?php |
||
26 | class DataValueServiceFactory { |
||
27 | |||
28 | /** |
||
29 | * Indicates a DataValue service |
||
30 | */ |
||
31 | const SERVICE_FILE = 'DataValueServices.php'; |
||
32 | |||
33 | /** |
||
34 | * Indicates a DataValue service |
||
35 | */ |
||
36 | const TYPE_INSTANCE = 'dv.'; |
||
37 | |||
38 | /** |
||
39 | * Indicates a ValueParser service |
||
40 | */ |
||
41 | const TYPE_PARSER = 'dv.parser.'; |
||
42 | |||
43 | /** |
||
44 | * Indicates a ValueFormatter service |
||
45 | */ |
||
46 | const TYPE_FORMATTER = 'dv.formatter.'; |
||
47 | |||
48 | /** |
||
49 | * Indicates a ValueValidator service |
||
50 | */ |
||
51 | const TYPE_VALIDATOR = 'dv.validator.'; |
||
52 | |||
53 | /** |
||
54 | * Extraneous service |
||
55 | */ |
||
56 | const TYPE_EXT_FUNCTION = 'dv.ext.func.'; |
||
57 | |||
58 | /** |
||
59 | * @var ContainerBuilder |
||
60 | */ |
||
61 | private $containerBuilder; |
||
62 | |||
63 | /** |
||
64 | * @var DispatchingDataValueFormatter |
||
65 | */ |
||
66 | private $dispatchingDataValueFormatter = null; |
||
67 | |||
68 | /** |
||
69 | * @since 2.5 |
||
70 | */ |
||
71 | public function __construct( ContainerBuilder $containerBuilder ) { |
||
74 | |||
75 | /** |
||
76 | * @since 2.5 |
||
77 | * |
||
78 | * @param DataValue $dataValue |
||
79 | * |
||
80 | * @return InfoLinksProvider |
||
81 | */ |
||
82 | public function newInfoLinksProvider( DataValue $dataValue ) { |
||
85 | |||
86 | /** |
||
87 | * Imported functions registered with DataTypeRegistry::registerExtraneousFunction |
||
88 | * |
||
89 | * @since 2.5 |
||
90 | * |
||
91 | * @param array $extraneousFunctions |
||
92 | */ |
||
93 | public function importExtraneousFunctions( array $extraneousFunctions ) { |
||
98 | |||
99 | /** |
||
100 | * @since 2.5 |
||
101 | * |
||
102 | * @param string $serviceName |
||
103 | * |
||
104 | * @return mixed |
||
105 | */ |
||
106 | public function newExtraneousFunctionByName( $serviceName, array $parameters = array() ) { |
||
109 | |||
110 | /** |
||
111 | * @since 2.5 |
||
112 | * |
||
113 | * @param string $typeId |
||
114 | * @param string $class |
||
115 | * |
||
116 | * @return DataValue |
||
117 | */ |
||
118 | public function newDataValueByType( $typeId, $class ) { |
||
127 | |||
128 | /** |
||
129 | * @since 2.5 |
||
130 | * |
||
131 | * @param DataValue $dataValue |
||
132 | * |
||
133 | * @return ValueParser |
||
134 | */ |
||
135 | public function getValueParser( DataValue $dataValue ) { |
||
138 | |||
139 | /** |
||
140 | * @since 2.5 |
||
141 | * |
||
142 | * @param DataValue $dataValue |
||
143 | * |
||
144 | * @return ValueFormatter |
||
145 | */ |
||
146 | public function getValueFormatter( DataValue $dataValue ) { |
||
162 | |||
163 | /** |
||
164 | * @since 2.5 |
||
165 | * |
||
166 | * @return ConstraintValueValidator |
||
167 | */ |
||
168 | public function getConstraintValueValidator() { |
||
171 | |||
172 | /** |
||
173 | * @since 2.5 |
||
174 | * |
||
175 | * @return PropertySpecificationLookup |
||
176 | */ |
||
177 | public function getPropertySpecificationLookup() { |
||
180 | |||
181 | private function getDispatchableValueFormatter( $dataValue ) { |
||
189 | |||
190 | private function newDispatchingDataValueFormatter() { |
||
212 | |||
213 | } |
||
214 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.