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  | 
            ||
| 25 | class PHPCompatibility_Sniffs_PHP_RemovedHashAlgorithmsSniff extends PHPCompatibility_Sniff  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 26 | { | 
            ||
| 27 | |||
| 28 | /**  | 
            ||
| 29 | * A list of removed hash algorithms, which were present in older versions.  | 
            ||
| 30 | *  | 
            ||
| 31 | * The array lists : version number with false (deprecated) and true (removed).  | 
            ||
| 32 | * If's sufficient to list the first version where the hash algorithm was deprecated/removed.  | 
            ||
| 33 | *  | 
            ||
| 34 | * @var array(string => array(string => bool))  | 
            ||
| 35 | */  | 
            ||
| 36 | protected $removedAlgorithms = array(  | 
            ||
| 37 | 'salsa10' => array(  | 
            ||
| 38 | '5.4' => true,  | 
            ||
| 39 | ),  | 
            ||
| 40 | 'salsa20' => array(  | 
            ||
| 41 | '5.4' => true,  | 
            ||
| 42 | ),  | 
            ||
| 43 | );  | 
            ||
| 44 | |||
| 45 | /**  | 
            ||
| 46 | * Returns an array of tokens this test wants to listen for.  | 
            ||
| 47 | *  | 
            ||
| 48 | * @return array  | 
            ||
| 49 | */  | 
            ||
| 50 | public function register()  | 
            ||
| 55 | |||
| 56 | |||
| 57 | /**  | 
            ||
| 58 | * Processes this test, when one of its tokens is encountered.  | 
            ||
| 59 | *  | 
            ||
| 60 | * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.  | 
            ||
| 61 | * @param int $stackPtr The position of the current token in the  | 
            ||
| 62 | * stack passed in $tokens.  | 
            ||
| 63 | *  | 
            ||
| 64 | * @return void  | 
            ||
| 65 | */  | 
            ||
| 66 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)  | 
            ||
| 103 | |||
| 104 | |||
| 105 | /**  | 
            ||
| 106 | * Retrieve the relevant (version) information for the error message.  | 
            ||
| 107 | *  | 
            ||
| 108 | * @param string $algorithm The name of the algorithm.  | 
            ||
| 109 | *  | 
            ||
| 110 | * @return array  | 
            ||
| 111 | */  | 
            ||
| 112 | protected function getErrorInfo($algorithm)  | 
            ||
| 134 | |||
| 135 | |||
| 136 | /**  | 
            ||
| 137 | * Generates the error or warning for this sniff.  | 
            ||
| 138 | *  | 
            ||
| 139 | * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.  | 
            ||
| 140 | * @param int $stackPtr The position of the function  | 
            ||
| 141 | * in the token array.  | 
            ||
| 142 | * @param string $algorithm The name of the algorithm.  | 
            ||
| 143 | * @param array $errorInfo Array with details about the versions  | 
            ||
| 144 | * in which the algorithm was deprecated  | 
            ||
| 145 | * and/or removed.  | 
            ||
| 146 | *  | 
            ||
| 147 | * @return void  | 
            ||
| 148 | */  | 
            ||
| 149 | protected function addError($phpcsFile, $stackPtr, $algorithm, $errorInfo)  | 
            ||
| 174 | |||
| 175 | }//end class  | 
            ||
| 176 | 
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.