Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/routing/Loader/AnnotationClassLoader.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | c2387f117808 |
line wrap: on
line diff
--- a/vendor/symfony/routing/Loader/AnnotationClassLoader.php Mon Apr 23 09:33:26 2018 +0100 +++ b/vendor/symfony/routing/Loader/AnnotationClassLoader.php Mon Apr 23 09:46:53 2018 +0100 @@ -57,9 +57,6 @@ */ abstract class AnnotationClassLoader implements LoaderInterface { - /** - * @var Reader - */ protected $reader; /** @@ -72,11 +69,6 @@ */ protected $defaultRouteIndex = 0; - /** - * Constructor. - * - * @param Reader $reader - */ public function __construct(Reader $reader) { $this->reader = $reader; @@ -127,6 +119,12 @@ } } + if (0 === $collection->count() && $class->hasMethod('__invoke') && $annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) { + $globals['path'] = ''; + $globals['name'] = ''; + $this->addRoute($collection, $annot, $globals, $class, $class->getMethod('__invoke')); + } + return $collection; } @@ -136,6 +134,7 @@ if (null === $name) { $name = $this->getDefaultRouteName($class, $method); } + $name = $globals['name'].$name; $defaults = array_replace($globals['defaults'], $annot->getDefaults()); foreach ($method->getParameters() as $param) { @@ -217,9 +216,14 @@ 'methods' => array(), 'host' => '', 'condition' => '', + 'name' => '', ); if ($annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) { + if (null !== $annot->getName()) { + $globals['name'] = $annot->getName(); + } + if (null !== $annot->getPath()) { $globals['path'] = $annot->getPath(); }