Permalink
Browse files

Merge branch 'hotfix/3273' into develop

Forward port #3273
  • Loading branch information...
2 parents cfffbe3 + 24cb9e6 commit 5e94a3795e8eeff7e506d54b99d1bf52ff38c546 @weierophinney weierophinney committed Jan 3, 2013
View
@@ -0,0 +1,7 @@
+<?php
+echo "Loading " . __FILE__ . "\n";
+$finder = Symfony\CS\Finder\DefaultFinder::create()
+ ->notName('TestSampleClass10.php')
+ ->in(__DIR__);
+return Symfony\CS\Config\Config::create()
+ ->finder($finder);
@@ -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
@@ -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();
View
@@ -0,0 +1,6 @@
+<?php
+$finder = Symfony\CS\Finder\DefaultFinder::create()
+ ->notName('TestSampleClass10.php')
+ ->in(__DIR__);
+return Symfony\CS\Config\Config::create()
+ ->finder($finder);
@@ -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');
@@ -0,0 +1,56 @@
+<?php
+
+namespace ZendTest\Code\Reflection\TestAsset;
+
+/**
+ * TestSampleClass10 DocBlock Short Desc
+ *
+ * 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.
+ *
+ * @author Ralph Schindler <ralph.schindler@zend.com>
+ * @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';
+ }
+
+}

0 comments on commit 5e94a37

Please sign in to comment.