The class contains unused private property. These private class properties should be removed as they can sometimes lead to confusion while reading the code.
It is also recommended that you review these unused private properties, in case they were added for later use in the code, but the author missed using them.
class User
{
// invalid: $name is never unused
private string $name = 'Hello';
public function getName(): string
{
return 'John';
}
}
Make sure to delete private class properties that are not used:
class User
{
public function getMessage(): string
{
return 'Hello';
}
}