Active
Project:
Drupal core
Version:
main
Component:
routing system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
15 Apr 2026 at 22:30 UTC
Updated:
16 Apr 2026 at 08:16 UTC
Jump to comment: Most recent
Since #3311365: Use PHP attributes for route discovery has introduced route definitions via PHP attributes, this means route discovery iterates through and reflects all files/classes in the Controller namespace/directory of modules.
There are some controllers that are not in a Controller namespace / directory so they can't use Route attributes.
Runtime:
grep -rn '_controller:' core --include="*.routing.yml" \
| grep -v '\\Drupal\\[a-zA-Z_]*\\Controller\\' \
| grep -v tests
Tests:
grep -rn '_controller:' core --include="*.routing.yml" \
| grep -v '\\Drupal\\[a-zA-Z_]*\\Controller\\' \
| grep tests
Results attached
Move some or all of these to a Controller subdirectory.
Co-ordinate with #3490484: [meta] Lots of non-plugin PHP classes in plugin directories and #3584795: Remove non-controller classes from module Controller namespaces/folders to avoid conflicts.
| Comment | File | Size | Author |
|---|---|---|---|
| controllers-test.txt | 28.03 KB | mstrelan | |
| controllers-runtime.txt | 2.36 KB | mstrelan |
Comments
Comment #2
catchWould we not do this as part of #3584794: [meta] Convert core routes to PHP attributes? Or should it be done in one MR for all of the classes as a prerequisite to those issues maybe?
Comment #3
mstrelan commentedI thought as a prerequisite would make reviewing the conversions easier. Not sure how noisy the deprecation for these is. Saw moved_classes mentioned but I don't actually know what that is.
Comment #4
catchOh that is #3509577: Classloader with support for moving/deprecating classes / #3502882: Add a classloader that can handle class moves it was added for the related plugins issue (but the plugins didn't get moved yet so only one or two usages in core so far).
Prerequisite probably makes sense yeah, should mean no diff at all in the moved files except the namespace.