Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like Message often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Message, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
159 | class Message implements MessageSpecifier, Serializable { |
||
160 | |||
161 | /** |
||
162 | * In which language to get this message. True, which is the default, |
||
163 | * means the current user language, false content language. |
||
164 | * |
||
165 | * @var bool |
||
166 | */ |
||
167 | protected $interface = true; |
||
168 | |||
169 | /** |
||
170 | * In which language to get this message. Overrides the $interface setting. |
||
171 | * |
||
172 | * @var Language|bool Explicit language object, or false for user language |
||
173 | */ |
||
174 | protected $language = false; |
||
175 | |||
176 | /** |
||
177 | * @var string The message key. If $keysToTry has more than one element, |
||
178 | * this may change to one of the keys to try when fetching the message text. |
||
179 | */ |
||
180 | protected $key; |
||
181 | |||
182 | /** |
||
183 | * @var string[] List of keys to try when fetching the message. |
||
184 | */ |
||
185 | protected $keysToTry; |
||
186 | |||
187 | /** |
||
188 | * @var array List of parameters which will be substituted into the message. |
||
189 | */ |
||
190 | protected $parameters = []; |
||
191 | |||
192 | /** |
||
193 | * Format for the message. |
||
194 | * Supported formats are: |
||
195 | * * text (transform) |
||
196 | * * escaped (transform+htmlspecialchars) |
||
197 | * * block-parse |
||
198 | * * parse (default) |
||
199 | * * plain |
||
200 | * |
||
201 | * @var string |
||
202 | */ |
||
203 | protected $format = 'parse'; |
||
204 | |||
205 | /** |
||
206 | * @var bool Whether database can be used. |
||
207 | */ |
||
208 | protected $useDatabase = true; |
||
209 | |||
210 | /** |
||
211 | * @var Title Title object to use as context. |
||
212 | */ |
||
213 | protected $title = null; |
||
214 | |||
215 | /** |
||
216 | * @var Content Content object representing the message. |
||
217 | */ |
||
218 | protected $content = null; |
||
219 | |||
220 | /** |
||
221 | * @var string |
||
222 | */ |
||
223 | protected $message; |
||
224 | |||
225 | /** |
||
226 | * @since 1.17 |
||
227 | * @param string|string[]|MessageSpecifier $key Message key, or array of |
||
228 | * message keys to try and use the first non-empty message for, or a |
||
229 | * MessageSpecifier to copy from. |
||
230 | * @param array $params Message parameters. |
||
231 | * @param Language $language [optional] Language to use (defaults to current user language). |
||
232 | * @throws InvalidArgumentException |
||
233 | */ |
||
234 | public function __construct( $key, $params = [], Language $language = null ) { |
||
235 | if ( $key instanceof MessageSpecifier ) { |
||
236 | if ( $params ) { |
||
237 | throw new InvalidArgumentException( |
||
238 | '$params must be empty if $key is a MessageSpecifier' |
||
239 | ); |
||
240 | } |
||
241 | $params = $key->getParams(); |
||
242 | $key = $key->getKey(); |
||
243 | } |
||
244 | |||
245 | if ( !is_string( $key ) && !is_array( $key ) ) { |
||
246 | throw new InvalidArgumentException( '$key must be a string or an array' ); |
||
247 | } |
||
248 | |||
249 | $this->keysToTry = (array)$key; |
||
250 | |||
251 | if ( empty( $this->keysToTry ) ) { |
||
252 | throw new InvalidArgumentException( '$key must not be an empty list' ); |
||
253 | } |
||
254 | |||
255 | $this->key = reset( $this->keysToTry ); |
||
256 | |||
257 | $this->parameters = array_values( $params ); |
||
258 | // User language is only resolved in getLanguage(). This helps preserve the |
||
259 | // semantic intent of "user language" across serialize() and unserialize(). |
||
260 | $this->language = $language ?: false; |
||
261 | } |
||
262 | |||
263 | /** |
||
264 | * @see Serializable::serialize() |
||
265 | * @since 1.26 |
||
266 | * @return string |
||
267 | */ |
||
268 | public function serialize() { |
||
280 | |||
281 | /** |
||
282 | * @see Serializable::unserialize() |
||
283 | * @since 1.26 |
||
284 | * @param string $serialized |
||
285 | */ |
||
286 | public function unserialize( $serialized ) { |
||
297 | |||
298 | /** |
||
299 | * @since 1.24 |
||
300 | * |
||
301 | * @return bool True if this is a multi-key message, that is, if the key provided to the |
||
302 | * constructor was a fallback list of keys to try. |
||
303 | */ |
||
304 | public function isMultiKey() { |
||
307 | |||
308 | /** |
||
309 | * @since 1.24 |
||
310 | * |
||
311 | * @return string[] The list of keys to try when fetching the message text, |
||
312 | * in order of preference. |
||
313 | */ |
||
314 | public function getKeysToTry() { |
||
317 | |||
318 | /** |
||
319 | * Returns the message key. |
||
320 | * |
||
321 | * If a list of multiple possible keys was supplied to the constructor, this method may |
||
322 | * return any of these keys. After the message has been fetched, this method will return |
||
323 | * the key that was actually used to fetch the message. |
||
324 | * |
||
325 | * @since 1.21 |
||
326 | * |
||
327 | * @return string |
||
328 | */ |
||
329 | public function getKey() { |
||
332 | |||
333 | /** |
||
334 | * Returns the message parameters. |
||
335 | * |
||
336 | * @since 1.21 |
||
337 | * |
||
338 | * @return array |
||
339 | */ |
||
340 | public function getParams() { |
||
343 | |||
344 | /** |
||
345 | * Returns the message format. |
||
346 | * |
||
347 | * @since 1.21 |
||
348 | * |
||
349 | * @return string |
||
350 | */ |
||
351 | public function getFormat() { |
||
354 | |||
355 | /** |
||
356 | * Returns the Language of the Message. |
||
357 | * |
||
358 | * @since 1.23 |
||
359 | * |
||
360 | * @return Language |
||
361 | */ |
||
362 | public function getLanguage() { |
||
366 | |||
367 | /** |
||
368 | * Factory function that is just wrapper for the real constructor. It is |
||
369 | * intended to be used instead of the real constructor, because it allows |
||
370 | * chaining method calls, while new objects don't. |
||
371 | * |
||
372 | * @since 1.17 |
||
373 | * |
||
374 | * @param string|string[]|MessageSpecifier $key |
||
375 | * @param mixed $param,... Parameters as strings. |
||
|
|||
376 | * |
||
377 | * @return Message |
||
378 | */ |
||
379 | public static function newFromKey( $key /*...*/ ) { |
||
384 | |||
385 | /** |
||
386 | * Transform a MessageSpecifier or a primitive value used interchangeably with |
||
387 | * specifiers (a message key string, or a key + params array) into a proper Message. |
||
388 | * |
||
389 | * Also accepts a MessageSpecifier inside an array: that's not considered a valid format |
||
390 | * but is an easy error to make due to how StatusValue stores messages internally. |
||
391 | * Further array elements are ignored in that case. |
||
392 | * |
||
393 | * @param string|array|MessageSpecifier $value |
||
394 | * @return Message |
||
395 | * @throws InvalidArgumentException |
||
396 | * @since 1.27 |
||
397 | */ |
||
398 | public static function newFromSpecifier( $value ) { |
||
399 | $params = []; |
||
400 | if ( is_array( $value ) ) { |
||
401 | $params = $value; |
||
402 | $value = array_shift( $params ); |
||
403 | } |
||
404 | |||
405 | if ( $value instanceof Message ) { // Message, RawMessage, ApiMessage, etc |
||
406 | $message = clone( $value ); |
||
407 | } elseif ( $value instanceof MessageSpecifier ) { |
||
408 | $message = new Message( $value ); |
||
409 | } elseif ( is_string( $value ) ) { |
||
410 | $message = new Message( $value, $params ); |
||
411 | } else { |
||
412 | throw new InvalidArgumentException( __METHOD__ . ': invalid argument type ' |
||
413 | . gettype( $value ) ); |
||
414 | } |
||
415 | |||
416 | return $message; |
||
417 | } |
||
418 | |||
419 | /** |
||
420 | * Factory function accepting multiple message keys and returning a message instance |
||
421 | * for the first message which is non-empty. If all messages are empty then an |
||
422 | * instance of the first message key is returned. |
||
423 | * |
||
424 | * @since 1.18 |
||
425 | * |
||
426 | * @param string|string[] $keys,... Message keys, or first argument as an array of all the |
||
427 | * message keys. |
||
428 | * |
||
429 | * @return Message |
||
430 | */ |
||
431 | public static function newFallbackSequence( /*...*/ ) { |
||
444 | |||
445 | /** |
||
446 | * Get a title object for a mediawiki message, where it can be found in the mediawiki namespace. |
||
447 | * The title will be for the current language, if the message key is in |
||
448 | * $wgForceUIMsgAsContentMsg it will be append with the language code (except content |
||
449 | * language), because Message::inContentLanguage will also return in user language. |
||
450 | * |
||
451 | * @see $wgForceUIMsgAsContentMsg |
||
452 | * @return Title |
||
453 | * @since 1.26 |
||
454 | */ |
||
455 | public function getTitle() { |
||
469 | |||
470 | /** |
||
471 | * Adds parameters to the parameter list of this message. |
||
472 | * |
||
473 | * @since 1.17 |
||
474 | * |
||
475 | * @param mixed ... Parameters as strings, or a single argument that is |
||
476 | * an array of strings. |
||
477 | * |
||
478 | * @return Message $this |
||
479 | */ |
||
480 | public function params( /*...*/ ) { |
||
489 | |||
490 | /** |
||
491 | * Add parameters that are substituted after parsing or escaping. |
||
492 | * In other words the parsing process cannot access the contents |
||
493 | * of this type of parameter, and you need to make sure it is |
||
494 | * sanitized beforehand. The parser will see "$n", instead. |
||
495 | * |
||
496 | * @since 1.17 |
||
497 | * |
||
498 | * @param mixed $params,... Raw parameters as strings, or a single argument that is |
||
499 | * an array of raw parameters. |
||
500 | * |
||
501 | * @return Message $this |
||
502 | */ |
||
503 | View Code Duplication | public function rawParams( /*...*/ ) { |
|
513 | |||
514 | /** |
||
515 | * Add parameters that are numeric and will be passed through |
||
516 | * Language::formatNum before substitution |
||
517 | * |
||
518 | * @since 1.18 |
||
519 | * |
||
520 | * @param mixed $param,... Numeric parameters, or a single argument that is |
||
521 | * an array of numeric parameters. |
||
522 | * |
||
523 | * @return Message $this |
||
524 | */ |
||
525 | View Code Duplication | public function numParams( /*...*/ ) { |
|
535 | |||
536 | /** |
||
537 | * Add parameters that are durations of time and will be passed through |
||
538 | * Language::formatDuration before substitution |
||
539 | * |
||
540 | * @since 1.22 |
||
541 | * |
||
542 | * @param int|int[] $param,... Duration parameters, or a single argument that is |
||
543 | * an array of duration parameters. |
||
544 | * |
||
545 | * @return Message $this |
||
546 | */ |
||
547 | View Code Duplication | public function durationParams( /*...*/ ) { |
|
557 | |||
558 | /** |
||
559 | * Add parameters that are expiration times and will be passed through |
||
560 | * Language::formatExpiry before substitution |
||
561 | * |
||
562 | * @since 1.22 |
||
563 | * |
||
564 | * @param string|string[] $param,... Expiry parameters, or a single argument that is |
||
565 | * an array of expiry parameters. |
||
566 | * |
||
567 | * @return Message $this |
||
568 | */ |
||
569 | View Code Duplication | public function expiryParams( /*...*/ ) { |
|
579 | |||
580 | /** |
||
581 | * Add parameters that are time periods and will be passed through |
||
582 | * Language::formatTimePeriod before substitution |
||
583 | * |
||
584 | * @since 1.22 |
||
585 | * |
||
586 | * @param int|int[] $param,... Time period parameters, or a single argument that is |
||
587 | * an array of time period parameters. |
||
588 | * |
||
589 | * @return Message $this |
||
590 | */ |
||
591 | View Code Duplication | public function timeperiodParams( /*...*/ ) { |
|
601 | |||
602 | /** |
||
603 | * Add parameters that are file sizes and will be passed through |
||
604 | * Language::formatSize before substitution |
||
605 | * |
||
606 | * @since 1.22 |
||
607 | * |
||
608 | * @param int|int[] $param,... Size parameters, or a single argument that is |
||
609 | * an array of size parameters. |
||
610 | * |
||
611 | * @return Message $this |
||
612 | */ |
||
613 | View Code Duplication | public function sizeParams( /*...*/ ) { |
|
623 | |||
624 | /** |
||
625 | * Add parameters that are bitrates and will be passed through |
||
626 | * Language::formatBitrate before substitution |
||
627 | * |
||
628 | * @since 1.22 |
||
629 | * |
||
630 | * @param int|int[] $param,... Bit rate parameters, or a single argument that is |
||
631 | * an array of bit rate parameters. |
||
632 | * |
||
633 | * @return Message $this |
||
634 | */ |
||
635 | View Code Duplication | public function bitrateParams( /*...*/ ) { |
|
645 | |||
646 | /** |
||
647 | * Add parameters that are plaintext and will be passed through without |
||
648 | * the content being evaluated. Plaintext parameters are not valid as |
||
649 | * arguments to parser functions. This differs from self::rawParams in |
||
650 | * that the Message class handles escaping to match the output format. |
||
651 | * |
||
652 | * @since 1.25 |
||
653 | * |
||
654 | * @param string|string[] $param,... plaintext parameters, or a single argument that is |
||
655 | * an array of plaintext parameters. |
||
656 | * |
||
657 | * @return Message $this |
||
658 | */ |
||
659 | View Code Duplication | public function plaintextParams( /*...*/ ) { |
|
669 | |||
670 | /** |
||
671 | * Set the language and the title from a context object |
||
672 | * |
||
673 | * @since 1.19 |
||
674 | * |
||
675 | * @param IContextSource $context |
||
676 | * |
||
677 | * @return Message $this |
||
678 | */ |
||
679 | public function setContext( IContextSource $context ) { |
||
686 | |||
687 | /** |
||
688 | * Request the message in any language that is supported. |
||
689 | * |
||
690 | * As a side effect interface message status is unconditionally |
||
691 | * turned off. |
||
692 | * |
||
693 | * @since 1.17 |
||
694 | * @param Language|string $lang Language code or Language object. |
||
695 | * @return Message $this |
||
696 | * @throws MWException |
||
697 | */ |
||
698 | public function inLanguage( $lang ) { |
||
717 | |||
718 | /** |
||
719 | * Request the message in the wiki's content language, |
||
720 | * unless it is disabled for this message. |
||
721 | * |
||
722 | * @since 1.17 |
||
723 | * @see $wgForceUIMsgAsContentMsg |
||
724 | * |
||
725 | * @return Message $this |
||
726 | */ |
||
727 | public function inContentLanguage() { |
||
737 | |||
738 | /** |
||
739 | * Allows manipulating the interface message flag directly. |
||
740 | * Can be used to restore the flag after setting a language. |
||
741 | * |
||
742 | * @since 1.20 |
||
743 | * |
||
744 | * @param bool $interface |
||
745 | * |
||
746 | * @return Message $this |
||
747 | */ |
||
748 | public function setInterfaceMessageFlag( $interface ) { |
||
752 | |||
753 | /** |
||
754 | * Enable or disable database use. |
||
755 | * |
||
756 | * @since 1.17 |
||
757 | * |
||
758 | * @param bool $useDatabase |
||
759 | * |
||
760 | * @return Message $this |
||
761 | */ |
||
762 | public function useDatabase( $useDatabase ) { |
||
766 | |||
767 | /** |
||
768 | * Set the Title object to use as context when transforming the message |
||
769 | * |
||
770 | * @since 1.18 |
||
771 | * |
||
772 | * @param Title $title |
||
773 | * |
||
774 | * @return Message $this |
||
775 | */ |
||
776 | public function title( $title ) { |
||
780 | |||
781 | /** |
||
782 | * Returns the message as a Content object. |
||
783 | * |
||
784 | * @return Content |
||
785 | */ |
||
786 | public function content() { |
||
793 | |||
794 | /** |
||
795 | * Returns the message parsed from wikitext to HTML. |
||
796 | * |
||
797 | * @since 1.17 |
||
798 | * |
||
799 | * @return string HTML |
||
800 | */ |
||
801 | public function toString() { |
||
844 | |||
845 | /** |
||
846 | * Magic method implementation of the above (for PHP >= 5.2.0), so we can do, eg: |
||
847 | * $foo = new Message( $key ); |
||
848 | * $string = "<abbr>$foo</abbr>"; |
||
849 | * |
||
850 | * @since 1.18 |
||
851 | * |
||
852 | * @return string |
||
853 | */ |
||
854 | public function __toString() { |
||
880 | |||
881 | /** |
||
882 | * Fully parse the text from wikitext to HTML. |
||
883 | * |
||
884 | * @since 1.17 |
||
885 | * |
||
886 | * @return string Parsed HTML. |
||
887 | */ |
||
888 | public function parse() { |
||
892 | |||
893 | /** |
||
894 | * Returns the message text. {{-transformation is done. |
||
895 | * |
||
896 | * @since 1.17 |
||
897 | * |
||
898 | * @return string Unescaped message text. |
||
899 | */ |
||
900 | public function text() { |
||
904 | |||
905 | /** |
||
906 | * Returns the message text as-is, only parameters are substituted. |
||
907 | * |
||
908 | * @since 1.17 |
||
909 | * |
||
910 | * @return string Unescaped untransformed message text. |
||
911 | */ |
||
912 | public function plain() { |
||
916 | |||
917 | /** |
||
918 | * Returns the parsed message text which is always surrounded by a block element. |
||
919 | * |
||
920 | * @since 1.17 |
||
921 | * |
||
922 | * @return string HTML |
||
923 | */ |
||
924 | public function parseAsBlock() { |
||
928 | |||
929 | /** |
||
930 | * Returns the message text. {{-transformation is done and the result |
||
931 | * is escaped excluding any raw parameters. |
||
932 | * |
||
933 | * @since 1.17 |
||
934 | * |
||
935 | * @return string Escaped message text. |
||
936 | */ |
||
937 | public function escaped() { |
||
941 | |||
942 | /** |
||
943 | * Check whether a message key has been defined currently. |
||
944 | * |
||
945 | * @since 1.17 |
||
946 | * |
||
947 | * @return bool |
||
948 | */ |
||
949 | public function exists() { |
||
952 | |||
953 | /** |
||
954 | * Check whether a message does not exist, or is an empty string |
||
955 | * |
||
956 | * @since 1.18 |
||
957 | * @todo FIXME: Merge with isDisabled()? |
||
958 | * |
||
959 | * @return bool |
||
960 | */ |
||
961 | public function isBlank() { |
||
965 | |||
966 | /** |
||
967 | * Check whether a message does not exist, is an empty string, or is "-". |
||
968 | * |
||
969 | * @since 1.18 |
||
970 | * |
||
971 | * @return bool |
||
972 | */ |
||
973 | public function isDisabled() { |
||
977 | |||
978 | /** |
||
979 | * @since 1.17 |
||
980 | * |
||
981 | * @param mixed $raw |
||
982 | * |
||
983 | * @return array Array with a single "raw" key. |
||
984 | */ |
||
985 | public static function rawParam( $raw ) { |
||
988 | |||
989 | /** |
||
990 | * @since 1.18 |
||
991 | * |
||
992 | * @param mixed $num |
||
993 | * |
||
994 | * @return array Array with a single "num" key. |
||
995 | */ |
||
996 | public static function numParam( $num ) { |
||
999 | |||
1000 | /** |
||
1001 | * @since 1.22 |
||
1002 | * |
||
1003 | * @param int $duration |
||
1004 | * |
||
1005 | * @return int[] Array with a single "duration" key. |
||
1006 | */ |
||
1007 | public static function durationParam( $duration ) { |
||
1010 | |||
1011 | /** |
||
1012 | * @since 1.22 |
||
1013 | * |
||
1014 | * @param string $expiry |
||
1015 | * |
||
1016 | * @return string[] Array with a single "expiry" key. |
||
1017 | */ |
||
1018 | public static function expiryParam( $expiry ) { |
||
1021 | |||
1022 | /** |
||
1023 | * @since 1.22 |
||
1024 | * |
||
1025 | * @param number $period |
||
1026 | * |
||
1027 | * @return number[] Array with a single "period" key. |
||
1028 | */ |
||
1029 | public static function timeperiodParam( $period ) { |
||
1032 | |||
1033 | /** |
||
1034 | * @since 1.22 |
||
1035 | * |
||
1036 | * @param int $size |
||
1037 | * |
||
1038 | * @return int[] Array with a single "size" key. |
||
1039 | */ |
||
1040 | public static function sizeParam( $size ) { |
||
1043 | |||
1044 | /** |
||
1045 | * @since 1.22 |
||
1046 | * |
||
1047 | * @param int $bitrate |
||
1048 | * |
||
1049 | * @return int[] Array with a single "bitrate" key. |
||
1050 | */ |
||
1051 | public static function bitrateParam( $bitrate ) { |
||
1054 | |||
1055 | /** |
||
1056 | * @since 1.25 |
||
1057 | * |
||
1058 | * @param string $plaintext |
||
1059 | * |
||
1060 | * @return string[] Array with a single "plaintext" key. |
||
1061 | */ |
||
1062 | public static function plaintextParam( $plaintext ) { |
||
1065 | |||
1066 | /** |
||
1067 | * Substitutes any parameters into the message text. |
||
1068 | * |
||
1069 | * @since 1.17 |
||
1070 | * |
||
1071 | * @param string $message The message text. |
||
1072 | * @param string $type Either "before" or "after". |
||
1073 | * |
||
1074 | * @return string |
||
1075 | */ |
||
1076 | protected function replaceParameters( $message, $type = 'before' ) { |
||
1087 | |||
1088 | /** |
||
1089 | * Extracts the parameter type and preprocessed the value if needed. |
||
1090 | * |
||
1091 | * @since 1.18 |
||
1092 | * |
||
1093 | * @param mixed $param Parameter as defined in this class. |
||
1094 | * |
||
1095 | * @return array Array with the parameter type (either "before" or "after") and the value. |
||
1096 | */ |
||
1097 | protected function extractParam( $param ) { |
||
1135 | |||
1136 | /** |
||
1137 | * Wrapper for what ever method we use to parse wikitext. |
||
1138 | * |
||
1139 | * @since 1.17 |
||
1140 | * |
||
1141 | * @param string $string Wikitext message contents. |
||
1142 | * |
||
1143 | * @return string Wikitext parsed into HTML. |
||
1144 | */ |
||
1145 | protected function parseText( $string ) { |
||
1156 | |||
1157 | /** |
||
1158 | * Wrapper for what ever method we use to {{-transform wikitext. |
||
1159 | * |
||
1160 | * @since 1.17 |
||
1161 | * |
||
1162 | * @param string $string Wikitext message contents. |
||
1163 | * |
||
1164 | * @return string Wikitext with {{-constructs replaced with their values. |
||
1165 | */ |
||
1166 | protected function transformText( $string ) { |
||
1174 | |||
1175 | /** |
||
1176 | * Wrapper for what ever method we use to get message contents. |
||
1177 | * |
||
1178 | * @since 1.17 |
||
1179 | * |
||
1180 | * @return string |
||
1181 | * @throws MWException If message key array is empty. |
||
1182 | */ |
||
1183 | protected function fetchMessage() { |
||
1201 | |||
1202 | /** |
||
1203 | * Formats a message parameter wrapped with 'plaintext'. Ensures that |
||
1204 | * the entire string is displayed unchanged when displayed in the output |
||
1205 | * format. |
||
1206 | * |
||
1207 | * @since 1.25 |
||
1208 | * |
||
1209 | * @param string $plaintext String to ensure plaintext output of |
||
1210 | * |
||
1211 | * @return string Input plaintext encoded for output to $this->format |
||
1212 | */ |
||
1213 | protected function formatPlaintext( $plaintext ) { |
||
1227 | } |
||
1228 | |||
1281 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.