1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Documented using underscore to suppress unused(param/variable) issues (#3580)

Previously it was undocumented, as pointed out in vimeo/psalm#3574
This commit is contained in:
Bruce Weirdan 2020-06-13 07:31:37 +03:00 committed by GitHub
parent 3497ca07b6
commit e496aa406f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 0 deletions

View File

@ -14,3 +14,14 @@ class A {
$a = new A();
$a->foo(1, 2);
```
Can be suppressed by prefixing the parameter name with an underscore:
```php
<?php
class A {
public function foo(int $a, int $_b) : int {
return $a + 4;
}
}
```

View File

@ -16,3 +16,11 @@ function foo(callable $c) : int {
return $c(2, 4);
}
```
Can be suppressed by prefixing the parameter name with an underscore:
```php
$f = function (int $_a, int $b) : int {
return $b + 4;
};
```

View File

@ -9,3 +9,11 @@ function foo(int $a, int $b) : int {
return $a + 4;
}
```
Can be suppressed by prefixing the parameter name with an underscore:
```php
function foo(int $_a, int $b) : int {
return $b + 4;
}
```

View File

@ -11,3 +11,11 @@ function foo() : void {
echo $b;
}
```
Can be suppressed by prefixing the variable name with an underscore:
```php
<?php
$_a = 22;
```