Skip to content

Commit

Permalink
Add ParamNameMismatch fixing documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Aug 17, 2020
1 parent 11f170a commit 03ab279
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion docs/manipulating_code/fixing.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class A {

$this->bar = "baz";
}

public function setBaz() {
$this->baz = [1, 2, 3];
}
Expand Down Expand Up @@ -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;
}
}
```

0 comments on commit 03ab279

Please sign in to comment.