summaryrefslogtreecommitdiffstats
path: root/php-phpdocumentor-reflection-docblock-pr113.patch
blob: 50b11f8d4ce42d05807fe688bbdbaacf0efe8710 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From 358daaf824d8f6e1acc56eee40127f4bd4153051 Mon Sep 17 00:00:00 2001
From: Roberto Espinoza <roberto.espinoza@nature.com>
Date: Mon, 7 Aug 2017 12:56:26 +0900
Subject: [PATCH] Check tag body has a value before trying to access it as an
 string array

---
 src/DocBlock/StandardTagFactory.php                | 2 +-
 tests/integration/DocblocksWithAnnotationsTest.php | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php
index 786caef..8efd84e 100644
--- a/src/DocBlock/StandardTagFactory.php
+++ b/src/DocBlock/StandardTagFactory.php
@@ -113,7 +113,7 @@ public function create($tagLine, TypeContext $context = null)
 
         list($tagName, $tagBody) = $this->extractTagParts($tagLine);
 
-        if ($tagBody[0] === '[') {
+        if ($tagBody !== '' && $tagBody[0] === '[') {
             throw new \InvalidArgumentException(
                 'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors'
             );
diff --git a/tests/integration/DocblocksWithAnnotationsTest.php b/tests/integration/DocblocksWithAnnotationsTest.php
index 3c40f4f..6db1604 100644
--- a/tests/integration/DocblocksWithAnnotationsTest.php
+++ b/tests/integration/DocblocksWithAnnotationsTest.php
@@ -23,6 +23,7 @@ public function testDocblockWithAnnotations()
             /**
      * @var \DateTime[]
      * @Groups({"a", "b"})
+     * @ORM\Entity
      */
 DOCCOMMENT;
 
@@ -30,6 +31,6 @@ public function testDocblockWithAnnotations()
         $factory  = DocBlockFactory::createInstance();
         $docblock = $factory->create($docComment);
 
-        $this->assertCount(2, $docblock->getTags());
+        $this->assertCount(3, $docblock->getTags());
     }
 }