From 33243a4b9688d7ca9559decfe51041c123a41626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Tue, 1 Mar 2016 14:15:48 +0100 Subject: [PATCH 1/8] Upgrade to reflection-docblock 3 --- composer.json | 2 +- .../Doubler/ClassPatch/MagicCallPatch.php | 38 ++++++++++++++----- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index f190867e6..062d1ad6c 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ ], "require": { "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "~2.0", + "phpdocumentor/reflection-docblock": "~3.0", "sebastian/comparator": "~1.1", "doctrine/instantiator": "^1.0.2", "sebastian/recursion-context": "~1.0" diff --git a/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php b/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php index e33d2ed43..fd93c4790 100644 --- a/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php +++ b/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php @@ -11,7 +11,10 @@ namespace Prophecy\Doubler\ClassPatch; -use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlock\Tags\Method; +use phpDocumentor\Reflection\DocBlockFactory; +use phpDocumentor\Reflection\DocBlockFactoryInterface; +use phpDocumentor\Reflection\Types\ContextFactory; use Prophecy\Doubler\Generator\Node\ClassNode; use Prophecy\Doubler\Generator\Node\MethodNode; @@ -19,9 +22,19 @@ * Discover Magical API using "@method" PHPDoc format. * * @author Thomas Tourlourat + * @author Kévin Dunglas */ class MagicCallPatch implements ClassPatchInterface { + private $docBlockFactory; + private $contextFactory; + + public function __construct() + { + $this->docBlockFactory = DocBlockFactory::createInstance(); + $this->contextFactory = new ContextFactory(); + } + /** * Support any class * @@ -44,23 +57,30 @@ public function apply(ClassNode $node) $parentClass = $node->getParentClass(); $reflectionClass = new \ReflectionClass($parentClass); - $phpdoc = new DocBlock($reflectionClass->getDocComment()); + try { + $phpdoc = $this->docBlockFactory->create($reflectionClass, $this->contextFactory->createFromReflector($reflectionClass)); + } catch (\InvalidArgumentException $e) { + // No DocBlock + } - $tagList = $phpdoc->getTagsByName('method'); + /** + * @var Method[] $tagList + */ + $tagList = isset($phpdoc) ? $phpdoc->getTagsByName('method') : array(); $interfaces = $reflectionClass->getInterfaces(); foreach($interfaces as $interface) { - $phpdoc = new DocBlock($interface); - $tagList = array_merge($tagList, $phpdoc->getTagsByName('method')); + try { + $phpdoc = $this->docBlockFactory->create($interface, $this->contextFactory->createFromReflector($interface)); + $tagList = array_merge($tagList, $phpdoc->getTagsByName('method')); + } catch (\InvalidArgumentException $e) { + // No DocBlock + } } foreach($tagList as $tag) { $methodName = $tag->getMethodName(); - if (empty($methodName)) { - continue; - } - if (!$reflectionClass->hasMethod($methodName)) { $methodNode = new MethodNode($tag->getMethodName()); $methodNode->setStatic($tag->isStatic()); From 671b5effd9b7b4094b505b1ab2963089eca59887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Tue, 1 Mar 2016 19:44:59 +0100 Subject: [PATCH 2/8] Fix @stof and @sroze comments --- src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php b/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php index fd93c4790..ca41b2b7e 100644 --- a/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php +++ b/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php @@ -59,15 +59,12 @@ public function apply(ClassNode $node) try { $phpdoc = $this->docBlockFactory->create($reflectionClass, $this->contextFactory->createFromReflector($reflectionClass)); + $tagList = $phpdoc->getTagsByName('method'); } catch (\InvalidArgumentException $e) { // No DocBlock + $tagList = array(); } - /** - * @var Method[] $tagList - */ - $tagList = isset($phpdoc) ? $phpdoc->getTagsByName('method') : array(); - $interfaces = $reflectionClass->getInterfaces(); foreach($interfaces as $interface) { try { @@ -81,6 +78,10 @@ public function apply(ClassNode $node) foreach($tagList as $tag) { $methodName = $tag->getMethodName(); + if (empty($methodName)) { + continue; + } + if (!$reflectionClass->hasMethod($methodName)) { $methodNode = new MethodNode($tag->getMethodName()); $methodNode->setStatic($tag->isStatic()); From d3e7b563bfc48da8c616d59ce603a9d3ca034922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Wed, 16 Mar 2016 23:10:42 +0000 Subject: [PATCH 3/8] Add backward compatibility --- .travis.yml | 12 ++- composer.json | 2 +- .../Doubler/ClassPatch/MagicCallPatch.php | 78 ++++++++++++++----- 3 files changed, 70 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index 555f041aa..ee2b44f19 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,16 @@ branches: - /^feature\/.*$/ - /^optimization\/.*$/ -before_script: travis_retry composer install --no-interaction +matrix: + fast_finish: true + include: + - php: '7.0' + env: PHPDOCUMENTOR_REFLECTION_DOCBLOCK="~2.0" + +before_script: + - if [ -n "$PHPDOCUMENTOR_REFLECTION_DOCBLOCK" ]; then + composer require "phpdocumentor/reflection-docblock:${PHPDOCUMENTOR_REFLECTION_DOCBLOCK}" --no-update; + fi; + - travis_retry composer update --no-interaction script: vendor/bin/phpspec run -fpretty -v diff --git a/composer.json b/composer.json index 062d1ad6c..ce7d70866 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ ], "require": { "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "~3.0", + "phpdocumentor/reflection-docblock": "~2.0|~3.0", "sebastian/comparator": "~1.1", "doctrine/instantiator": "^1.0.2", "sebastian/recursion-context": "~1.0" diff --git a/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php b/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php index ca41b2b7e..c38fbc393 100644 --- a/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php +++ b/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php @@ -11,6 +11,10 @@ namespace Prophecy\Doubler\ClassPatch; +use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock\Tag as LegacyTag; +use phpDocumentor\Reflection\DocBlock\Tag\MethodTag as LegacyMethodTag; use phpDocumentor\Reflection\DocBlock\Tags\Method; use phpDocumentor\Reflection\DocBlockFactory; use phpDocumentor\Reflection\DocBlockFactoryInterface; @@ -23,16 +27,26 @@ * * @author Thomas Tourlourat * @author Kévin Dunglas + * @author Théo FIDRY */ class MagicCallPatch implements ClassPatchInterface { + /** + * @var DocBlockFactory|null + */ private $docBlockFactory; + + /** + * @var ContextFactory|null + */ private $contextFactory; public function __construct() { - $this->docBlockFactory = DocBlockFactory::createInstance(); - $this->contextFactory = new ContextFactory(); + if (class_exists('phpDocumentor\Reflection\DocBlockFactory') && class_exists('phpDocumentor\Reflection\Types\ContextFactory')) { + $this->docBlockFactory = DocBlockFactory::createInstance(); + $this->contextFactory = new ContextFactory(); + } } /** @@ -57,25 +71,13 @@ public function apply(ClassNode $node) $parentClass = $node->getParentClass(); $reflectionClass = new \ReflectionClass($parentClass); - try { - $phpdoc = $this->docBlockFactory->create($reflectionClass, $this->contextFactory->createFromReflector($reflectionClass)); - $tagList = $phpdoc->getTagsByName('method'); - } catch (\InvalidArgumentException $e) { - // No DocBlock - $tagList = array(); - } - - $interfaces = $reflectionClass->getInterfaces(); - foreach($interfaces as $interface) { - try { - $phpdoc = $this->docBlockFactory->create($interface, $this->contextFactory->createFromReflector($interface)); - $tagList = array_merge($tagList, $phpdoc->getTagsByName('method')); - } catch (\InvalidArgumentException $e) { - // No DocBlock - } - } + $tagList = array_merge( + $this->getClassTagList($reflectionClass), + $this->getClassInterfacesTagList($reflectionClass) + ); foreach($tagList as $tag) { + /* @var LegacyMethodTag|Method $tag */ $methodName = $tag->getMethodName(); if (empty($methodName)) { @@ -83,7 +85,7 @@ public function apply(ClassNode $node) } if (!$reflectionClass->hasMethod($methodName)) { - $methodNode = new MethodNode($tag->getMethodName()); + $methodNode = new MethodNode($methodName); $methodNode->setStatic($tag->isStatic()); $node->addMethod($methodNode); @@ -100,5 +102,41 @@ public function getPriority() { return 50; } + + /** + * @param \ReflectionClass $reflectionClass + * + * @return LegacyTag[] + */ + private function getClassInterfacesTagList(\ReflectionClass $reflectionClass) + { + $interfaces = $reflectionClass->getInterfaces(); + $tagList = array(); + + foreach($interfaces as $interface) { + $tagList = array_merge($tagList, $this->getClassTagList($interface)); + } + + return $tagList; + } + + /** + * @param \ReflectionClass $reflectionClass + * + * @return LegacyMethodTag[]|Method[] + */ + private function getClassTagList(\ReflectionClass $reflectionClass) + { + try { + $phpdoc = (null === $this->docBlockFactory || null === $this->contextFactory) + ? new DocBlock($reflectionClass->getDocComment()) + : $this->docBlockFactory->create($reflectionClass, $this->contextFactory->createFromReflector($reflectionClass)) + ; + + return $phpdoc->getTagsByName('method'); + } catch (\InvalidArgumentException $e) { + return array(); + } + } } From 6d73d78b8f85f91babcfc579e997d3ec321e1f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Thu, 17 Mar 2016 10:06:06 +0000 Subject: [PATCH 4/8] Add tag retriever --- .../Doubler/ClassPatch/MagicCallPatch.php | 69 ++---------------- .../ClassAndInterfaceTagRetriever.php | 70 +++++++++++++++++++ .../PhpDocumentor/ClassTagRetriever.php | 50 +++++++++++++ .../PhpDocumentor/LegacyClassTagRetriever.php | 33 +++++++++ .../MethodTagRetrieverInterface.php | 28 ++++++++ 5 files changed, 187 insertions(+), 63 deletions(-) create mode 100644 src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php create mode 100644 src/Prophecy/PhpDocumentor/ClassTagRetriever.php create mode 100644 src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php create mode 100644 src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php diff --git a/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php b/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php index c38fbc393..6c0ad0835 100644 --- a/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php +++ b/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php @@ -11,16 +11,10 @@ namespace Prophecy\Doubler\ClassPatch; -use phpDocumentor\Reflection\DocBlock; -use phpDocumentor\Reflection\DocBlock\Tag; -use phpDocumentor\Reflection\DocBlock\Tag as LegacyTag; -use phpDocumentor\Reflection\DocBlock\Tag\MethodTag as LegacyMethodTag; -use phpDocumentor\Reflection\DocBlock\Tags\Method; -use phpDocumentor\Reflection\DocBlockFactory; -use phpDocumentor\Reflection\DocBlockFactoryInterface; -use phpDocumentor\Reflection\Types\ContextFactory; use Prophecy\Doubler\Generator\Node\ClassNode; use Prophecy\Doubler\Generator\Node\MethodNode; +use Prophecy\PhpDocumentor\ClassAndInterfaceTagRetriever; +use Prophecy\PhpDocumentor\MethodTagRetrieverInterface; /** * Discover Magical API using "@method" PHPDoc format. @@ -31,22 +25,11 @@ */ class MagicCallPatch implements ClassPatchInterface { - /** - * @var DocBlockFactory|null - */ - private $docBlockFactory; - - /** - * @var ContextFactory|null - */ - private $contextFactory; + private $tagRetriever; - public function __construct() + public function __construct(MethodTagRetrieverInterface $tagRetriever = null) { - if (class_exists('phpDocumentor\Reflection\DocBlockFactory') && class_exists('phpDocumentor\Reflection\Types\ContextFactory')) { - $this->docBlockFactory = DocBlockFactory::createInstance(); - $this->contextFactory = new ContextFactory(); - } + $this->tagRetriever = (null === $tagRetriever) ? new ClassAndInterfaceTagRetriever() : $tagRetriever; } /** @@ -71,13 +54,9 @@ public function apply(ClassNode $node) $parentClass = $node->getParentClass(); $reflectionClass = new \ReflectionClass($parentClass); - $tagList = array_merge( - $this->getClassTagList($reflectionClass), - $this->getClassInterfacesTagList($reflectionClass) - ); + $tagList = $this->tagRetriever->getTagList($reflectionClass); foreach($tagList as $tag) { - /* @var LegacyMethodTag|Method $tag */ $methodName = $tag->getMethodName(); if (empty($methodName)) { @@ -102,41 +81,5 @@ public function getPriority() { return 50; } - - /** - * @param \ReflectionClass $reflectionClass - * - * @return LegacyTag[] - */ - private function getClassInterfacesTagList(\ReflectionClass $reflectionClass) - { - $interfaces = $reflectionClass->getInterfaces(); - $tagList = array(); - - foreach($interfaces as $interface) { - $tagList = array_merge($tagList, $this->getClassTagList($interface)); - } - - return $tagList; - } - - /** - * @param \ReflectionClass $reflectionClass - * - * @return LegacyMethodTag[]|Method[] - */ - private function getClassTagList(\ReflectionClass $reflectionClass) - { - try { - $phpdoc = (null === $this->docBlockFactory || null === $this->contextFactory) - ? new DocBlock($reflectionClass->getDocComment()) - : $this->docBlockFactory->create($reflectionClass, $this->contextFactory->createFromReflector($reflectionClass)) - ; - - return $phpdoc->getTagsByName('method'); - } catch (\InvalidArgumentException $e) { - return array(); - } - } } diff --git a/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php b/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php new file mode 100644 index 000000000..86fa5f203 --- /dev/null +++ b/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php @@ -0,0 +1,70 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\PhpDocumentor; + +use phpDocumentor\Reflection\DocBlock\Tag\MethodTag as LegacyMethodTag; +use phpDocumentor\Reflection\DocBlock\Tags\Method; + +/** + * @author Théo FIDRY + */ +final class ClassAndInterfaceTagRetriever implements MethodTagRetrieverInterface +{ + /** + * @var MethodTagRetrieverInterface + */ + private $classRetriever; + + public function __construct(MethodTagRetrieverInterface $classRetriever = null) + { + if (null !== $classRetriever) { + $this->classRetriever = $classRetriever; + + return; + } + + $this->classRetriever = (class_exists('phpDocumentor\Reflection\DocBlockFactory') && class_exists('phpDocumentor\Reflection\Types\ContextFactory')) + ? new ClassTagRetriever() + : new LegacyClassTagRetriever() + ; + } + + /** + * @param \ReflectionClass $reflectionClass + * + * @return LegacyMethodTag[]|Method[] + */ + public function getTagList(\ReflectionClass $reflectionClass) + { + return array_merge( + $this->getTagList($reflectionClass), + $this->getInterfacesTagList($reflectionClass) + ); + } + + /** + * @param \ReflectionClass $reflectionClass + * + * @return LegacyMethodTag[]|Method[] + */ + private function getInterfacesTagList(\ReflectionClass $reflectionClass) + { + $interfaces = $reflectionClass->getInterfaces(); + $tagList = array(); + + foreach($interfaces as $interface) { + $tagList = array_merge($tagList, $this->getTagList($interface)); + } + + return $tagList; + } +} diff --git a/src/Prophecy/PhpDocumentor/ClassTagRetriever.php b/src/Prophecy/PhpDocumentor/ClassTagRetriever.php new file mode 100644 index 000000000..5debab510 --- /dev/null +++ b/src/Prophecy/PhpDocumentor/ClassTagRetriever.php @@ -0,0 +1,50 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\PhpDocumentor; + +use phpDocumentor\Reflection\DocBlock\Tags\Method; +use phpDocumentor\Reflection\DocBlockFactory; +use phpDocumentor\Reflection\Types\ContextFactory; + +/** + * @author Théo FIDRY + */ +final class ClassTagRetriever implements MethodTagRetrieverInterface +{ + private $docBlockFactory; + private $contextFactory; + + public function __construct() + { + $this->docBlockFactory = DocBlockFactory::createInstance(); + $this->contextFactory = new ContextFactory(); + } + + /** + * @param \ReflectionClass $reflectionClass + * + * @return Method[] + */ + public function getTagList(\ReflectionClass $reflectionClass) + { + try { + $phpdoc = $this->docBlockFactory->create( + $reflectionClass, + $this->contextFactory->createFromReflector($reflectionClass) + ); + + return $phpdoc->getTagsByName('method'); + } catch (\InvalidArgumentException $e) { + return array(); + } + } +} diff --git a/src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php b/src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php new file mode 100644 index 000000000..18817130c --- /dev/null +++ b/src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php @@ -0,0 +1,33 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\PhpDocumentor; + +use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlock\Tag\MethodTag as LegacyMethodTag; + +/** + * @author Théo FIDRY + */ +final class LegacyClassTagRetriever implements MethodTagRetrieverInterface +{ + /** + * @param \ReflectionClass $reflectionClass + * + * @return LegacyMethodTag[] + */ + public function getTagList(\ReflectionClass $reflectionClass) + { + $phpdoc = new DocBlock($reflectionClass->getDocComment()); + + return $phpdoc->getTagsByName('method'); + } +} diff --git a/src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php b/src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php new file mode 100644 index 000000000..1fd223823 --- /dev/null +++ b/src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php @@ -0,0 +1,28 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\PhpDocumentor; + +use phpDocumentor\Reflection\DocBlock\Tag\MethodTag as LegacyMethodTag; +use phpDocumentor\Reflection\DocBlock\Tags\Method; + +/** + * @author Théo FIDRY + */ +interface MethodTagRetrieverInterface +{ + /** + * @param \ReflectionClass $reflectionClass + * + * @return LegacyMethodTag[]|Method[] + */ + public function getTagList(\ReflectionClass $reflectionClass); +} From ff2743f914672ebe2f05606fc8dcb376dd3b3af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Fri, 25 Mar 2016 18:28:35 +0000 Subject: [PATCH 5/8] Minor fix --- .../PhpDocumentor/ClassAndInterfaceTagRetriever.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php b/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php index 86fa5f203..5ef727a67 100644 --- a/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php +++ b/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php @@ -19,9 +19,6 @@ */ final class ClassAndInterfaceTagRetriever implements MethodTagRetrieverInterface { - /** - * @var MethodTagRetrieverInterface - */ private $classRetriever; public function __construct(MethodTagRetrieverInterface $classRetriever = null) @@ -32,7 +29,7 @@ public function __construct(MethodTagRetrieverInterface $classRetriever = null) return; } - $this->classRetriever = (class_exists('phpDocumentor\Reflection\DocBlockFactory') && class_exists('phpDocumentor\Reflection\Types\ContextFactory')) + $this->classRetriever = class_exists('phpDocumentor\Reflection\DocBlockFactory') && class_exists('phpDocumentor\Reflection\Types\ContextFactory') ? new ClassTagRetriever() : new LegacyClassTagRetriever() ; @@ -46,7 +43,7 @@ public function __construct(MethodTagRetrieverInterface $classRetriever = null) public function getTagList(\ReflectionClass $reflectionClass) { return array_merge( - $this->getTagList($reflectionClass), + $this->classRetriever->getTagList($reflectionClass), $this->getInterfacesTagList($reflectionClass) ); } @@ -62,7 +59,7 @@ private function getInterfacesTagList(\ReflectionClass $reflectionClass) $tagList = array(); foreach($interfaces as $interface) { - $tagList = array_merge($tagList, $this->getTagList($interface)); + $tagList = array_merge($tagList, $this->classRetriever->getTagList($interface)); } return $tagList; From 3ab224557971642772e8e1f955f9214eda1badcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Fri, 25 Mar 2016 18:41:26 +0000 Subject: [PATCH 6/8] Remove unneeded paranthesis --- src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php b/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php index 6c0ad0835..23891c098 100644 --- a/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php +++ b/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php @@ -29,7 +29,7 @@ class MagicCallPatch implements ClassPatchInterface public function __construct(MethodTagRetrieverInterface $tagRetriever = null) { - $this->tagRetriever = (null === $tagRetriever) ? new ClassAndInterfaceTagRetriever() : $tagRetriever; + $this->tagRetriever = null === $tagRetriever ? new ClassAndInterfaceTagRetriever() : $tagRetriever; } /** From 2a3f7cadaffc0428d13587ed6b1c3fb60fb8ca28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Mon, 30 May 2016 16:30:00 +0200 Subject: [PATCH 7/8] Mark tag retrievers as internal --- src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php | 2 ++ src/Prophecy/PhpDocumentor/ClassTagRetriever.php | 2 ++ src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php | 2 ++ src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php | 2 ++ 4 files changed, 8 insertions(+) diff --git a/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php b/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php index 5ef727a67..209821ce9 100644 --- a/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php +++ b/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php @@ -16,6 +16,8 @@ /** * @author Théo FIDRY + * + * @internal */ final class ClassAndInterfaceTagRetriever implements MethodTagRetrieverInterface { diff --git a/src/Prophecy/PhpDocumentor/ClassTagRetriever.php b/src/Prophecy/PhpDocumentor/ClassTagRetriever.php index 5debab510..1d2da8f03 100644 --- a/src/Prophecy/PhpDocumentor/ClassTagRetriever.php +++ b/src/Prophecy/PhpDocumentor/ClassTagRetriever.php @@ -17,6 +17,8 @@ /** * @author Théo FIDRY + * + * @internal */ final class ClassTagRetriever implements MethodTagRetrieverInterface { diff --git a/src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php b/src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php index 18817130c..c0dec3de8 100644 --- a/src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php +++ b/src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php @@ -16,6 +16,8 @@ /** * @author Théo FIDRY + * + * @internal */ final class LegacyClassTagRetriever implements MethodTagRetrieverInterface { diff --git a/src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php b/src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php index 1fd223823..d3989dad5 100644 --- a/src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php +++ b/src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php @@ -16,6 +16,8 @@ /** * @author Théo FIDRY + * + * @internal */ interface MethodTagRetrieverInterface { From 9a81b72b82b8072c61c7c8132d8a5a1300a18c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Mon, 30 May 2016 15:54:40 +0200 Subject: [PATCH 8/8] Require phpdocumentor/reflection-docblock ^3.0.2 --- .travis.yml | 2 +- composer.json | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index ee2b44f19..e75c39eff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ matrix: fast_finish: true include: - php: '7.0' - env: PHPDOCUMENTOR_REFLECTION_DOCBLOCK="~2.0" + env: PHPDOCUMENTOR_REFLECTION_DOCBLOCK="^2.0" before_script: - if [ -n "$PHPDOCUMENTOR_REFLECTION_DOCBLOCK" ]; then diff --git a/composer.json b/composer.json index ce7d70866..23131b201 100644 --- a/composer.json +++ b/composer.json @@ -16,16 +16,17 @@ "email": "marcello.duarte@gmail.com" } ], + "require": { "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "~2.0|~3.0", - "sebastian/comparator": "~1.1", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1", "doctrine/instantiator": "^1.0.2", - "sebastian/recursion-context": "~1.0" + "sebastian/recursion-context": "^1.0" }, "require-dev": { - "phpspec/phpspec": "~2.0" + "phpspec/phpspec": "^2.0" }, "autoload": {