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

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
blanchonvincent committed Oct 11, 2013
1 parent cf954b9 commit 032d604
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
5 changes: 3 additions & 2 deletions library/Zend/Code/Reflection/FunctionReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function getContents($includeDocBlock = true)
'Cannot determine internals functions contents'
);
}

return implode("\n",
array_splice(
file($fileName),
Expand Down Expand Up @@ -136,7 +137,7 @@ public function getBody()
);

$functionLine = implode("\n", $lines);

$body = false;
if ($this->isClosure()) {
preg_match('#function\s*\([^\)]*\)\s*\{(.*\;)\s*\}#s', $functionLine, $matches);
Expand All @@ -150,7 +151,7 @@ public function getBody()
$body = $matches[1];
}
}

return $body;
}

Expand Down
20 changes: 10 additions & 10 deletions tests/ZendTest/Code/Reflection/FunctionReflectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,28 @@ public function testFunctionBodyReturn()
$function = new FunctionReflection('ZendTest\Code\Reflection\TestAsset\function6');
$body = $function->getBody();
$this->assertEquals("\$closure = function() { return 'bar'; };\n return 'function6';", trim($body));

$function = new FunctionReflection('ZendTest\Code\Reflection\TestAsset\function7');
$body = $function->getBody();
$this->assertEquals("return 'function7';", trim($body));

$function = new FunctionReflection('ZendTest\Code\Reflection\TestAsset\function8');
$body = $function->getBody();
$this->assertEquals("return 'function8';", trim($body));

$function = new FunctionReflection('ZendTest\Code\Reflection\TestAsset\function9');
$body = $function->getBody();
$this->assertEquals("return 'function9';", trim($body));

$function = new FunctionReflection('ZendTest\Code\Reflection\TestAsset\function10');
$body = $function->getBody();
$this->assertEquals("\$closure = function() { return 'function10'; }; return \$closure();", trim($body));

$function = new FunctionReflection('ZendTest\Code\Reflection\TestAsset\function11');
$body = $function->getBody();
$this->assertEquals("return 'function11';", trim($body));
}

public function testFunctionClosureBodyReturn()
{
require_once __DIR__ . '/TestAsset/closures.php';
Expand All @@ -103,23 +103,23 @@ public function testFunctionClosureBodyReturn()
$function = new FunctionReflection($function4);
$body = $function->getBody();
$this->assertEquals("\$closure = function() { return 'bar'; };\n return 'function4';", trim($body));

$function5 = $list1['closure'];
$function = new FunctionReflection($function5);
$body = $function->getBody();
$this->assertEquals("return 'function5';", trim($body));

$function6 = $list2[0];
$function = new FunctionReflection($function6);
$body = $function->getBody();
$this->assertEquals("return 'function6';", trim($body));

$function7 = $list3[0];
$function = new FunctionReflection($function7);
$body = $function->getBody();
$this->assertEquals("return \$c = function() { return 'function7'; }; return \$c();", trim($body));
}

public function testInternalFunctionContentsReturn()
{
$function = new FunctionReflection('array_splice');
Expand Down
1 change: 0 additions & 1 deletion tests/ZendTest/Code/Reflection/TestAsset/closures.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Code
*/

namespace ZendTest\Code\Reflection\TestAsset;
Expand Down
1 change: 0 additions & 1 deletion tests/ZendTest/Code/Reflection/TestAsset/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Code
*/

namespace ZendTest\Code\Reflection\TestAsset;
Expand Down

0 comments on commit 032d604

Please sign in to comment.