Issue #3600697: Handle array namespace paths in attribute route discovery
Problem
AttributeRouteDiscovery assumed each container.namespaces value was a single string path and appended /Controller directly to it. Core also supports namespace values as arrays of PSR-4 base directories, so an array-valued namespace produced an Array to string conversion warning during route discovery.
Solution
- Update attribute route discovery to normalise namespace values to a list of directories before scanning controller paths.
- Keep existing string-path behaviour and supports multiple namespace directories.
A regression test covers an array-valued namespace with multiple paths, including a missing path before the valid controller directory.
Testing
php -l core/lib/Drupal/Core/Routing/AttributeRouteDiscovery.phpphp -l core/tests/Drupal/Tests/Core/Routing/AttributeRouteDiscoveryTest.php- Local manual reproduction with an array-valued namespace now discovers routes and no longer emits the warning.
Supersedes !16057 (closed)
Closes #3600697
Edited by Kieran Cott