| 1 | <?php |
||
| 9 | trait ContainerPersistenceTrait |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * The current globally available container (if any). |
||
| 13 | * |
||
| 14 | * @var static |
||
| 15 | */ |
||
| 16 | protected static $instance; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Set the globally available instance of the container. |
||
| 20 | * |
||
| 21 | * @return static |
||
| 22 | */ |
||
| 23 | public static function getInstance() |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Set the shared instance of the container. |
||
| 33 | * |
||
| 34 | * @param ContainerInterface|null $container |
||
| 35 | * @return static |
||
| 36 | */ |
||
| 37 | public static function setInstance(ContainerInterface $container = null) |
||
| 41 | } |
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.