mirror of
https://github.com/danog/psalm.git
synced 2024-12-11 16:59:45 +01:00
cbd8150fde
* Add RedundantPropertyInitializationCheck * add documentation for RedundantPropertyInitializationCheck (#4734) Co-authored-by: orklah <orklah@users.noreply.github.com>
17 lines
434 B
Markdown
17 lines
434 B
Markdown
# RedundantPropertyInitializationCheck
|
|
|
|
Emitted when checking `isset()` on a non-nullable property. This issue indicate a redundant check for projects that initialize their properties in constructor.
|
|
|
|
```php
|
|
<?php
|
|
class A {
|
|
public string $bar;
|
|
public function getBar() : string {
|
|
if (isset($this->bar)) {
|
|
return $this->bar;
|
|
}
|
|
return "hello";
|
|
}
|
|
}
|
|
```
|