Repository navigation
Handle PSR-4 path lists in getPrimaryNamespace() - #87
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 2.x #87 +/- ##
============================================
+ Coverage 82.35% 82.46% +0.11%
- Complexity 48 50 +2
============================================
Files 1 1
Lines 153 154 +1
============================================
+ Hits 126 127 +1
Misses 27 27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Do we really need support for multiple auto load paths?
Only paths relative should be supported for
Since the plugin name and namesapce are based on folder name, are such plugins even usable in practice? |
|
No idea, but those adjustments were free basically, so I thought it would save another edge case bug report in the future ;) |
|
Release notes are ready, either way. We can easily drop things again. |
|
I would rather not add additional code and tests to mitigate hypothetical situations which are extremely unlikely to occur in practice. No one has reported an issue for any of these cases. |
|
Fair on the absolute paths and the quotes, I'll drop those. The test and metadata cleanup is split out into #88. The path-list one is a crash rather than feature support though: Composer's error handler turns the "Array to string conversion" warning into an exception, so a single plugin with that autoload shape breaks |
A PSR-4 namespace may map to a list of paths. Next to a second namespace, preg_grep() and array_search() got that list as a value and raised "Array to string conversion", which Composer's error handler turns into an exception, aborting the autoload dump for the whole application. Each entry is now cast to an array before matching. The first matching namespace still wins, as with array_search() before.
f842cd2 to
0f278e2
Compare
A PSR-4 namespace mapped to a list of paths (
"Foo\\": ["src/", "lib/"]) next to a second namespace madegetPrimaryNamespace()raise "Array to string conversion". Composer's error handler turns that warning into an exception, so the autoload dump of the whole application aborts.Each entry is now cast to an array before matching. The first matching namespace still wins, as with
array_search()before.Reduced from the original version: the absolute
plugin-pathsand quote escaping changes are dropped, the test and metadata cleanup went in with #88.