Skip to content

Commit

Permalink
Merge pull request #8696 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 d63da1f + 0c102a2 commit e2e9d82
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/running_psalm/issues/PossiblyNullArgument.md
Expand Up @@ -14,6 +14,8 @@ foo(rand(0, 1) ? "hello" : null);
### Using a Function Call inside `if`

```php
<?php

if (is_string($cat->getName()) {
foo($cat->getName());
}
Expand All @@ -24,6 +26,8 @@ This fails since it's not guaranteed that subsequent calls to `$cat->getName()`

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

$catName = $cat->getName();
if (is_string($catName) {
foo($catName);
Expand All @@ -35,6 +39,8 @@ This fails since it's not guaranteed that subsequent calls to `$cat->getName()`
### Calling Another Function After `if`

```php
<?php

if (is_string($cat->getName()) {
changeCat();
foo($cat->getName());
Expand Down

0 comments on commit e2e9d82

Please sign in to comment.