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

Add Composer\InstalledVersions in symbol whitelist #218

Merged
merged 2 commits into from
Nov 27, 2020

Conversation

a-menshchikov
Copy link
Contributor

@a-menshchikov a-menshchikov commented Nov 10, 2020

Fixes #217.

data/config.dist.json Outdated Show resolved Hide resolved
data/config.dist.json Outdated Show resolved Hide resolved
…ime-api:^2 required + minor CheckCommandTest refactoring
Copy link
Collaborator

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - requires feedback from author, but seems to be really good/correct fix overall.

Technical (architectural) issues were still found, and need discussion.

@@ -93,6 +95,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
)
)
);

if (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, the approach seems much more correct now, as it correctly appends Composer\InstalledVersions to the declared "found" symbols.

The high level behavior is correct, but we're still operating in the wrong code unit.

I'm fine with merging this code as-is by adding a @TODO, but if you look above, the sources do come from:

                    $getAdditionalSourceFiles($options->getScanFiles(), dirname($composerJson)),
                    $getPackageSourceFiles($composerData, dirname($composerJson)),
                    (new LocateComposerPackageDirectDependenciesSourceFiles())->__invoke($composerJson)

I think we need to define and call $getComposerPluginApi($composerJson) in that section (by adding a parameter and a dedicated class that is only responsible for this dependency check).

What's your opinion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some refactoring and moved code that work with composerData to the dedicated locator class.

I can't use LocateASTFromFiles and LocateDefinedSymbolsFromASTRoots for get Composer\InstalledVersions from InstalledVersions.php because it contains use Composer\Semver\VersionParser and composer/semver may not be required in composer.json. I originally thought the same as you, but have got a message about undefined symbol Composer\Semver\VersionParser.

Also I see that you write about composer-plugin-api, but I work in this PR with composer-runtime-api. Should I change code and process the both packages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ocramius could you give me a feedback about the last comment?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for me and is more than sufficient, thank you! 👍

@Ocramius Ocramius added this to the 3.0.0 milestone Nov 12, 2020
@Ocramius Ocramius mentioned this pull request Nov 12, 2020
Copy link
Collaborator

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@a-menshchikov super happy with the approach taken so far, thank you so much! 👍

@Ocramius Ocramius merged commit 7615979 into maglnet:master Nov 27, 2020
@Ocramius Ocramius changed the title Add "Composer\InstalledVersions" in symbol whitelist Add Composer\InstalledVersions in symbol whitelist Nov 27, 2020
@a-menshchikov a-menshchikov deleted the issue-217 branch November 27, 2020 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unknown symbol Composer\InstalledVersions
2 participants