Complex classes like Player 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 Player, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
17 | class Player extends AvatarModel implements NamedModel, DuplexUrlInterface, EloInterface |
||
18 | { |
||
19 | /** |
||
20 | * These are built-in roles that cannot be deleted via the web interface so we will be storing these values as |
||
21 | * constant variables. Hopefully, a user won't be silly enough to delete them manually from the database. |
||
22 | * |
||
23 | * @TODO Deprecate these and use the Role constants |
||
24 | */ |
||
25 | const DEVELOPER = Role::DEVELOPER; |
||
26 | const ADMIN = Role::ADMINISTRATOR; |
||
27 | const COP = Role::COP; |
||
28 | const REFEREE = Role::REFEREE; |
||
29 | const S_ADMIN = Role::SYSADMIN; |
||
30 | const PLAYER = Role::PLAYER; |
||
31 | const PLAYER_NO_PM = Role::PLAYER_NO_PM; |
||
32 | |||
33 | /** |
||
34 | * The bzid of the player |
||
35 | * @var int |
||
36 | */ |
||
37 | protected $bzid; |
||
38 | |||
39 | /** |
||
40 | * The id of the player's team |
||
41 | * @var int |
||
42 | */ |
||
43 | protected $team; |
||
44 | |||
45 | /** |
||
46 | * The player's status |
||
47 | * @var string |
||
48 | */ |
||
49 | protected $status; |
||
50 | |||
51 | /** |
||
52 | * The player's e-mail address |
||
53 | * @var string |
||
54 | */ |
||
55 | protected $email; |
||
56 | |||
57 | /** |
||
58 | * Whether the player has verified their e-mail address |
||
59 | * @var bool |
||
60 | */ |
||
61 | protected $verified; |
||
62 | |||
63 | /** |
||
64 | * What kind of events the player should be e-mailed about |
||
65 | * @var string |
||
66 | */ |
||
67 | protected $receives; |
||
68 | |||
69 | /** |
||
70 | * A confirmation code for the player's e-mail address verification |
||
71 | * @var string |
||
72 | */ |
||
73 | protected $confirmCode; |
||
74 | |||
75 | /** |
||
76 | * Whether the callsign of the player is outdated |
||
77 | * @var bool |
||
78 | */ |
||
79 | protected $outdated; |
||
80 | |||
81 | /** |
||
82 | * The player's profile description |
||
83 | * @var string |
||
84 | */ |
||
85 | protected $description; |
||
86 | |||
87 | /** |
||
88 | * The id of the player's country |
||
89 | * @var int |
||
90 | */ |
||
91 | protected $country; |
||
92 | |||
93 | /** |
||
94 | * The player's timezone PHP identifier, e.g. "Europe/Paris" |
||
95 | * @var string |
||
96 | */ |
||
97 | protected $timezone; |
||
98 | |||
99 | /** |
||
100 | * The date the player joined the site |
||
101 | * @var TimeDate |
||
102 | */ |
||
103 | protected $joined; |
||
104 | |||
105 | /** |
||
106 | * The date of the player's last login |
||
107 | * @var TimeDate |
||
108 | */ |
||
109 | protected $last_login; |
||
110 | |||
111 | /** |
||
112 | * The date of the player's last match |
||
113 | * @var Match |
||
114 | */ |
||
115 | protected $last_match; |
||
116 | |||
117 | /** |
||
118 | * The roles a player belongs to |
||
119 | * @var Role[] |
||
120 | */ |
||
121 | protected $roles; |
||
122 | |||
123 | /** |
||
124 | * The permissions a player has |
||
125 | * @var Permission[] |
||
126 | */ |
||
127 | protected $permissions; |
||
128 | |||
129 | /** |
||
130 | * A section for admins to write notes about players |
||
131 | * @var string |
||
132 | */ |
||
133 | protected $admin_notes; |
||
134 | |||
135 | /** |
||
136 | * The ban of the player, or null if the player is not banned |
||
137 | * @var Ban|null |
||
138 | */ |
||
139 | protected $ban; |
||
140 | |||
141 | /** |
||
142 | * Cached results for match summaries |
||
143 | * |
||
144 | * @var array |
||
145 | */ |
||
146 | private $cachedMatchSummary; |
||
147 | |||
148 | /** |
||
149 | * The cached match count for a player |
||
150 | * |
||
151 | * @var int |
||
152 | */ |
||
153 | private $cachedMatchCount = null; |
||
154 | |||
155 | /** |
||
156 | * The player's current Elo |
||
157 | * |
||
158 | * @var int |
||
159 | */ |
||
160 | private $elo; |
||
161 | |||
162 | private $matchActivity; |
||
163 | |||
164 | /** |
||
165 | * The name of the database table used for queries |
||
166 | */ |
||
167 | const TABLE = "players"; |
||
168 | |||
169 | /** |
||
170 | * The location where avatars will be stored |
||
171 | */ |
||
172 | const AVATAR_LOCATION = "/web/assets/imgs/avatars/players/"; |
||
173 | |||
174 | const EDIT_PERMISSION = Permission::EDIT_USER; |
||
175 | const SOFT_DELETE_PERMISSION = Permission::SOFT_DELETE_USER; |
||
176 | const HARD_DELETE_PERMISSION = Permission::HARD_DELETE_USER; |
||
177 | |||
178 | /** |
||
179 | * {@inheritdoc} |
||
180 | */ |
||
181 | protected function assignResult($player) |
||
195 | |||
196 | /** |
||
197 | * {@inheritdoc} |
||
198 | */ |
||
199 | protected function assignLazyResult($player) |
||
218 | |||
219 | /** |
||
220 | * Add a player a new role |
||
221 | * |
||
222 | * @param Role|int $role_id The role ID to add a player to |
||
223 | * |
||
224 | * @return bool Whether the operation was successful or not |
||
225 | */ |
||
226 | public function addRole($role_id) |
||
246 | |||
247 | /** |
||
248 | * Get the notes admins have left about a player |
||
249 | * @return string The notes |
||
250 | */ |
||
251 | public function getAdminNotes() |
||
257 | |||
258 | /** |
||
259 | * Get the player's BZID |
||
260 | * @return int The BZID |
||
261 | */ |
||
262 | public function getBZID() |
||
266 | |||
267 | /** |
||
268 | * Get the country a player belongs to |
||
269 | * |
||
270 | * @return Country The country belongs to |
||
271 | */ |
||
272 | public function getCountry() |
||
276 | |||
277 | /** |
||
278 | * Get the e-mail address of the player |
||
279 | * |
||
280 | * @return string The address |
||
281 | */ |
||
282 | public function getEmailAddress() |
||
288 | |||
289 | /** |
||
290 | * Get the player's Elo for a season. |
||
291 | * |
||
292 | * With the default arguments, it will fetch the Elo for the current season. |
||
293 | * |
||
294 | * @param string|null $season The season we're looking for: winter, spring, summer, or fall |
||
295 | * @param int|null $year The year of the season we're looking for |
||
296 | * |
||
297 | * @return int The player's Elo or -1 if the player hasn't played in the specified season. |
||
298 | */ |
||
299 | public function getElo($season = null, $year = null) |
||
333 | |||
334 | /** |
||
335 | * @param int $adjust The value to be added to the current ELO (negative to subtract) |
||
336 | * @param Match $match The match where this Elo change took place |
||
337 | */ |
||
338 | public function adjustElo($adjust, Match $match) |
||
347 | |||
348 | /** |
||
349 | * Returns whether the player has verified their e-mail address |
||
350 | * |
||
351 | * @return bool `true` for verified players |
||
352 | */ |
||
353 | public function isVerified() |
||
359 | |||
360 | /** |
||
361 | * Returns the confirmation code for the player's e-mail address verification |
||
362 | * |
||
363 | * @return string The player's confirmation code |
||
364 | */ |
||
365 | public function getConfirmCode() |
||
371 | |||
372 | /** |
||
373 | * Returns what kind of events the player should be e-mailed about |
||
374 | * |
||
375 | * @return string The type of notifications |
||
376 | */ |
||
377 | public function getReceives() |
||
383 | |||
384 | /** |
||
385 | * Finds out whether the specified player wants and can receive an e-mail |
||
386 | * message |
||
387 | * |
||
388 | * @param string $type |
||
389 | * @return bool `true` if the player should be sent an e-mail |
||
390 | */ |
||
391 | public function canReceive($type) |
||
406 | |||
407 | /** |
||
408 | * Find out whether the specified confirmation code is correct |
||
409 | * |
||
410 | * This method protects against timing attacks |
||
411 | * |
||
412 | * @param string $code The confirmation code to check |
||
413 | * @return bool `true` for a correct e-mail verification code |
||
414 | */ |
||
415 | public function isCorrectConfirmCode($code) |
||
425 | |||
426 | /** |
||
427 | * Get the player's sanitized description |
||
428 | * @return string The description |
||
429 | */ |
||
430 | public function getDescription() |
||
436 | |||
437 | /** |
||
438 | * Get the joined date of the player |
||
439 | * @return TimeDate The joined date of the player |
||
440 | */ |
||
441 | public function getJoinedDate() |
||
447 | |||
448 | /** |
||
449 | * Get all of the known IPs used by the player |
||
450 | * |
||
451 | * @return string[][] An array containing IPs and hosts |
||
452 | */ |
||
453 | public function getKnownIPs() |
||
460 | |||
461 | /** |
||
462 | * Get the last login for a player |
||
463 | * @return TimeDate The date of the last login |
||
464 | */ |
||
465 | public function getLastLogin() |
||
471 | |||
472 | /** |
||
473 | * Get the last match |
||
474 | * @return Match |
||
475 | */ |
||
476 | public function getLastMatch() |
||
482 | |||
483 | /** |
||
484 | * Get all of the callsigns a player has used to log in to the website |
||
485 | * @return string[] An array containing all of the past callsigns recorded for a player |
||
486 | */ |
||
487 | public function getPastCallsigns() |
||
491 | |||
492 | /** |
||
493 | * Get the player's team |
||
494 | * @return Team The object representing the team |
||
495 | */ |
||
496 | public function getTeam() |
||
500 | |||
501 | /** |
||
502 | * Get the player's timezone PHP identifier (example: "Europe/Paris") |
||
503 | * @return string The timezone |
||
504 | */ |
||
505 | public function getTimezone() |
||
511 | |||
512 | /** |
||
513 | * Get the roles of the player |
||
514 | * @return Role[] |
||
515 | */ |
||
516 | public function getRoles() |
||
522 | |||
523 | /** |
||
524 | * Rebuild the list of permissions a user has been granted |
||
525 | */ |
||
526 | private function updateUserPermissions() |
||
535 | |||
536 | /** |
||
537 | * Check if a player has a specific permission |
||
538 | * |
||
539 | * @param string|null $permission The permission to check for |
||
540 | * |
||
541 | * @return bool Whether or not the player has the permission |
||
542 | */ |
||
543 | public function hasPermission($permission) |
||
553 | |||
554 | /** |
||
555 | * Check whether or not a player been in a match or has logged on in the specified amount of time to be considered |
||
556 | * active |
||
557 | * |
||
558 | * @return bool True if the player has been active |
||
559 | */ |
||
560 | public function hasBeenActive() |
||
576 | |||
577 | /** |
||
578 | * Check whether the callsign of the player is outdated |
||
579 | * |
||
580 | * Returns true if this player has probably changed their callsign, making |
||
581 | * the current username stored in the database obsolete |
||
582 | * |
||
583 | * @return bool Whether or not the player is disabled |
||
584 | */ |
||
585 | public function isOutdated() |
||
591 | |||
592 | /** |
||
593 | * Check if a player's account has been disabled |
||
594 | * |
||
595 | * @return bool Whether or not the player is disabled |
||
596 | */ |
||
597 | public function isDisabled() |
||
601 | |||
602 | /** |
||
603 | * Check if everyone can log in as this user on a test environment |
||
604 | * |
||
605 | * @return bool |
||
606 | */ |
||
607 | public function isTestUser() |
||
611 | |||
612 | /** |
||
613 | * Check if a player is teamless |
||
614 | * |
||
615 | * @return bool True if the player is teamless |
||
616 | */ |
||
617 | public function isTeamless() |
||
621 | |||
622 | /** |
||
623 | * Mark a player's account as banned |
||
624 | */ |
||
625 | public function markAsBanned() |
||
633 | |||
634 | /** |
||
635 | * Mark a player's account as unbanned |
||
636 | */ |
||
637 | public function markAsUnbanned() |
||
645 | |||
646 | /** |
||
647 | * Find out if a player is banned |
||
648 | * |
||
649 | * @return bool |
||
650 | */ |
||
651 | public function isBanned() |
||
655 | |||
656 | /** |
||
657 | * Get the ban of the player |
||
658 | * |
||
659 | * This method performs a load of all the lazy parameters of the Player |
||
660 | * |
||
661 | * @return Ban|null The current ban of the player, or null if the player is |
||
662 | * is not banned |
||
663 | */ |
||
664 | public function getBan() |
||
670 | |||
671 | /** |
||
672 | * Remove a player from a role |
||
673 | * |
||
674 | * @param int $role_id The role ID to add or remove |
||
675 | * |
||
676 | * @return bool Whether the operation was successful or not |
||
677 | */ |
||
678 | public function removeRole($role_id) |
||
685 | |||
686 | /** |
||
687 | * Set the player's email address and reset their verification status |
||
688 | * @param string $email The address |
||
689 | */ |
||
690 | public function setEmailAddress($email) |
||
704 | |||
705 | /** |
||
706 | * Set whether the player has verified their e-mail address |
||
707 | * |
||
708 | * @param bool $verified Whether the player is verified or not |
||
709 | * @return self |
||
710 | */ |
||
711 | public function setVerified($verified) |
||
721 | |||
722 | /** |
||
723 | * Generate a new random confirmation token for e-mail address verification |
||
724 | * |
||
725 | * @return self |
||
726 | */ |
||
727 | public function generateNewConfirmCode() |
||
734 | |||
735 | /** |
||
736 | * Set the confirmation token for e-mail address verification |
||
737 | * |
||
738 | * @param string $code The confirmation code |
||
739 | * @return self |
||
740 | */ |
||
741 | private function setConfirmCode($code) |
||
747 | |||
748 | /** |
||
749 | * Set what kind of events the player should be e-mailed about |
||
750 | * |
||
751 | * @param string $receives The type of notification |
||
752 | * @return self |
||
753 | */ |
||
754 | public function setReceives($receives) |
||
760 | |||
761 | /** |
||
762 | * Set whether the callsign of the player is outdated |
||
763 | * |
||
764 | * @param bool $outdated Whether the callsign is outdated |
||
765 | * @return self |
||
766 | */ |
||
767 | public function setOutdated($outdated) |
||
773 | |||
774 | /** |
||
775 | * Set the player's description |
||
776 | * @param string $description The description |
||
777 | */ |
||
778 | public function setDescription($description) |
||
782 | |||
783 | /** |
||
784 | * Set the player's timezone |
||
785 | * @param string $timezone The timezone |
||
786 | */ |
||
787 | public function setTimezone($timezone) |
||
791 | |||
792 | /** |
||
793 | * Set the player's team |
||
794 | * @param int $team The team's ID |
||
795 | */ |
||
796 | public function setTeam($team) |
||
800 | |||
801 | /** |
||
802 | * Set the match the player last participated in |
||
803 | * |
||
804 | * @param int $match The match's ID |
||
805 | */ |
||
806 | public function setLastMatch($match) |
||
810 | |||
811 | /** |
||
812 | * Set the player's status |
||
813 | * @param string $status The new status |
||
814 | */ |
||
815 | public function setStatus($status) |
||
819 | |||
820 | /** |
||
821 | * Set the player's admin notes |
||
822 | * @param string $admin_notes The new admin notes |
||
823 | * @return self |
||
824 | */ |
||
825 | public function setAdminNotes($admin_notes) |
||
829 | |||
830 | /** |
||
831 | * Set the player's country |
||
832 | * @param int $country The ID of the new country |
||
833 | * @return self |
||
834 | */ |
||
835 | public function setCountry($country) |
||
839 | |||
840 | /** |
||
841 | * Updates this player's last login |
||
842 | */ |
||
843 | public function updateLastLogin() |
||
847 | |||
848 | /** |
||
849 | * Get the player's username |
||
850 | * @return string The username |
||
851 | */ |
||
852 | public function getUsername() |
||
856 | |||
857 | /** |
||
858 | * Get the player's username, safe for use in your HTML |
||
859 | * @return string The username |
||
860 | */ |
||
861 | public function getEscapedUsername() |
||
865 | |||
866 | /** |
||
867 | * Alias for Player::setUsername() |
||
868 | * |
||
869 | * @param string $username The new username |
||
870 | * @return self |
||
871 | */ |
||
872 | public function setName($username) |
||
876 | |||
877 | /** |
||
878 | * Mark all the unread messages of a player as read |
||
879 | * |
||
880 | * @return void |
||
881 | */ |
||
882 | public function markMessagesAsRead() |
||
889 | |||
890 | /** |
||
891 | * Set the roles of a user |
||
892 | * |
||
893 | * @todo Is it worth making this faster? |
||
894 | * @param Role[] $roles The new roles of the user |
||
895 | * @return self |
||
896 | */ |
||
897 | public function setRoles($roles) |
||
920 | |||
921 | /** |
||
922 | * Give or remove a role to/form a player |
||
923 | * |
||
924 | * @param int $role_id The role ID to add or remove |
||
925 | * @param string $action Whether to "add" or "remove" a role for a player |
||
926 | * |
||
927 | * @return bool Whether the operation was successful or not |
||
928 | */ |
||
929 | private function modifyRole($role_id, $action) |
||
947 | |||
948 | /** |
||
949 | * Given a player's BZID, get a player object |
||
950 | * |
||
951 | * @param int $bzid The player's BZID |
||
952 | * @return Player |
||
953 | */ |
||
954 | public static function getFromBZID($bzid) |
||
958 | |||
959 | /** |
||
960 | * Get a single player by their username |
||
961 | * |
||
962 | * @param string $username The username to look for |
||
963 | * @return Player |
||
964 | */ |
||
965 | public static function getFromUsername($username) |
||
971 | |||
972 | /** |
||
973 | * Get all the players in the database that have an active status |
||
974 | * @return Player[] An array of player BZIDs |
||
975 | */ |
||
976 | public static function getPlayers() |
||
982 | |||
983 | /** |
||
984 | * Show the number of notifications the user hasn't read yet |
||
985 | * @return int |
||
986 | */ |
||
987 | public function countUnreadNotifications() |
||
991 | |||
992 | /** |
||
993 | * Count the number of matches a player has participated in |
||
994 | * @return int |
||
995 | */ |
||
996 | public function getMatchCount() |
||
1007 | |||
1008 | /** |
||
1009 | * Get the (victory/total matches) ratio of the player |
||
1010 | * @return float |
||
1011 | */ |
||
1012 | public function getMatchWinRatio() |
||
1027 | |||
1028 | /** |
||
1029 | * Get the (total caps made by team/total matches) ratio of the player |
||
1030 | * @return float |
||
1031 | */ |
||
1032 | public function getMatchAverageCaps() |
||
1056 | |||
1057 | /** |
||
1058 | * Get the match activity in matches per day for a player |
||
1059 | * |
||
1060 | * @return float |
||
1061 | */ |
||
1062 | public function getMatchActivity() |
||
1082 | |||
1083 | /** |
||
1084 | * Return an array of matches this player participated in per month. |
||
1085 | * |
||
1086 | * ``` |
||
1087 | * ['yyyy-mm'] = <number of matches> |
||
1088 | * ``` |
||
1089 | * |
||
1090 | * @param TimeDate|string $timePeriod |
||
1091 | * |
||
1092 | * @return int[] |
||
1093 | */ |
||
1094 | public function getMatchSummary($timePeriod = '1 year ago') |
||
1109 | |||
1110 | /** |
||
1111 | * Show the number of messages the user hasn't read yet |
||
1112 | * @return int |
||
1113 | */ |
||
1114 | public function countUnreadMessages() |
||
1120 | |||
1121 | /** |
||
1122 | * Get all of the members belonging to a team |
||
1123 | * @param int $teamID The ID of the team to fetch the members of |
||
1124 | * @return Player[] An array of Player objects of the team members |
||
1125 | */ |
||
1126 | public static function getTeamMembers($teamID) |
||
1132 | |||
1133 | /** |
||
1134 | * {@inheritdoc} |
||
1135 | */ |
||
1136 | public static function getActiveStatuses() |
||
1140 | |||
1141 | /** |
||
1142 | * {@inheritdoc} |
||
1143 | */ |
||
1144 | public static function getEagerColumns($prefix = null) |
||
1159 | |||
1160 | /** |
||
1161 | * {@inheritdoc} |
||
1162 | */ |
||
1163 | public static function getLazyColumns($prefix = null) |
||
1181 | |||
1182 | /** |
||
1183 | * Get a query builder for players |
||
1184 | * @return PlayerQueryBuilder |
||
1185 | */ |
||
1186 | public static function getQueryBuilder() |
||
1198 | |||
1199 | /** |
||
1200 | * Enter a new player to the database |
||
1201 | * @param int $bzid The player's bzid |
||
1202 | * @param string $username The player's username |
||
1203 | * @param int $team The player's team |
||
1204 | * @param string $status The player's status |
||
1205 | * @param int $role_id The player's role when they are first created |
||
1206 | * @param string $avatar The player's profile avatar |
||
1207 | * @param string $description The player's profile description |
||
1208 | * @param int $country The player's country |
||
1209 | * @param string $timezone The player's timezone |
||
1210 | * @param string|\TimeDate $joined The date the player joined |
||
1211 | * @param string|\TimeDate $last_login The timestamp of the player's last login |
||
1212 | * @return Player An object representing the player that was just entered |
||
1213 | */ |
||
1214 | public static function newPlayer($bzid, $username, $team = null, $status = "active", $role_id = self::PLAYER, $avatar = "", $description = "", $country = 1, $timezone = null, $joined = "now", $last_login = "now") |
||
1240 | |||
1241 | /** |
||
1242 | * Determine if a player exists in the database |
||
1243 | * @param int $bzid The player's bzid |
||
1244 | * @return bool Whether the player exists in the database |
||
1245 | */ |
||
1246 | public static function playerBZIDExists($bzid) |
||
1250 | |||
1251 | /** |
||
1252 | * Change a player's callsign and add it to the database if it does not |
||
1253 | * exist as a past callsign |
||
1254 | * |
||
1255 | * @param string $username The new username of the player |
||
1256 | * @return self |
||
1257 | */ |
||
1258 | public function setUsername($username) |
||
1289 | |||
1290 | /** |
||
1291 | * Alphabetical order function for use in usort (case-insensitive) |
||
1292 | * @return Closure The sort function |
||
1293 | */ |
||
1294 | public static function getAlphabeticalSort() |
||
1300 | |||
1301 | /** |
||
1302 | * {@inheritdoc} |
||
1303 | * @todo Add a constraint that does this automatically |
||
1304 | */ |
||
1305 | public function wipe() |
||
1311 | |||
1312 | /** |
||
1313 | * Find whether the player can delete a model |
||
1314 | * |
||
1315 | * @param PermissionModel $model The model that will be seen |
||
1316 | * @param bool $showDeleted Whether to show deleted models to admins |
||
1317 | * @return bool |
||
1318 | */ |
||
1319 | public function canSee($model, $showDeleted = false) |
||
1323 | |||
1324 | /** |
||
1325 | * Find whether the player can delete a model |
||
1326 | * |
||
1327 | * @param PermissionModel $model The model that will be deleted |
||
1328 | * @param bool $hard Whether to check for hard-delete perms, as opposed |
||
1329 | * to soft-delete ones |
||
1330 | * @return bool |
||
1331 | */ |
||
1332 | public function canDelete($model, $hard = false) |
||
1340 | |||
1341 | /** |
||
1342 | * Find whether the player can create a model |
||
1343 | * |
||
1344 | * @param string $modelName The PHP class identifier of the model type |
||
1345 | * @return bool |
||
1346 | */ |
||
1347 | public function canCreate($modelName) |
||
1351 | |||
1352 | /** |
||
1353 | * Find whether the player can edit a model |
||
1354 | * |
||
1355 | * @param PermissionModel $model The model which will be edited |
||
1356 | * @return bool |
||
1357 | */ |
||
1358 | public function canEdit($model) |
||
1362 | } |
||
1363 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..