-
-
Notifications
You must be signed in to change notification settings - Fork 159
Discovery: Composer TypeError on PSR-4 namespace prefixes with multiple lookup directories #2111
Copy link
Copy link
Open
Description
Tempest version
3.0
PHP version
8.5
Operating system
Linux
Description
See Composer's schema regarding PSR-4 namespace registration: https://getcomposer.org/doc/04-schema.md#psr-4
If you need to search for a same prefix in multiple directories, you can specify them as an array as such:
{
"autoload": {
"psr-4": { "Monolog\\": ["src/", "lib/"] }
}
}The Composer class currently throws a TypeError in projects where a namespace prefix resides in multiple directories due to (what I understand to be) a wrong assumption about PSR-4 autoload paths:
| ->map(fn (string $path, string $namespace) => new Psr4Namespace($namespace, $path)) |
TypeError: Tempest\Discovery\Composer::{closure:Tempest\Discovery\Composer::load():41}(): Argument #1 ($path) must be of type string, array given, called in /app/src/packages/support/src/Arr/functions.php on line 862
I've taken a step at a reproducing test and a fix in: #2112
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels