Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing list #8698

Merged
merged 1 commit into from Nov 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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