In #1987298: Change notice: Shorten directory structure and PSR-0 namespacing for plugins we combined the $owner and $type into $subdir.
However, \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::getPluginNamespaces() hardcodes $namespaces\Plugin\$subdir
, preventing any true flexibility.
In addition, it also requires a $subdir, preventing plugins from residing in top level directories.
Now that #2042545: Annotation parsing should ignore @file doxygen is in, we can have plugin files wherever we want, but not by using AnnotatedClassDiscovery.
This patch does three things:
- Makes $subdir optional, and moves it to be the second parameter for AnnotatedClassDiscovery
- Forces the plugin manager to declare the full subdir (including Plugin\)
- Adds test coverage for placing a plugin at the top level (
Drupal\$provider
)