Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to guess packages using BetterReflection. #162

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

guillaume-perreal
Copy link
Contributor

@guillaume-perreal guillaume-perreal commented Nov 15, 2019

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:

@Ocramius
Copy link
Collaborator

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)

@Ocramius
Copy link
Collaborator

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 👍

If this is about having a configurable autoloader path, then I'd be 👎 for it, because it adds a lot of un-needed complexity, whereas simplifying the autoload setup is less effort and less maintenance.

@guillaume-perreal
Copy link
Contributor Author

MakeLocatorForComposerJson seems to be the right tool. I'll give it a try. Thanks for the pointer.

@guillaume-perreal guillaume-perreal force-pushed the 52-guess-dependencies-vendor branch from 2608e6f to c889607 Compare November 17, 2019 10:28
@guillaume-perreal guillaume-perreal changed the title [WIP] Try to guess packages from Composer's autoloader. [WIP] Try to guess packages using BetterReflection. Nov 17, 2019
@guillaume-perreal guillaume-perreal changed the title [WIP] Try to guess packages using BetterReflection. Try to guess packages using BetterReflection. Nov 17, 2019
@guillaume-perreal
Copy link
Contributor Author

@Ocramius any comment on this ?

@guillaume-perreal guillaume-perreal force-pushed the 52-guess-dependencies-vendor branch from 0893f57 to f0e5b75 Compare November 30, 2019 15:42
@Ocramius
Copy link
Collaborator

Ocramius commented Dec 4, 2019 via email

@guillaume-perreal guillaume-perreal force-pushed the 52-guess-dependencies-vendor branch from f0e5b75 to 41c4e5c Compare December 7, 2019 11:41
@guillaume-perreal guillaume-perreal force-pushed the 52-guess-dependencies-vendor branch from 41c4e5c to 897486b Compare February 7, 2020 17:40
@DanielBadura
Copy link
Contributor

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.

@Ocramius
Copy link
Collaborator

@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:

@DanielBadura
Copy link
Contributor

Alright, tryin then my best over there 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants