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  | 
            ||
| 17 | class DibiFluentDataSource extends FilterableDataSource implements IDataSource  | 
            ||
| 18 | { | 
            ||
| 19 | |||
| 20 | /**  | 
            ||
| 21 | * @var Dibi\Fluent  | 
            ||
| 22 | */  | 
            ||
| 23 | protected $data_source;  | 
            ||
| 24 | |||
| 25 | /**  | 
            ||
| 26 | * @var Dibi\Fluent  | 
            ||
| 27 | */  | 
            ||
| 28 | protected $aggregation_data_source;  | 
            ||
| 29 | |||
| 30 | /**  | 
            ||
| 31 | * @var array  | 
            ||
| 32 | */  | 
            ||
| 33 | protected $data = [];  | 
            ||
| 34 | |||
| 35 | /**  | 
            ||
| 36 | * @var string  | 
            ||
| 37 | */  | 
            ||
| 38 | protected $primary_key;  | 
            ||
| 39 | |||
| 40 | /**  | 
            ||
| 41 | * @var bool  | 
            ||
| 42 | */  | 
            ||
| 43 | protected $hasAggregationFunctions = FALSE;  | 
            ||
| 44 | |||
| 45 | |||
| 46 | /**  | 
            ||
| 47 | * @param Dibi\Fluent $data_source  | 
            ||
| 48 | * @param string $primary_key  | 
            ||
| 49 | */  | 
            ||
| 50 | public function __construct(Dibi\Fluent $data_source, $primary_key)  | 
            ||
| 56 | |||
| 57 | |||
| 58 | /********************************************************************************  | 
            ||
| 59 | * IDataSource implementation *  | 
            ||
| 60 | ********************************************************************************/  | 
            ||
| 61 | |||
| 62 | |||
| 63 | /**  | 
            ||
| 64 | * Get count of data  | 
            ||
| 65 | * @return int  | 
            ||
| 66 | */  | 
            ||
| 67 | public function getCount()  | 
            ||
| 71 | |||
| 72 | |||
| 73 | /**  | 
            ||
| 74 | * Get the data  | 
            ||
| 75 | * @return array  | 
            ||
| 76 | */  | 
            ||
| 77 | public function getData()  | 
            ||
| 81 | |||
| 82 | |||
| 83 | /**  | 
            ||
| 84 | * Filter data - get one row  | 
            ||
| 85 | * @param array $condition  | 
            ||
| 86 | * @return static  | 
            ||
| 87 | */  | 
            ||
| 88 | public function filterOne(array $condition)  | 
            ||
| 94 | |||
| 95 | |||
| 96 | /**  | 
            ||
| 97 | * Filter by date  | 
            ||
| 98 | * @param Filter\FilterDate $filter  | 
            ||
| 99 | * @return void  | 
            ||
| 100 | */  | 
            ||
| 101 | View Code Duplication | public function applyFilterDate(Filter\FilterDate $filter)  | 
            |
| 109 | |||
| 110 | |||
| 111 | /**  | 
            ||
| 112 | * Filter by date range  | 
            ||
| 113 | * @param Filter\FilterDateRange $filter  | 
            ||
| 114 | * @return void  | 
            ||
| 115 | */  | 
            ||
| 116 | View Code Duplication | public function applyFilterDateRange(Filter\FilterDateRange $filter)  | 
            |
| 137 | |||
| 138 | |||
| 139 | /**  | 
            ||
| 140 | * Filter by range  | 
            ||
| 141 | * @param Filter\FilterRange $filter  | 
            ||
| 142 | * @return void  | 
            ||
| 143 | */  | 
            ||
| 144 | public function applyFilterRange(Filter\FilterRange $filter)  | 
            ||
| 159 | |||
| 160 | |||
| 161 | /**  | 
            ||
| 162 | * Filter by keyword  | 
            ||
| 163 | * @param Filter\FilterText $filter  | 
            ||
| 164 | * @return void  | 
            ||
| 165 | */  | 
            ||
| 166 | public function applyFilterText(Filter\FilterText $filter)  | 
            ||
| 207 | |||
| 208 | |||
| 209 | /**  | 
            ||
| 210 | * Filter by multi select value  | 
            ||
| 211 | * @param Filter\FilterMultiSelect $filter  | 
            ||
| 212 | * @return void  | 
            ||
| 213 | */  | 
            ||
| 214 | public function applyFilterMultiSelect(Filter\FilterMultiSelect $filter)  | 
            ||
| 240 | |||
| 241 | |||
| 242 | /**  | 
            ||
| 243 | * Filter by select value  | 
            ||
| 244 | * @param Filter\FilterSelect $filter  | 
            ||
| 245 | * @return void  | 
            ||
| 246 | */  | 
            ||
| 247 | public function applyFilterSelect(Filter\FilterSelect $filter)  | 
            ||
| 251 | |||
| 252 | |||
| 253 | /**  | 
            ||
| 254 | * Apply limit and offset on data  | 
            ||
| 255 | * @param int $offset  | 
            ||
| 256 | * @param int $limit  | 
            ||
| 257 | * @return static  | 
            ||
| 258 | */  | 
            ||
| 259 | public function limit($offset, $limit)  | 
            ||
| 265 | |||
| 266 | |||
| 267 | /**  | 
            ||
| 268 | * Sort data  | 
            ||
| 269 | * @param Sorting $sorting  | 
            ||
| 270 | * @return static  | 
            ||
| 271 | */  | 
            ||
| 272 | public function sort(Sorting $sorting)  | 
            ||
| 307 | |||
| 308 | /**  | 
            ||
| 309 | * @param string $aggregation_type  | 
            ||
| 310 | * @param string $column  | 
            ||
| 311 | */  | 
            ||
| 312 | public function addAggregationColumn($aggregation_type, $column)  | 
            ||
| 316 | |||
| 317 | |||
| 318 | /**  | 
            ||
| 319 | * @return array|Dibi\Row|FALSE  | 
            ||
| 320 | */  | 
            ||
| 321 | public function getAggregationData()  | 
            ||
| 329 | }  | 
            ||
| 330 | 
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..