| 1 | <?php |
||
| 7 | class CacheResolveEvent extends Event |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Resource path. |
||
| 11 | * |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | protected $path; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Filter name. |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $filter; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Resource url. |
||
| 25 | * |
||
| 26 | * @var null |
||
| 27 | */ |
||
| 28 | protected $url; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Init default event state. |
||
| 32 | * |
||
| 33 | * @param string $path |
||
| 34 | * @param string $filter |
||
| 35 | * @param null|string $url |
||
| 36 | */ |
||
| 37 | public function __construct($path, $filter, $url = null) |
||
| 38 | { |
||
| 39 | $this->path = $path; |
||
| 40 | $this->filter = $filter; |
||
| 41 | $this->url = $url; |
||
|
|
|||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Sets resource path. |
||
| 46 | * |
||
| 47 | * @param $path |
||
| 48 | */ |
||
| 49 | public function setPath($path) |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Returns resource path. |
||
| 56 | * |
||
| 57 | * @return string |
||
| 58 | */ |
||
| 59 | public function getPath() |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Sets filter name. |
||
| 66 | * |
||
| 67 | * @param $filter |
||
| 68 | */ |
||
| 69 | public function setFilter($filter) |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Returns filter name. |
||
| 76 | * |
||
| 77 | * @return string |
||
| 78 | */ |
||
| 79 | public function getFilter() |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Sets resource url. |
||
| 86 | * |
||
| 87 | * @param $url |
||
| 88 | */ |
||
| 89 | public function setUrl($url) |
||
| 93 | |||
| 94 | /** |
||
| 95 | * Returns resource url. |
||
| 96 | */ |
||
| 97 | public function getUrl() |
||
| 101 | } |
||
| 102 |
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.