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:
parent
b4a271931d
commit
51abbc9074
@ -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 it’s 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
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user