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 | final class FileGetContentsWebLoader implements LoaderInterface  | 
            ||
| 12 | { | 
            ||
| 13 | /**  | 
            ||
| 14 | * @var string  | 
            ||
| 15 | */  | 
            ||
| 16 | private $prefix;  | 
            ||
| 17 | |||
| 18 | /**  | 
            ||
| 19 | * @var DecoderManager  | 
            ||
| 20 | */  | 
            ||
| 21 | private $decoderManager;  | 
            ||
| 22 | |||
| 23 | /**  | 
            ||
| 24 | * @param string $prefix  | 
            ||
| 25 | * @param DecoderInterface|DecoderManager $decoders  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 26 | 6 | */  | 
            |
| 27 | View Code Duplication | public function __construct($prefix, $decoderManager = null)  | 
            |
| 37 | 6 | ||
| 38 | 6 | /**  | 
            |
| 39 | 2 |      * {@inheritdoc} | 
            |
| 40 | 6 | */  | 
            |
| 41 | 3 | public function load($path)  | 
            |
| 58 | |||
| 59 | /**  | 
            ||
| 60 | * Parse http headers returned by $http_response_header  | 
            ||
| 61 | * @link http://php.net/manual/en/reserved.variables.httpresponseheader.php  | 
            ||
| 62 | *  | 
            ||
| 63 | * @param array $headers  | 
            ||
| 64 | *  | 
            ||
| 65 | * @return array  | 
            ||
| 66 | */  | 
            ||
| 67 | public static function parseHttpResponseHeader($headers)  | 
            ||
| 84 | }  | 
            ||
| 85 | 
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
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.