WyriHaximus / php-list-classes-in-directory

Allows you to list full qualified class names in directories and files.
MIT License
24 stars 3 forks source link

Allow to indicate whether abstract classes should be returned as well #8

Open holtkamp opened 5 years ago

holtkamp commented 5 years ago

Just a thought on how to put this library to use: an idea might be to assemble a list of classes and check whether they have been configured properly/explicitly in a DependencyInjectionContainer, required for optimization purposes

However, in that case we would be only interested in instantiatable / non-abstract classess...

Extending the function signatures with a boolean flag could be an idea:

function listClassesInDirectory(string $directory, bool $includeAbstractClasses = true): iterable

However, this does cause a challenge with the functions that use variadic parameters...

WyriHaximus commented 5 years ago

We could also wrap a function around listClassesInDirectory which does the checking for us.

holtkamp commented 5 years ago

aah, yeah, that might even be simpler and more elegant as well! Was just thinking out loud when this idea came to mind 😉

WyriHaximus commented 5 years ago

Haha I like it that way, fancy doing a PR adding it? :)