From 3a5b4f6c5cb3054fd1a510f482719cea8fbf482f Mon Sep 17 00:00:00 2001 From: Yudha Setiawan Date: Tue, 14 Jun 2016 01:04:15 +0700 Subject: [PATCH] [docblock] Upgrade phpDocumentor\Reflection\DocBlock to ~3.1.0 Fixes #77 --- composer.json | 2 +- src/Ladybug/Type/Object/Container.php | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 8e1568a..0180ceb 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "phpunit/phpunit": "~4.0", "mockery/mockery": "0.9.1", "symfony/dom-crawler": ">=2.0.4", - "phpdocumentor/reflection-docblock": "2.0.0", + "phpdocumentor/reflection-docblock": "~3.1.0", "jms/serializer": ">=0.11.0" }, "suggest": { diff --git a/src/Ladybug/Type/Object/Container.php b/src/Ladybug/Type/Object/Container.php index cf741fd..e6afbf6 100644 --- a/src/Ladybug/Type/Object/Container.php +++ b/src/Ladybug/Type/Object/Container.php @@ -372,10 +372,15 @@ protected function loadClassMethods(\ReflectionClass $reflectedObject) // phpdoc comment if (class_exists('\phpDocumentor\Reflection\DocBlock')) { - $phpdoc = new \phpDocumentor\Reflection\DocBlock($reflectedMethod->getDocComment()); + $docComment = $reflectedMethod->getDocComment(); - $method->setShortDescription($phpdoc->getShortDescription()); - $method->setLongDescription($phpdoc->getLongDescription()); + if (is_string($docComment)) { + $phpdocFactory = \phpDocumentor\Reflection\DocBlockFactory::createInstance(); + $phpdoc = $phpdocFactory->create($docComment); + + $method->setShortDescription($phpdoc->getSummary()); + $method->setLongDescription((string) $phpdoc->getDescription()); + } } // parameters