phpstan-doctrine icon indicating copy to clipboard operation
phpstan-doctrine copied to clipboard

ODM always-read and written properties

Open aivchen opened this issue 1 year ago • 0 comments

Hi! Thank you for this project - it's awesome and we use it a lot!

But I noticed, currently, phpstan-doctrine doesn't support analysing of always-read and written properties in ODM documents like this:

/**
 * @ODM\Document
 */
class MyDocument
{

	/** @ODM\Id */
	private int $id;

	/** @ODM\Field */
	private int $myField;

	private int $unused;

}

PHPStan reports that all three properties are unused.

I found src/Rules/Doctrine/ORM/PropertiesExtension.php but it's working only with ORM entities.

I don't have experience in writing extension for PHPStan, but I think I can write a similar implementation for ODM by analogy with ORM. What do you think?

aivchen avatar Oct 03 '24 21:10 aivchen