Skip to content

Commit

Permalink
Add a couple more documented things
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Mar 21, 2020
1 parent 40bd743 commit f6ea701
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/running_psalm/issues/ImplicitToStringCast.md
Expand Up @@ -15,3 +15,15 @@ function takesString(string $s) : void {}

takesString(new A);
```

## How to fix

You can add an explicit string cast:

```php
<?php

...

takesString((string) new A);
```
15 changes: 15 additions & 0 deletions docs/running_psalm/issues/ImpureByReferenceAssignment.md
Expand Up @@ -13,3 +13,18 @@ function foo(string &$a): string {
return $a;
}
```

## How to fix

Just remove the mutating assignment:

```php
<?php

/**
* @psalm-pure
*/
function foo(string &$a): string {
return $a;
}
```

0 comments on commit f6ea701

Please sign in to comment.