Skip to content

Commit

Permalink
Merge pull request #8698 from ThomasLandauer/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan committed Nov 10, 2022
2 parents 4d53d26 + c51d366 commit 30efa4a
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions docs/running_psalm/issues/PossiblyNullArgument.md
Expand Up @@ -24,17 +24,18 @@ This fails since it's not guaranteed that subsequent calls to `$cat->getName()`

#### Possible Solutions

* Use a variable:
```php
<?php

$catName = $cat->getName();
if (is_string($catName) {
foo($catName);
}
unset($catName);
```
* Add [`@psalm-mutation-free`](../../annotating_code/supported_annotations.md#psalm-mutation-free) to the declaration of the function
Use a variable:
```php
<?php

$catName = $cat->getName();
if (is_string($catName) {
foo($catName);
}
unset($catName);
```

Or add [`@psalm-mutation-free`](../../annotating_code/supported_annotations.md#psalm-mutation-free) to the declaration of the function

### Calling Another Function After `if`

Expand Down

0 comments on commit 30efa4a

Please sign in to comment.