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

fix: Autoloader may not add Composer package's namespaces #7193

Merged
merged 1 commit into from
Jan 29, 2023

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jan 28, 2023

Description
Fixes codeigniter4/shield#610

PHPStan invokes phar (require 'phar://phpstan.phar/bin/phpstan';).
In that case, InstalledVersions::getAllRawData()[0]['versions'] does not contain correct data.

When I see getInstalledPackages():
https://github.com/composer/composer/blob/50cded331ced9acb4e926be3dda1f74b86af2a3b/src/Composer/InstalledVersions.php#L46-L64
it seems better to use all items in the returned array.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • [] User guide updated
  • Conforms to style guide

@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label Jan 28, 2023
Copy link
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

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

The explanation makes sense to me.

@kenjis
Copy link
Member Author

kenjis commented Jan 29, 2023

Processing all elements increases the number of loops.
If I could reduce the number of loops for sure, I would.
But I don't understand the details of the Composer implementation,
so I'll go with it for now.

@kenjis kenjis merged commit f1e400b into codeigniter4:develop Jan 29, 2023
@kenjis kenjis deleted the fix-loadComposerNamespaces branch January 29, 2023 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: PHPStan is broken because of service('auth')->routes($routes);
2 participants