Navigation Menu

Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/3273' into develop
Browse files Browse the repository at this point in the history
Forward port #3273
  • Loading branch information
weierophinney committed Jan 3, 2013
2 parents cfffbe3 + 24cb9e6 commit 5e94a37
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .php_cs
@@ -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);
2 changes: 1 addition & 1 deletion library/Zend/Code/Reflection/DocBlockReflection.php
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Code/Scanner/DocBlockScanner.php
Expand Up @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions tests/.php_cs
@@ -0,0 +1,6 @@
<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
->notName('TestSampleClass10.php')
->in(__DIR__);
return Symfony\CS\Config\Config::create()
->finder($finder);
24 changes: 24 additions & 0 deletions tests/ZendTest/Code/Reflection/DocBlockReflectionTest.php
Expand Up @@ -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');
Expand Down
56 changes: 56 additions & 0 deletions tests/ZendTest/Code/Reflection/TestAsset/TestSampleClass10.php
@@ -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.