Complex classes like MembershipApplication 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 MembershipApplication, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
15 | class MembershipApplication { |
||
16 | |||
17 | const STATUS_CONFIRMED = 1; |
||
18 | const STATUS_NEUTRAL = 0; |
||
19 | const STATUS_DELETED = -1; |
||
20 | const STATUS_MODERATION = -2; |
||
21 | const STATUS_ABORTED = -4; |
||
22 | const STATUS_CANCELED = -8; |
||
23 | |||
24 | /** |
||
25 | * @var integer |
||
26 | * |
||
27 | * @ORM\Column(name="id", type="integer") |
||
28 | * @ORM\Id |
||
29 | * @ORM\GeneratedValue(strategy="IDENTITY") |
||
30 | */ |
||
31 | private $id; |
||
32 | |||
33 | /** |
||
34 | * FIXME: this should not be nullable |
||
35 | * |
||
36 | * @var integer |
||
37 | * |
||
38 | * @ORM\Column(name="status", type="smallint", options={"default":0}, nullable=true) |
||
39 | */ |
||
40 | private $status = 0; |
||
41 | |||
42 | /** |
||
43 | * @var integer|null |
||
44 | * |
||
45 | * @ORM\Column(name="donation_id", type="integer", nullable=true) |
||
46 | */ |
||
47 | private $donationId; |
||
48 | |||
49 | /** |
||
50 | * @var \DateTime |
||
51 | * |
||
52 | * @Gedmo\Timestampable(on="create") |
||
53 | * @ORM\Column(name="timestamp", type="datetime") |
||
54 | */ |
||
55 | private $creationTime; |
||
56 | |||
57 | /** |
||
58 | * @var string|null |
||
59 | * |
||
60 | * @ORM\Column(name="anrede", type="string", length=16, nullable=true) |
||
61 | */ |
||
62 | private $applicantSalutation; |
||
63 | |||
64 | /** |
||
65 | * @var string|null |
||
66 | * |
||
67 | * @ORM\Column(name="firma", type="string", length=100, nullable=true) |
||
68 | */ |
||
69 | private $company; |
||
70 | |||
71 | /** |
||
72 | * @var string|null |
||
73 | * |
||
74 | * @ORM\Column(name="titel", type="string", length=16, nullable=true) |
||
75 | */ |
||
76 | private $applicantTitle; |
||
77 | |||
78 | /** |
||
79 | * @var string |
||
80 | * |
||
81 | * @ORM\Column(name="name", type="string", length=250, options={"default":""}, nullable=false) |
||
82 | */ |
||
83 | private $probablyUnusedNameField = ''; |
||
84 | |||
85 | /** |
||
86 | * @var string |
||
87 | * |
||
88 | * @ORM\Column(name="vorname", type="string", length=50, options={"default":""}, nullable=false) |
||
89 | */ |
||
90 | private $applicantFirstName = ''; |
||
91 | |||
92 | /** |
||
93 | * @var string |
||
94 | * |
||
95 | * @ORM\Column(name="nachname", type="string", length=50, options={"default":""}, nullable=false) |
||
96 | */ |
||
97 | private $applicantLastName = ''; |
||
98 | |||
99 | /** |
||
100 | * @var string|null |
||
101 | * |
||
102 | * @ORM\Column(name="strasse", type="string", length=100, nullable=true) |
||
103 | */ |
||
104 | private $address; |
||
105 | |||
106 | /** |
||
107 | * @var string|null |
||
108 | * |
||
109 | * @ORM\Column(name="plz", type="string", length=8, nullable=true) |
||
110 | */ |
||
111 | private $postcode; |
||
112 | |||
113 | /** |
||
114 | * @var string|null |
||
115 | * |
||
116 | * @ORM\Column(name="ort", type="string", length=100, nullable=true) |
||
117 | */ |
||
118 | private $city; |
||
119 | |||
120 | /** |
||
121 | * @var string|null |
||
122 | * |
||
123 | * @ORM\Column(name="country", type="string", length=8, options={"default":""}, nullable=true) |
||
124 | */ |
||
125 | private $country = ''; |
||
126 | |||
127 | /** |
||
128 | * @var string |
||
129 | * |
||
130 | * @ORM\Column(name="email", type="string", length=250, options={"default":""}, nullable=false) |
||
131 | */ |
||
132 | private $applicantEmailAddress = ''; |
||
133 | |||
134 | /** |
||
135 | * @var string |
||
136 | * |
||
137 | * @ORM\Column(name="phone", type="string", length=30, options={"default":""}, nullable=false) |
||
138 | */ |
||
139 | private $applicantPhoneNumber = ''; |
||
140 | |||
141 | /** |
||
142 | * Date of birth |
||
143 | * |
||
144 | * @var \DateTime|null |
||
145 | * |
||
146 | * @ORM\Column(name="dob", type="date", nullable=true) |
||
147 | */ |
||
148 | private $applicantDateOfBirth; |
||
149 | |||
150 | /** |
||
151 | * @var string |
||
152 | * |
||
153 | * @ORM\Column(name="wikimedium_shipping", type="string", options={"default":""}, nullable=false) |
||
154 | */ |
||
155 | private $wikimediumShipping = 'none'; |
||
156 | |||
157 | /** |
||
158 | * @var string |
||
159 | * |
||
160 | * @ORM\Column(name="membership_type", type="string", options={"default":"sustaining"}, nullable=false) |
||
161 | */ |
||
162 | private $membershipType = 'sustaining'; |
||
163 | |||
164 | /** |
||
165 | * @var string |
||
166 | * |
||
167 | * @ORM\Column(name="payment_type", type="string", options={"default":"BEZ"}, nullable=false) |
||
168 | */ |
||
169 | private $paymentType = 'BEZ'; |
||
170 | |||
171 | /** |
||
172 | * @var integer |
||
173 | * |
||
174 | * @ORM\Column(name="membership_fee", type="integer", options={"default":0}, nullable=false) |
||
175 | */ |
||
176 | private $paymentAmountInEuro = 0; |
||
177 | |||
178 | /** |
||
179 | * FIXME: this should not be nullable |
||
180 | * |
||
181 | * @var integer |
||
182 | * |
||
183 | * @ORM\Column(name="membership_fee_interval", type="smallint", options={"default":12}, nullable=true) |
||
184 | */ |
||
185 | private $paymentIntervalInMonths = 12; |
||
186 | |||
187 | /** |
||
188 | * @var string |
||
189 | * |
||
190 | * @ORM\Column(name="account_number", type="string", length=16, options={"default":""}, nullable=false) |
||
191 | */ |
||
192 | private $paymentBankAccount = ''; |
||
193 | |||
194 | /** |
||
195 | * @var string |
||
196 | * |
||
197 | * @ORM\Column(name="bank_name", type="string", length=50, options={"default":""}, nullable=false) |
||
198 | */ |
||
199 | private $paymentBankName = ''; |
||
200 | |||
201 | /** |
||
202 | * @var string |
||
203 | * |
||
204 | * @ORM\Column(name="bank_code", type="string", length=16, options={"default":""}, nullable=false) |
||
205 | */ |
||
206 | private $paymentBankCode = ''; |
||
207 | |||
208 | /** |
||
209 | * @var string|null |
||
210 | * |
||
211 | * @ORM\Column(name="iban", type="string", length=32, options={"default":""}, nullable=true) |
||
212 | */ |
||
213 | private $paymentIban = ''; |
||
214 | |||
215 | /** |
||
216 | * @var string|null |
||
217 | * |
||
218 | * @ORM\Column(name="bic", type="string", length=32, options={"default":""}, nullable=true) |
||
219 | */ |
||
220 | private $paymentBic = ''; |
||
221 | |||
222 | /** |
||
223 | * @var string |
||
224 | * |
||
225 | * @ORM\Column(name="account_holder", type="string", length=50, options={"default":""}, nullable=false) |
||
226 | */ |
||
227 | private $paymentBankAccountHolder = ''; |
||
228 | |||
229 | /** |
||
230 | * @var string |
||
231 | * |
||
232 | * @ORM\Column(name="comment", type="text", options={"default":""}, nullable=false) |
||
233 | */ |
||
234 | private $comment = ''; |
||
235 | |||
236 | /** |
||
237 | * @var \DateTime|null |
||
238 | * |
||
239 | * @ORM\Column(name="export", type="datetime", nullable=true) |
||
240 | */ |
||
241 | private $export; |
||
242 | |||
243 | /** |
||
244 | * @var \DateTime|null |
||
245 | * |
||
246 | * @ORM\Column(name="backup", type="datetime", nullable=true) |
||
247 | */ |
||
248 | private $backup; |
||
249 | |||
250 | /** |
||
251 | * @var boolean |
||
252 | * |
||
253 | * @ORM\Column(name="wikilogin", type="boolean", options={"default":0}, nullable=false) |
||
254 | */ |
||
255 | private $wikilogin = 0; |
||
256 | |||
257 | /** |
||
258 | * @var string|null |
||
259 | * |
||
260 | * @ORM\Column(name="tracking", type="string", length=50, nullable=true) |
||
261 | */ |
||
262 | private $tracking; |
||
263 | |||
264 | /** |
||
265 | * @var string|null |
||
266 | * |
||
267 | * @ORM\Column(name="data", type="text", nullable=true) |
||
268 | */ |
||
269 | private $data; |
||
270 | |||
271 | /** |
||
272 | * @return integer |
||
273 | */ |
||
274 | 3 | public function getId() { |
|
277 | |||
278 | /** |
||
279 | * @since 2.0 |
||
280 | * |
||
281 | * @param integer|null $id |
||
282 | */ |
||
283 | 2 | public function setId( $id ) { |
|
286 | |||
287 | /** |
||
288 | * @param integer|null $donationId |
||
289 | * |
||
290 | * @return self |
||
291 | */ |
||
292 | public function setDonationId( $donationId ) { |
||
297 | |||
298 | /** |
||
299 | * Returns the id of the donation that led to the membership application, |
||
300 | * or null when the application is not linked to any donation. |
||
301 | * |
||
302 | * @return integer|null |
||
303 | */ |
||
304 | public function getDonationId() { |
||
307 | |||
308 | /** |
||
309 | * @param \DateTime|null $creationTime |
||
310 | * |
||
311 | * @return self |
||
312 | */ |
||
313 | public function setCreationTime( $creationTime ) { |
||
318 | |||
319 | /** |
||
320 | * @return \DateTime|null |
||
321 | */ |
||
322 | public function getCreationTime() { |
||
325 | |||
326 | /** |
||
327 | * @param string|null $applicantSalutation |
||
328 | * |
||
329 | * @return self |
||
330 | */ |
||
331 | public function setApplicantSalutation( $applicantSalutation ) { |
||
336 | |||
337 | /** |
||
338 | * @return string|null |
||
339 | */ |
||
340 | public function getApplicantSalutation() { |
||
343 | |||
344 | /** |
||
345 | * @param string|null $company |
||
346 | * |
||
347 | * @return self |
||
348 | */ |
||
349 | public function setCompany( $company ) { |
||
354 | |||
355 | /** |
||
356 | * @return string|null |
||
357 | */ |
||
358 | public function getCompany() { |
||
361 | |||
362 | /** |
||
363 | * @param string $applicantTitle |
||
364 | * |
||
365 | * @return self |
||
366 | */ |
||
367 | public function setApplicantTitle( $applicantTitle ) { |
||
372 | |||
373 | /** |
||
374 | * @return string |
||
375 | */ |
||
376 | public function getApplicantTitle() { |
||
379 | |||
380 | /** |
||
381 | * @param string $probablyUnusedNameField |
||
382 | * |
||
383 | * @return self |
||
384 | */ |
||
385 | public function setProbablyUnusedNameField( $probablyUnusedNameField ) { |
||
390 | |||
391 | /** |
||
392 | * @return string |
||
393 | */ |
||
394 | public function getProbablyUnusedNameField() { |
||
397 | |||
398 | /** |
||
399 | * @param string $applicantFirstName |
||
400 | * |
||
401 | * @return self |
||
402 | */ |
||
403 | public function setApplicantFirstName( $applicantFirstName ) { |
||
409 | |||
410 | /** |
||
411 | * @return string |
||
412 | */ |
||
413 | public function getApplicantFirstName() { |
||
416 | |||
417 | /** |
||
418 | * @param string $applicantLastName |
||
419 | * |
||
420 | * @return self |
||
421 | */ |
||
422 | public function setApplicantLastName( $applicantLastName ) { |
||
428 | |||
429 | /** |
||
430 | * @return string |
||
431 | */ |
||
432 | public function getApplicantLastName() { |
||
435 | |||
436 | /** |
||
437 | * Sets the full name |
||
438 | * |
||
439 | * @param string|null $firstName |
||
440 | * @param string|null $lastName |
||
441 | * |
||
442 | * @return self |
||
443 | */ |
||
444 | private function setNameFromParts( $firstName, $lastName ) { |
||
452 | |||
453 | /** |
||
454 | * Set address (street, etc) |
||
455 | * |
||
456 | * @param string|null $address |
||
457 | * |
||
458 | * @return self |
||
459 | */ |
||
460 | public function setAddress( $address ) { |
||
465 | |||
466 | /** |
||
467 | * Get address (street, etc) |
||
468 | * |
||
469 | * @return string|null |
||
470 | */ |
||
471 | public function getAddress() { |
||
474 | |||
475 | /** |
||
476 | * @param string|null $postcode |
||
477 | * |
||
478 | * @return self |
||
479 | */ |
||
480 | public function setPostcode( $postcode ) { |
||
485 | |||
486 | /** |
||
487 | * @return string|null |
||
488 | */ |
||
489 | public function getPostcode() { |
||
492 | |||
493 | /** |
||
494 | * @param string|null $city |
||
495 | * |
||
496 | * @return self |
||
497 | */ |
||
498 | public function setCity( $city ) { |
||
503 | |||
504 | /** |
||
505 | * @return string|null |
||
506 | */ |
||
507 | public function getCity() { |
||
510 | |||
511 | /** |
||
512 | * Set email |
||
513 | * |
||
514 | * @param string $applicantEmailAddress |
||
515 | * |
||
516 | * @return self |
||
517 | */ |
||
518 | public function setApplicantEmailAddress( $applicantEmailAddress ) { |
||
523 | |||
524 | /** |
||
525 | * Get email |
||
526 | * |
||
527 | * @return string |
||
528 | */ |
||
529 | public function getApplicantEmailAddress() { |
||
532 | |||
533 | /** |
||
534 | * Set phone |
||
535 | * |
||
536 | * @param string $applicantPhoneNumber |
||
537 | * |
||
538 | * @return self |
||
539 | */ |
||
540 | public function setApplicantPhoneNumber( $applicantPhoneNumber ) { |
||
545 | |||
546 | /** |
||
547 | * Get phone |
||
548 | * |
||
549 | * @return string |
||
550 | */ |
||
551 | public function getApplicantPhoneNumber() { |
||
554 | |||
555 | /** |
||
556 | * @param \DateTime|null $dateOfBirth |
||
557 | * |
||
558 | * @return self |
||
559 | */ |
||
560 | public function setApplicantDateOfBirth( $dateOfBirth ) { |
||
565 | |||
566 | /** |
||
567 | * @return \DateTime|null |
||
568 | */ |
||
569 | public function getApplicantDateOfBirth() { |
||
572 | |||
573 | /** |
||
574 | * @param string $wikimediumShipping |
||
575 | * |
||
576 | * @return self |
||
577 | */ |
||
578 | public function setWikimediumShipping( $wikimediumShipping ) { |
||
583 | |||
584 | /** |
||
585 | * @return string |
||
586 | */ |
||
587 | public function getWikimediumShipping() { |
||
590 | |||
591 | /** |
||
592 | * @param string $membershipType |
||
593 | * |
||
594 | * @return self |
||
595 | */ |
||
596 | public function setMembershipType( $membershipType ) { |
||
601 | |||
602 | /** |
||
603 | * @return string |
||
604 | */ |
||
605 | public function getMembershipType() { |
||
608 | |||
609 | /** |
||
610 | * @param string $paymentType |
||
611 | * |
||
612 | * @return self |
||
613 | */ |
||
614 | public function setPaymentType( $paymentType ) { |
||
619 | |||
620 | /** |
||
621 | * @return string |
||
622 | */ |
||
623 | public function getPaymentType() { |
||
626 | |||
627 | /** |
||
628 | * @param integer $paymentAmountInEuro |
||
629 | * |
||
630 | * @return self |
||
631 | */ |
||
632 | public function setPaymentAmount( $paymentAmountInEuro ) { |
||
637 | |||
638 | /** |
||
639 | * @return integer |
||
640 | */ |
||
641 | public function getPaymentAmount() { |
||
644 | |||
645 | /** |
||
646 | * @param integer $paymentIntervalInMonths |
||
647 | * |
||
648 | * @return self |
||
649 | */ |
||
650 | public function setPaymentIntervalInMonths($paymentIntervalInMonths) { |
||
655 | |||
656 | /** |
||
657 | * @return integer |
||
658 | */ |
||
659 | public function getPaymentIntervalInMonths() { |
||
662 | |||
663 | |||
664 | /** |
||
665 | * @param string $paymentBankAccount |
||
666 | * |
||
667 | * @return self |
||
668 | */ |
||
669 | public function setPaymentBankAccount( $paymentBankAccount ) { |
||
674 | |||
675 | /** |
||
676 | * @return string |
||
677 | */ |
||
678 | public function getPaymentBankAccount() { |
||
681 | |||
682 | /** |
||
683 | * @param string $paymentBankName |
||
684 | * |
||
685 | * @return self |
||
686 | */ |
||
687 | public function setPaymentBankName( $paymentBankName ) { |
||
692 | |||
693 | /** |
||
694 | * @return string |
||
695 | */ |
||
696 | public function getPaymentBankName() { |
||
699 | |||
700 | /** |
||
701 | * @param string $paymentBankCode |
||
702 | * |
||
703 | * @return self |
||
704 | */ |
||
705 | public function setPaymentBankCode( $paymentBankCode ) { |
||
710 | |||
711 | /** |
||
712 | * @return string |
||
713 | */ |
||
714 | public function getPaymentBankCode() { |
||
717 | |||
718 | /** |
||
719 | * @param string|null $paymentIban |
||
720 | * |
||
721 | * @return self |
||
722 | */ |
||
723 | public function setPaymentIban( $paymentIban ) { |
||
728 | |||
729 | /** |
||
730 | * @return string|null |
||
731 | */ |
||
732 | public function getPaymentIban() { |
||
735 | |||
736 | /** |
||
737 | * @param string|null $paymentBic |
||
738 | * |
||
739 | * @return self |
||
740 | */ |
||
741 | public function setPaymentBic( $paymentBic ) { |
||
746 | |||
747 | /** |
||
748 | * @return string|null |
||
749 | */ |
||
750 | public function getPaymentBic() { |
||
753 | |||
754 | /** |
||
755 | * @param string $paymentBankAccountHolder |
||
756 | * |
||
757 | * @return self |
||
758 | */ |
||
759 | public function setPaymentBankAccountHolder( $paymentBankAccountHolder ) { |
||
764 | |||
765 | /** |
||
766 | * @return string |
||
767 | */ |
||
768 | public function getPaymentBankAccountHolder() { |
||
771 | |||
772 | /** |
||
773 | * @param string $comment |
||
774 | * |
||
775 | * @return self |
||
776 | */ |
||
777 | public function setComment( $comment ) { |
||
782 | |||
783 | /** |
||
784 | * @return string |
||
785 | */ |
||
786 | public function getComment() { |
||
789 | |||
790 | /** |
||
791 | * Sets the time of export. |
||
792 | * |
||
793 | * @param \DateTime|null $export |
||
794 | * |
||
795 | * @return self |
||
796 | */ |
||
797 | public function setExport( $export ) { |
||
802 | |||
803 | /** |
||
804 | * Returns the time of export. |
||
805 | * |
||
806 | * @return \DateTime|null |
||
807 | */ |
||
808 | public function getExport() { |
||
811 | |||
812 | /** |
||
813 | * Sets the time of backup. |
||
814 | * |
||
815 | * @param \DateTime|null $backup |
||
816 | * |
||
817 | * @return self |
||
818 | */ |
||
819 | public function setBackup( $backup ) { |
||
824 | |||
825 | /** |
||
826 | * Returns the time of backup. |
||
827 | * |
||
828 | * @return \DateTime|null |
||
829 | */ |
||
830 | public function getBackup() { |
||
833 | |||
834 | /** |
||
835 | * @param boolean $wikilogin |
||
836 | * |
||
837 | * @return self |
||
838 | */ |
||
839 | public function setWikilogin( $wikilogin ) { |
||
844 | |||
845 | /** |
||
846 | * @return boolean |
||
847 | */ |
||
848 | public function getWikilogin() { |
||
851 | |||
852 | /** |
||
853 | * @param string|null $tracking |
||
854 | * |
||
855 | * @return self |
||
856 | */ |
||
857 | public function setTracking( $tracking ) { |
||
862 | |||
863 | /** |
||
864 | * @return string|null |
||
865 | */ |
||
866 | public function getTracking() { |
||
869 | |||
870 | /** |
||
871 | * Sets the status of the membership request. |
||
872 | * The allowed values are the STATUS_ constants in this class. |
||
873 | * |
||
874 | * @param integer $status |
||
875 | * |
||
876 | * @return self |
||
877 | */ |
||
878 | 4 | public function setStatus( $status ) { |
|
883 | |||
884 | /** |
||
885 | * Returns the status of the membership request. |
||
886 | * The possible values are the STATUS_ constants in this class. |
||
887 | * |
||
888 | * @return integer |
||
889 | */ |
||
890 | public function getStatus() { |
||
893 | |||
894 | /** |
||
895 | * @param string|null $country |
||
896 | * |
||
897 | * @return self |
||
898 | */ |
||
899 | public function setCountry( $country ) { |
||
904 | |||
905 | /** |
||
906 | * @return string|null |
||
907 | */ |
||
908 | public function getCountry() { |
||
911 | |||
912 | /** |
||
913 | * @param string|null $data |
||
914 | * @return self |
||
915 | */ |
||
916 | public function setData( $data ) { |
||
921 | |||
922 | /** |
||
923 | * @return string|null |
||
924 | */ |
||
925 | public function getData() { |
||
928 | |||
929 | /** |
||
930 | * @return bool |
||
931 | */ |
||
932 | public function isUnconfirmed() { |
||
935 | |||
936 | /** |
||
937 | * @return bool |
||
938 | */ |
||
939 | 3 | public function needsModeration() { |
|
942 | |||
943 | /** |
||
944 | * @return bool |
||
945 | */ |
||
946 | 3 | public function isCancelled() { |
|
949 | |||
950 | public function log( $message ) { |
||
957 | |||
958 | /** |
||
959 | * NOTE: if possible, use @see getDataObject instead, as it provides a nicer API. |
||
960 | * |
||
961 | * @since 2.0 |
||
962 | * @return array |
||
963 | */ |
||
964 | 5 | public function getDecodedData() { |
|
969 | |||
970 | /** |
||
971 | * NOTE: if possible, use @see modifyDataObject instead, as it provides a nicer API. |
||
972 | * |
||
973 | * @since 2.0 |
||
974 | * @param array $data |
||
|
|||
975 | */ |
||
976 | 4 | public function encodeAndSetData( array $dataArray ) { |
|
979 | |||
980 | /** |
||
981 | * WARNING: updates made to the return value will not be reflected in the Donation state. |
||
982 | * Similarly, updates to the Donation state will not propagate to the returned object. |
||
983 | * To update the Donation state, explicitly call @see setDataObject. |
||
984 | * |
||
985 | * @since 2.0 |
||
986 | * @return MembershipApplicationData |
||
987 | */ |
||
988 | 2 | public function getDataObject() { |
|
999 | |||
1000 | /** |
||
1001 | * @since 2.0 |
||
1002 | * @param MembershipApplicationData $data |
||
1003 | */ |
||
1004 | 4 | public function setDataObject( MembershipApplicationData $data ) { |
|
1022 | |||
1023 | /** |
||
1024 | * @since 2.0 |
||
1025 | * @param callable $modificationFunction Takes a modifiable MembershipApplicationData parameter |
||
1026 | */ |
||
1027 | 1 | public function modifyDataObject( callable $modificationFunction ) { |
|
1032 | |||
1033 | } |
||
1034 |
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.