Open den-kuz opened 2 years ago
This is an expected behavior of phpstan if you have only getter and no setter in a class.
class Foo
{
private int $id;
public function getId() { return $id; }
}
There is no specific behavior implemented in phpstan-doctrine for this in document/entities class I think.
If you want to get rid of this error
@VincentLanglet Of course there is: https://phpstan.org/blog/detecting-unused-private-properties-methods-constants#what-if-my-code-is-%E2%80%9Cspecial%E2%80%9D%3F
Oh I see the issue is https://github.com/phpstan/phpstan-doctrine/blob/ecc4aecaaf34871a2961c4c7a046bc2e092b0300/src/Rules/Doctrine/ORM/PropertiesExtension.php#L46-L55
I could try a PR.
But currently the PropertiesExtension
is in a Doctrine/ORM
folder. If we have support for ODM, moving the class could make sens.
PHP 8, Symfony 5.4, Doctrine ODM 4.4:
extensions installed:
objectManagerLoader
provided:tests/object-manager.php
:Still getting this error:
Some debug observations:
PHPStan\Type\Doctrine\ObjectMetadataResolver::getClassMetadata
: