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

Commit

Permalink
ZF-6996: backport r20617 to trunk
Browse files Browse the repository at this point in the history
git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20618 44c647ce-9c0f-0410-b52a-842ac1e357ba
  • Loading branch information
matthew committed Jan 25, 2010
1 parent 6a25cb7 commit 0f218d1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Reflection/Function/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ protected function _reflect()
// Get param types and description
if (preg_match_all('/@param\s+([^\s]+)/m', $docBlock, $matches)) {
$paramTypesTmp = $matches[1];
if (preg_match_all('/@param\s+\S+\s+(\$^\S+)\s+(.*?)(@|\*\/)/s', $docBlock, $matches))
if (preg_match_all('/@param\s+\S+\s+(\$\S+)\s+(.*?)(@|\*\/)/s', $docBlock, $matches))
{
$paramDesc = $matches[2];
foreach ($paramDesc as $key => $value) {
Expand Down
20 changes: 17 additions & 3 deletions test/Reflection/FunctionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
* @version $Id$
*/

require_once dirname(__FILE__) . '/../../../TestHelper.php';
require_once 'Zend/Server/Reflection/Function.php';
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'PHPUnit/Framework/IncompleteTestError.php';

/**
* Test case for Zend_Server_Reflection_Function
Expand Down Expand Up @@ -164,14 +163,29 @@ public function testMultipleWhitespaceBetweenDoctagsAndTypes()
$this->assertEquals(1, count($params));
$this->assertEquals('string', $params[0]->getType());
}

/**
* @group ZF-6996
*/
public function testParameterReflectionShouldReturnTypeAndVarnameAndDescription()
{
$function = new ReflectionFunction('Zend_Server_Reflection_FunctionTest_function');
$r = new Zend_Server_Reflection_Function($function);

$prototypes = $r->getPrototypes();
$prototype = $prototypes[0];
$params = $prototype->getParameters();
$param = $params[0];
$this->assertContains('Some description', $param->getDescription(), var_export($param, 1));
}
}

/**
* Zend_Server_Reflection_FunctionTest_function
*
* Test function for reflection unit tests
*
* @param string $var1
* @param string $var1 Some description
* @param string|array $var2
* @param array $var3
* @return null|array
Expand Down

0 comments on commit 0f218d1

Please # to comment.