-
Notifications
You must be signed in to change notification settings - Fork 130
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
Add a source locator that can detect "autoload"
and "autoload-dev"
when given a composer schema definition from either a composer.json
or a composer.lock
#442
Comments
Relevant: Roave/BackwardCompatibilityCheck#97 |
…me there's a `composer.json` with an `autoload` section This means that your project should (in theory) have a `composer.json` at its root, and the sources for it will automatically be inferred from the `composer.json` definition. Currently, this package declares a `SourceLocator` instance emulating the `"autoload"` section of a `composer.json` configuration, but later it may be provided by BetterReflection directly (Roave/BetterReflection#442). This patch also changes the constructor and default behavior of `AssertBackwardsCompatible`, so it is a major BC break that requires a new major release.
After working on Roave/BackwardCompatibilityCheck#97 and Roave/BackwardCompatibilityCheck#102, I noticed a massive performance slowdown in the discovery of symbols by name. This is because If we implement a PSR-0, PSR-4, and generally a |
An example implementation is available at https://github.com/Roave/BackwardCompatibilityCheck/blob/a239f81bdfb8c68b8cf6c064b75bc13d77d789b7/src/LocateSources/LocateSourcesViaComposerJson.php#L63-L96 - it works, but it is slow as heck due to it being an |
I haven't the time to work on this directly, but just wanted to mention I did something quite similar:
|
I have something like this https://github.com/narrowspark/automatic/blob/master/src/Common/ClassFinder.php, so maybe I can just port it |
@Ocramius does the $composer = require "vendor/autoload.php';
$locator = new ComposerSourceLoucater($composer, $astLocator); |
As discussed in person, the
I could probably try using it, but the code is not side-effect-free, sadly: |
Note that following monstrosity won't be implemented for now:
|
Given a
composer.json
-alike array and astring $sourcesBasePath
we can generate a
SourceLocator
instance that closes around it.The text was updated successfully, but these errors were encountered: