| Total Complexity | 3 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class ClientOptions |
||
| 6 | { |
||
| 7 | /** @var string[] */ |
||
| 8 | public $channels; |
||
| 9 | |||
| 10 | /** @var int */ |
||
| 11 | public $floodProtectionDelay; |
||
| 12 | |||
| 13 | /** @var string */ |
||
| 14 | public $nickname; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param string $nickname The nickname used on the irc server. |
||
| 18 | * @param string|string[] $channels The channels to join on connection. |
||
| 19 | */ |
||
| 20 | public function __construct(string $nickname = null, $channels = []) |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Get the options for the IrcConnection from this collection. |
||
| 32 | * |
||
| 33 | * @return ConnectionOptions |
||
| 34 | */ |
||
| 35 | public function connectionOptions(): ConnectionOptions |
||
| 41 | } |
||
| 42 | } |
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.