Last active
August 29, 2015 14:05
-
-
Save fabre-thibaud/5a83eaed823067075c23 to your computer and use it in GitHub Desktop.
HHVM \ReflectionFunction::getStaticVariables() incompatibility with PHP 5.4 -> 5.6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//See https://travis-ci.org/aztech-digital/closure-scope-merger/builds/33884775 for output containing test case | |
class ReflectionTest extends \PHPUnit_Framework_TestCase | |
{ | |
public function testReflectionFunctionRefVars() | |
{ | |
$refVariable = false; | |
$refName = 'refVariable'; | |
$callback = function() use (& $refVariable) | |
{ | |
// Stub callback to get a "by-ref" variable in reflection function static vars | |
}; | |
$function = new \ReflectionFunction($callback); | |
$staticVariables = $function->getStaticVariables(); | |
$this->assertTrue(array_key_exists($refName, $staticVariables)); | |
$this->assertTrue($refVariable === false); | |
$staticVariables[$refName] = true; | |
$this->assertTrue($refVariable === true, 'Static variables from reflection should be bound to current scope.'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment