mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +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:
parent
3497ca07b6
commit
e496aa406f
@ -14,3 +14,14 @@ class A {
|
|||||||
$a = new A();
|
$a = new A();
|
||||||
$a->foo(1, 2);
|
$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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
@ -16,3 +16,11 @@ function foo(callable $c) : int {
|
|||||||
return $c(2, 4);
|
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;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
@ -9,3 +9,11 @@ function foo(int $a, int $b) : int {
|
|||||||
return $a + 4;
|
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;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
@ -11,3 +11,11 @@ function foo() : void {
|
|||||||
echo $b;
|
echo $b;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Can be suppressed by prefixing the variable name with an underscore:
|
||||||
|
|
||||||
|
```php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$_a = 22;
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user