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 |
||
| 11 | class ZendGcmPusher implements Pusher |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Zend GCM. |
||
| 15 | * |
||
| 16 | * @var ZendService\Google\Gcm\Client |
||
| 17 | */ |
||
| 18 | private $client; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Construct with Zend GCM Client instance. |
||
| 22 | * |
||
| 23 | * @param ZendService\Google\Gcm\Client $client |
||
| 24 | */ |
||
| 25 | public function __construct(Client $client) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Push message. |
||
| 37 | * |
||
| 38 | * @param WZRD\Contracts\Push\Notification $notification |
||
| 39 | * @param array $options |
||
| 40 | */ |
||
| 41 | public function push(NotificationContract $notification, array $options = []) |
||
| 86 | |||
| 87 | /** |
||
| 88 | * Get supported platforms. |
||
| 89 | * |
||
| 90 | * @return array |
||
| 91 | */ |
||
| 92 | public function getSupportedPlatforms() |
||
| 96 | } |
||
| 97 |
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..