From a41a31f8c8de32eecf5048be739f934114831274 Mon Sep 17 00:00:00 2001 From: Christoph Harms-Ensink Date: Thu, 19 Jan 2017 16:56:08 +0100 Subject: [PATCH] UPDATE Method.php, MethodTest.php - try to make the if-condition php 7.2.0-compatible - correct docBlock for the test method --- src/DocBlock/Tags/Method.php | 2 +- tests/unit/DocBlock/Tags/MethodTest.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index 061e815..5a5d22d 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -128,7 +128,7 @@ final class Method extends BaseTag implements Factory\StaticMethod $returnType = $typeResolver->resolve($returnType, $context); $description = $descriptionFactory->create($description, $context); - if ('' !== $arguments) { + if (is_string($arguments) && strlen($arguments) > 0) { $arguments = explode(',', $arguments); foreach($arguments as &$argument) { $argument = explode(' ', self::stripRestArg(trim($argument)), 2); diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index ca6436c..5e7ec2a 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -277,6 +277,13 @@ class MethodTest extends \PHPUnit_Framework_TestCase $this->assertSame($description, $fixture->getDescription()); } + /** + * @covers ::create + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method:: + * @uses \phpDocumentor\Reflection\TypeResolver + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\Types\Context + */ public function testReturnTypeThis() { $descriptionFactory = m::mock(DescriptionFactory::class);