ComposerRequireChecker
ComposerRequireChecker copied to clipboard
Try to guess packages using BetterReflection.
See #52.
~~There are still a couple of issues:~~
~~* I do not like loading the project autoloader, since it automatically registers. Yet it is a cheap way to resolve symbols.~~ ~~* I am not satisfied with the handling of the autoloader-path configuration.~~
Use BetterReflection to guess the source package of unknown symbols from the vendor directory.
Known limitations:
- Find classes only.
- Do not support non-standard vendor locations (https://getcomposer.org/doc/06-config.md#vendor-dir), since BetterReflection does not either.
I do not like loading the project autoloader, since it automatically registers. Yet it is a cheap way to resolve symbols.
It's a simple/reliable way to get things done - if you want to avoid it, then please use an approach like https://github.com/Roave/BetterReflection/blob/14f329c5a3201ee890d3d8c4959c8779b9de7f63/src/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerJson.php (usage example in https://github.com/Roave/BackwardCompatibilityCheck/blob/d1175788acc330a8a02e92267247f9734e4ca04f/src/LocateSources/LocateSourcesViaComposerJson.php)
If this is about solving the problem of having to include the autoloader, then let's please go with BetterReflection, which includes abstractions to figure out where things are :+1:
If this is about having a configurable autoloader path, then I'd be :-1: for it, because it adds a lot of un-needed complexity, whereas simplifying the autoload setup is less effort and less maintenance.
MakeLocatorForComposerJson seems to be the right tool. I'll give it a try. Thanks for the pointer.
@Ocramius any comment on this ?
Haven't had time to check most of OSS work, sorry Marco Pivetta
http://twitter.com/Ocramius
http://ocramius.github.com/
On Sat, Nov 23, 2019 at 12:27 PM Guillaume Perréal [email protected] wrote:
@Ocramius https://github.com/Ocramius any comment on this ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/maglnet/ComposerRequireChecker/pull/162?email_source=notifications&email_token=AABFVEGDPG3LJGA7WQ6E2D3QVEHTXA5CNFSM4JN5QEV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEE7TFSI#issuecomment-557789897, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABFVEHPGWCKGX43VJZMTZLQVEHTXANCNFSM4JN5QEVQ .
I would like to see this feature 👍
Can i somehow help here out @Ocramius? There was already one attempt to implement the same feature #91 but there the autoloader was used to get it done. But i like the AST approach via BetterReflection alot. This PR needs a rebase for sure.
@DanielBadura since we now support "php": "^8", beware that you will have to wait until roave/better-reflection is tagged with PHP 8 support for a potential merge of such a feature.
In newer versions of BetterReflection, I added support for composer.json and installed.json scanning, which I use in:
- https://github.com/Roave/BackwardCompatibilityCheck/blob/7917779c5ccc3df603c41a90146af113c5429a9f/src/LocateSources/LocateSourcesViaComposerJson.php#L22-L23
- https://github.com/Roave/BackwardCompatibilityCheck/blob/7917779c5ccc3df603c41a90146af113c5429a9f/src/LocateDependencies/LocateDependenciesViaComposer.php#L57-L59
Alright, tryin then my best over there 🚀