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 |
||
| 9 | class WebhookController extends AbstractActionController |
||
| 10 | { |
||
| 11 | protected $gameService; |
||
| 12 | |||
| 13 | protected $prizeCategoryService; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * |
||
| 17 | * @var ServiceManager |
||
| 18 | */ |
||
| 19 | protected $serviceLocator; |
||
| 20 | |||
| 21 | public function __construct(ServiceLocatorInterface $locator) |
||
| 25 | |||
| 26 | public function getServiceLocator() |
||
| 30 | |||
| 31 | View Code Duplication | public function indexAction() |
|
| 45 | |||
| 46 | /** |
||
| 47 | * FB hooks : hub.mode=subscribe& |
||
| 48 | * hub.challenge=1158201444& |
||
| 49 | * hub.verify_token=meatyhamhock |
||
| 50 | */ |
||
| 51 | View Code Duplication | public function facebookAction() |
|
| 65 | |||
| 66 | View Code Duplication | public function instagramAction() |
|
| 80 | |||
| 81 | public function getGameService() |
||
| 89 | |||
| 90 | public function getPrizeCategoryService() |
||
| 98 | |||
| 99 | public function setPrizeCategoryService(\PlaygroundGame\Service\PrizeCategory $prizeCategoryService) |
||
| 105 | } |
||
| 106 |
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..