1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Update MixedOperand.md

This commit is contained in:
Matthew Brown 2020-11-08 14:41:08 -05:00 committed by Daniil Gentili
parent b4a271931d
commit 51abbc9074
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -7,3 +7,19 @@ Emitted when Psalm cannot infer a type for an operand in any calculated expressi
echo $_GET['foo'] + "hello"; echo $_GET['foo'] + "hello";
``` ```
## Why its bad
Mixed operands can have fatal consequences, e.g. here:
```php
<?php
function foo(mixed $m) {
echo $m . 'bar';
}
class A {}
foo(new A()); // triggers fatal error
```