| 1 | <?php |
||
| 20 | class Sharpen implements PluginInterface |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * @var int |
||
| 24 | */ |
||
| 25 | protected $offset = 0; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var array |
||
| 29 | */ |
||
| 30 | protected $matrix = [ |
||
| 31 | [0.0, -1.0, 0.0], |
||
| 32 | [-1.0, 5.0, -1.0], |
||
| 33 | [0.0, -1.0, 0.0], |
||
| 34 | ]; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param int $offset Color offset |
||
| 38 | * @param int $matrix A 3x3 matrix: an array of three arrays of three floats |
||
| 39 | */ |
||
| 40 | public function __construct($offset = 0, $matrix = []) |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @param PHPThumb $phpthumb |
||
| 48 | * @return PHPThumb |
||
| 49 | */ |
||
| 50 | public function execute($phpthumb) |
||
| 56 | } |
||
| 57 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountIdthat can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theidproperty of an instance of theAccountclass. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.