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:
1 | <?php |
||
10 | class ZendApnsPusher implements Pusher |
||
11 | { |
||
12 | /** |
||
13 | * Zend APNS. |
||
14 | * |
||
15 | * @var ZendService\Apple\Apns\Client\Message |
||
16 | */ |
||
17 | private $client; |
||
18 | |||
19 | /** |
||
20 | * Construct with Zend APNS Client instance. |
||
21 | * |
||
22 | * @param ZendService\Apple\Apns\Client\Message $client |
||
23 | */ |
||
24 | public function __construct(Client $client) |
||
28 | |||
29 | /** |
||
30 | * Push message. |
||
31 | * |
||
32 | * @param WZRD\Contracts\Push\Notification $notification |
||
33 | * @param array $options |
||
34 | */ |
||
35 | public function push(NotificationContract $notification, array $options = []) |
||
69 | |||
70 | /** |
||
71 | * Listen feedback service. |
||
72 | * |
||
73 | * @return array |
||
74 | */ |
||
75 | public function feedback() |
||
81 | |||
82 | /** |
||
83 | * Get supported platforms. |
||
84 | * |
||
85 | * @return array |
||
86 | */ |
||
87 | public function getSupportedPlatforms() |
||
91 | } |
||
92 |
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..