Propagate file generator uses to class generator. Fixes issue #4669.
propagate file generator uses to class generator
Seems correct but I've a question. You are adding all uses to all classes but exists the possibility that not all uses are used by all classes.
Could you add only the necessary uses for each class extracted?
I thought of that but I don't see how to separate the uses by class as I can not see where the instances are created. But from what I understand if someoane defines two classes in the same file and sets up a uses definition is because both classes require it, if not better use two different files right?
It's tricky, but if you have any suggestion I am open to ideas, thanks!
Due getUses definition and implementation $uses will be always an array so there is no need of this if
removed unnecessary check
@robertboloc The same algos used for detect unused use statements by CS fixers can be used here.
@Maks3w that algorithm will not work here, as it's operating on the entire file, and not the individual classes in the file.
Considering the most common use case is one class per file, I think the solution as proposed here is fine.
Merge pull request #5152 from robertboloc/#4669
Issue #4669 - Class generator should return uses from file generator
Merge branch 'hotfix/5152' into develop
Forward port #5152