1 | <?php declare(strict_types = 1); |
||
24 | class ClassDefinition extends AbstractDefinition implements ClassBuilderInterface |
||
25 | { |
||
26 | /** @var string Class name with namespace */ |
||
27 | protected $className; |
||
28 | /** @var string Class name space */ |
||
29 | protected $nameSpace; |
||
30 | /** @var string Service name */ |
||
31 | protected $serviceName; |
||
32 | /** @var array Class container scopes */ |
||
33 | protected $scopes = []; |
||
34 | |||
35 | /** @var MethodDefinition[] Methods collection */ |
||
36 | protected $methodsCollection = []; |
||
37 | /** @var PropertyDefinition[] Property collection */ |
||
38 | protected $propertiesCollection = []; |
||
39 | |||
40 | /** {@inheritdoc} */ |
||
41 | 2 | public function defineConstructor(): MethodBuilderInterface |
|
46 | |||
47 | /** {@inheritdoc} */ |
||
48 | 4 | public function defineMethod(string $methodName): MethodBuilderInterface |
|
61 | |||
62 | /** {@inheritdoc} */ |
||
63 | 2 | public function defineProperty(string $propertyName): PropertyBuilderInterface |
|
76 | |||
77 | /** {@inheritdoc} */ |
||
78 | public function toMetadata(): ClassMetadata |
||
100 | |||
101 | /** |
||
102 | * Get namespace |
||
103 | * |
||
104 | * @return string |
||
105 | */ |
||
106 | public function getNameSpace(): string |
||
110 | |||
111 | /** |
||
112 | * Get class name |
||
113 | * |
||
114 | * @return string |
||
115 | */ |
||
116 | 1 | public function getClassName(): string |
|
120 | |||
121 | /** |
||
122 | * Add scope to definition |
||
123 | * |
||
124 | * @param AbstractScope $scope |
||
125 | * @return ClassDefinition |
||
126 | * @throws ScopeAlreadyExistsException |
||
127 | */ |
||
128 | 1 | public function addScope(AbstractScope $scope): ClassDefinition |
|
138 | |||
139 | /** |
||
140 | * Remove scope from definition |
||
141 | * |
||
142 | * @param string $id |
||
143 | * @return ClassDefinition |
||
144 | * @throws ScopeNotFoundException |
||
145 | */ |
||
146 | 1 | public function removeScope(string $id): ClassDefinition |
|
156 | |||
157 | /** |
||
158 | * Check if scope exists in definition |
||
159 | * |
||
160 | * @param string $id |
||
161 | * @return bool |
||
162 | */ |
||
163 | 1 | public function hasScope(string $id): bool |
|
167 | |||
168 | /** |
||
169 | * Get scope from definition |
||
170 | * |
||
171 | * @param string $id |
||
172 | * @return mixed |
||
173 | * @throws ScopeNotFoundException |
||
174 | */ |
||
175 | 1 | public function getScope(string $id): AbstractScope |
|
182 | |||
183 | /** |
||
184 | * Get all scopes |
||
185 | * |
||
186 | * @return AbstractScope[] |
||
187 | */ |
||
188 | public function getScopes(): array |
||
192 | |||
193 | /** |
||
194 | * @param string $className |
||
195 | * @return ClassDefinition |
||
196 | */ |
||
197 | 9 | public function setClassName(string $className): ClassDefinition |
|
203 | |||
204 | /** |
||
205 | * @return string |
||
206 | */ |
||
207 | 1 | public function getServiceName(): string |
|
211 | |||
212 | /** |
||
213 | * @param string $serviceName |
||
214 | * @return ClassDefinition |
||
215 | */ |
||
216 | 2 | public function setServiceName(string $serviceName): ClassDefinition |
|
222 | } |
||
223 |
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.