-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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] Composer classmap usage #5850
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more along the lines of what I expected of the interaction between Autoloader, Composer, and Modules. I'm approving but let's be sure to hear @paulbalandan on this bc I am not entirely sure my understanding was correct. I also have never turned off Composer discovery so I'm not sure what people are expecting from that. Maybe @lonnieezell will have some insight from earlier development of these features?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the time to re-read the thread from my PR up to here and somehow it cleared the misconception I had from reading only the code. I think this approach, coupled with #5849, is better than mine. This PR now syncs the code with the documentation. 👍
Some technical notes:
- I would like the new methods to be internal only (i.e. private) to reduce future BC concerns. And I believe these methods would never be needed to be overridden by users.
- Annoying as it can be, let's just deprecate
discoverComposerNamespaces()
instead of removing. We can cleanup in v5.
If we use Compoesr autoloader, the path would be like `/vendor/composer/../../app/Controllers/Home.php`.
Now it always loads and uses Composer classmap if it is available.
7b03571
to
c7e659f
Compare
If we have a lot of Composer packages, and not CodeIgniter packages, Composer discovery needs to look for files in these packages and it find nothing. In that case, if we turn off Composer discovery and set the CodeIgniter Composer package namespaces in the Autoloader Config file, we can avoid the useless Composer discovery. I thought that, but I have never tried yet. |
@MGatner @mostafakhudair @paulbalandan I updated all the things, and added changelog. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks all! Great collaboration.
Description
The current implementation uses Composer classmap only when
$modules->discoverInComposer
is true.discoverInComposer
is the setting for Auto-Discovery within Composer Packages.It has nothing to do with classmap usage.
This PR makes it use always if Composer is available.
Related: #5834
Checklist: