TomasVotruba / class-leak

Find leaking classes that you never use... and get rid of them.
https://tomasvotruba.com/blog/how-to-avoid-maintaining-classes-you-dont-use
MIT License
88 stars 7 forks source link

use via magic property #23

Closed staabm closed 9 months ago

staabm commented 1 year ago

classes used via magic properties are not detected

<?php

declare(strict_types=1);

namespace TomasVotruba\ClassLeak\Tests\UseImportsResolver\Fixture;

/**
 * @property \TomasVotruba\ClassLeak\Tests\UseImportsResolver\Source\FirstUsedClass $firstUsedClass
 * @property-read  \TomasVotruba\ClassLeak\Tests\UseImportsResolver\Source\SecondUsedClass $secondUsedClass
 */
final class FileUsingMagicProperties
{
}
TomasVotruba commented 9 months ago

Hi, I think we won't support docblock use as it would add huge legacy complexity to this package. This package should help out with native PHP and more solid version of code base. I'd not add it in the very beggining of the project.

Also if type is used only in docblock and not anywhere else in native PHP, that seems like a code smell to me :)