mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Add ParamNameMismatch fixing documentation
This commit is contained in:
parent
11f170acb4
commit
03ab279cc4
@ -243,7 +243,7 @@ class A {
|
||||
|
||||
$this->bar = "baz";
|
||||
}
|
||||
|
||||
|
||||
public function setBaz() {
|
||||
$this->baz = [1, 2, 3];
|
||||
}
|
||||
@ -579,3 +579,39 @@ function foo() : string {
|
||||
|
||||
$a = foo();
|
||||
```
|
||||
|
||||
### ParamNameMismatch
|
||||
|
||||
This aligns child class param names with their parent.
|
||||
|
||||
Running `vendor/bin/psalter --issues=ParamNameMismatch` on
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
class A {
|
||||
public function foo(string $str, bool $b = false) : void {}
|
||||
}
|
||||
|
||||
class AChild extends A {
|
||||
public function foo(string $string, bool $b = false) : void {
|
||||
echo $string;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
gives
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
class A {
|
||||
public function foo(string $str, bool $b = false) : void {}
|
||||
}
|
||||
|
||||
class AChild extends A {
|
||||
public function foo(string $str, bool $b = false) : void {
|
||||
echo $str;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user