diff --git a/.php_cs b/.php_cs new file mode 100644 index 00000000000..94afcb44f15 --- /dev/null +++ b/.php_cs @@ -0,0 +1,7 @@ +notName('TestSampleClass10.php') + ->in(__DIR__); +return Symfony\CS\Config\Config::create() + ->finder($finder); diff --git a/library/Zend/Code/Reflection/DocBlockReflection.php b/library/Zend/Code/Reflection/DocBlockReflection.php index bed98a9c51c..f646e2cd33d 100644 --- a/library/Zend/Code/Reflection/DocBlockReflection.php +++ b/library/Zend/Code/Reflection/DocBlockReflection.php @@ -245,7 +245,7 @@ protected function reflect() $docComment = $this->docComment; // localize variable // create a clean docComment - $this->cleanDocComment = preg_replace('#[ \t]*(?:\/\*\*|\*\/|\*)?[ ]{0,1}(.*)?#', '$1', $docComment); + $this->cleanDocComment = preg_replace("#[ \t]*(?:/\*\*|\*/|\*)[ ]{0,1}(.*)?#", '$1', $docComment); $this->cleanDocComment = ltrim($this->cleanDocComment, "\r\n"); // @todo should be changed to remove first and last empty line diff --git a/library/Zend/Code/Scanner/DocBlockScanner.php b/library/Zend/Code/Scanner/DocBlockScanner.php index c088ef6167c..c23df7aaac1 100644 --- a/library/Zend/Code/Scanner/DocBlockScanner.php +++ b/library/Zend/Code/Scanner/DocBlockScanner.php @@ -269,7 +269,7 @@ protected function tokenize() goto TOKENIZER_TOP; } - if ($currentChar === ' ') { + if ($currentChar === ' ' || $currentChar === "\t") { $MACRO_TOKEN_SET_TYPE(($context & $CONTEXT_INSIDE_ASTERISK) ? 'DOCBLOCK_WHITESPACE' : 'DOCBLOCK_WHITESPACE_INDENT'); $MACRO_TOKEN_APPEND_WORD(); $MACRO_TOKEN_ADVANCE(); diff --git a/tests/.php_cs b/tests/.php_cs new file mode 100644 index 00000000000..8749485f95f --- /dev/null +++ b/tests/.php_cs @@ -0,0 +1,6 @@ +notName('TestSampleClass10.php') + ->in(__DIR__); +return Symfony\CS\Config\Config::create() + ->finder($finder); diff --git a/tests/ZendTest/Code/Reflection/DocBlockReflectionTest.php b/tests/ZendTest/Code/Reflection/DocBlockReflectionTest.php index 3e8e91739ca..d804bfa2c43 100644 --- a/tests/ZendTest/Code/Reflection/DocBlockReflectionTest.php +++ b/tests/ZendTest/Code/Reflection/DocBlockReflectionTest.php @@ -66,6 +66,30 @@ public function testDocBlockTags() } + public function testTabbedDocBlockTags() + { + $classReflection = new ClassReflection('ZendTest\Code\Reflection\TestAsset\TestSampleClass10'); + + $this->assertEquals(3, count($classReflection->getDocBlock()->getTags())); + $this->assertEquals(1, count($classReflection->getDocBlock()->getTags('author'))); + $this->assertEquals(1, count($classReflection->getDocBlock()->getTags('property'))); + $this->assertEquals(1, count($classReflection->getDocBlock()->getTags('method'))); + + $methodTag = $classReflection->getDocBlock()->getTag('method'); + $this->assertInstanceOf('Zend\Code\Reflection\DocBlock\Tag\MethodTag', $methodTag); + + $propertyTag = $classReflection->getDocBlock()->getTag('property'); + $this->assertInstanceOf('Zend\Code\Reflection\DocBlock\Tag\PropertyTag', $propertyTag); + + $this->assertFalse($classReflection->getDocBlock()->getTag('version')); + + $this->assertTrue($classReflection->getMethod('doSomething')->getDocBlock()->hasTag('return')); + + $returnTag = $classReflection->getMethod('doSomething')->getDocBlock()->getTag('return'); + $this->assertInstanceOf('Zend\Code\Reflection\DocBlock\Tag\TagInterface', $returnTag); + $this->assertEquals('mixed', $returnTag->getType()); + } + public function testDocBlockLines() { //$this->markTestIncomplete('Line numbers incomplete'); diff --git a/tests/ZendTest/Code/Reflection/TestAsset/TestSampleClass10.php b/tests/ZendTest/Code/Reflection/TestAsset/TestSampleClass10.php new file mode 100644 index 00000000000..1c082e334ab --- /dev/null +++ b/tests/ZendTest/Code/Reflection/TestAsset/TestSampleClass10.php @@ -0,0 +1,56 @@ + + * @method test() + * @property $test + */ +class TestSampleClass10 +{ + + /** + * Method ShortDescription + * + * Method LongDescription + * This is a long description for + * the docblock of this class, it + * should be longer than 3 lines. + * It indeed is longer than 3 lines + * now. + * + * @param int $one Description for one + * @param int Description for two + * @param string $three Description for three + * which spans multiple lines + * @return mixed Some return descr + */ + public function doSomething($one, $two = 2, $three = 'three') + { + return 'mixedValue'; + } + + /** + * Method ShortDescription + * + * @param int $one Description for one + * @param int Description for two + * @param string $three Description for three + * which spans multiple lines + * @return int + */ + public function doSomethingElse($one, $two = 2, $three = 'three') + { + return 'mixedValue'; + } + +}