From b33dd952e5a349fd555d9c6a63356d96d4d1b5cd Mon Sep 17 00:00:00 2001 From: Petr Schefzu Date: Wed, 11 Jan 2017 12:08:57 +0100 Subject: [PATCH 1/2] Enable use alias in annotation use Dingo\Blueprint\Annotation as BP; use Dingo\Blueprint\Annotation\Method as BPM; /** * @BP\Resource("Test") */ class TestController extends Controller { /** * Ask for new service * * @BPM\Get("/test") * @BP\Versions({"v1"}) */ public function test(){ } } --- src/Blueprint.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Blueprint.php b/src/Blueprint.php index b95a66e..87face9 100644 --- a/src/Blueprint.php +++ b/src/Blueprint.php @@ -15,7 +15,7 @@ class Blueprint /** * Simple annotation reader instance. * - * @var \Doctrine\Common\Annotations\SimpleAnnotationReader + * @var \Doctrine\Common\Annotations\AnnotationReader */ protected $reader; @@ -36,12 +36,12 @@ class Blueprint /** * Create a new generator instance. * - * @param \Doctrine\Common\Annotations\SimpleAnnotationReader $reader + * @param \Doctrine\Common\Annotations\AnnotationReader $reader * @param \Illuminate\Filesystem\Filesystem $files * * @return void */ - public function __construct(SimpleAnnotationReader $reader, Filesystem $files) + public function __construct(AnnotationReader $reader, Filesystem $files) { $this->reader = $reader; $this->files = $files; @@ -56,9 +56,6 @@ public function __construct(SimpleAnnotationReader $reader, Filesystem $files) */ protected function registerAnnotationLoader() { - $this->reader->addNamespace('Dingo\\Blueprint\\Annotation'); - $this->reader->addNamespace('Dingo\\Blueprint\\Annotation\\Method'); - AnnotationRegistry::registerLoader(function ($class) { $path = __DIR__.'/'.str_replace(['Dingo\\Blueprint\\', '\\'], ['', DIRECTORY_SEPARATOR], $class).'.php'; From 35e6c57c71856c63e282a8694ba7a5468076acd0 Mon Sep 17 00:00:00 2001 From: Petr Schefzu Date: Wed, 7 Jun 2017 11:06:20 +0200 Subject: [PATCH 2/2] Update Blueprint.php --- src/Blueprint.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Blueprint.php b/src/Blueprint.php index 87face9..4fc1778 100644 --- a/src/Blueprint.php +++ b/src/Blueprint.php @@ -8,14 +8,14 @@ use Illuminate\Support\Collection; use Illuminate\Filesystem\Filesystem; use Doctrine\Common\Annotations\AnnotationRegistry; -use Doctrine\Common\Annotations\SimpleAnnotationReader; +use Doctrine\Common\Annotations\Reader; class Blueprint { /** * Simple annotation reader instance. * - * @var \Doctrine\Common\Annotations\AnnotationReader + * @var \Doctrine\Common\Annotations\Reader */ protected $reader; @@ -36,12 +36,12 @@ class Blueprint /** * Create a new generator instance. * - * @param \Doctrine\Common\Annotations\AnnotationReader $reader + * @param \Doctrine\Common\Annotations\Reader $reader * @param \Illuminate\Filesystem\Filesystem $files * * @return void */ - public function __construct(AnnotationReader $reader, Filesystem $files) + public function __construct(Reader $reader, Filesystem $files) { $this->reader = $reader; $this->files = $files;