maj+ header
This commit is contained in:
+20
-20
@@ -31,24 +31,13 @@ class ReflectionCaster
|
||||
'isVariadic' => 'isVariadic',
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 2.7, to be removed in 3.0.
|
||||
*/
|
||||
public static function castReflector(\Reflector $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
$a[Caster::PREFIX_VIRTUAL.'reflection'] = $c->__toString();
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castClosure(\Closure $c, array $a, Stub $stub, $isNested)
|
||||
public static function castClosure(\Closure $c, array $a, Stub $stub, $isNested, $filter = 0)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
$c = new \ReflectionFunction($c);
|
||||
|
||||
$stub->class = 'Closure'; // HHVM generates unique class names for closures
|
||||
$a = static::castFunctionAbstract($c, $a, $stub, $isNested);
|
||||
$a = static::castFunctionAbstract($c, $a, $stub, $isNested, $filter);
|
||||
|
||||
if (isset($a[$prefix.'parameters'])) {
|
||||
foreach ($a[$prefix.'parameters']->value as &$v) {
|
||||
@@ -63,8 +52,8 @@ class ReflectionCaster
|
||||
}
|
||||
}
|
||||
|
||||
if ($f = $c->getFileName()) {
|
||||
$a[$prefix.'file'] = $f;
|
||||
if (!($filter & Caster::EXCLUDE_VERBOSE) && $f = $c->getFileName()) {
|
||||
$a[$prefix.'file'] = new LinkStub($f, $c->getStartLine());
|
||||
$a[$prefix.'line'] = $c->getStartLine().' to '.$c->getEndLine();
|
||||
}
|
||||
|
||||
@@ -133,7 +122,7 @@ class ReflectionCaster
|
||||
$function = new FrameStub($frame, false, true);
|
||||
$function = ExceptionCaster::castFrameStub($function, array(), $function, true);
|
||||
$a[$prefix.'executing'] = new EnumStub(array(
|
||||
$frame['class'].$frame['type'].$frame['function'].'()' => $function[$prefix.'src'],
|
||||
"\0~separator= \0".$frame['class'].$frame['type'].$frame['function'].'()' => $function[$prefix.'src'],
|
||||
));
|
||||
}
|
||||
|
||||
@@ -185,7 +174,10 @@ class ReflectionCaster
|
||||
if (isset($a[$prefix.'returnType'])) {
|
||||
$v = $a[$prefix.'returnType'];
|
||||
$v = $v instanceof \ReflectionNamedType ? $v->getName() : $v->__toString();
|
||||
$a[$prefix.'returnType'] = $a[$prefix.'returnType']->allowsNull() ? '?'.$v : $v;
|
||||
$a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType']->allowsNull() ? '?'.$v : $v, array(class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', ''));
|
||||
}
|
||||
if (isset($a[$prefix.'class'])) {
|
||||
$a[$prefix.'class'] = new ClassStub($a[$prefix.'class']);
|
||||
}
|
||||
if (isset($a[$prefix.'this'])) {
|
||||
$a[$prefix.'this'] = new CutStub($a[$prefix.'this']);
|
||||
@@ -207,7 +199,11 @@ class ReflectionCaster
|
||||
|
||||
if ($v = $c->getStaticVariables()) {
|
||||
foreach ($v as $k => &$v) {
|
||||
$a[$prefix.'use']['$'.$k] = &$v;
|
||||
if (\is_object($v)) {
|
||||
$a[$prefix.'use']['$'.$k] = new CutStub($v);
|
||||
} else {
|
||||
$a[$prefix.'use']['$'.$k] = &$v;
|
||||
}
|
||||
}
|
||||
unset($v);
|
||||
$a[$prefix.'use'] = new EnumStub($a[$prefix.'use']);
|
||||
@@ -251,7 +247,11 @@ class ReflectionCaster
|
||||
} elseif (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $c, $v)) {
|
||||
$a[$prefix.'typeHint'] = $v[1];
|
||||
}
|
||||
if (!isset($a[$prefix.'typeHint'])) {
|
||||
|
||||
if (isset($a[$prefix.'typeHint'])) {
|
||||
$v = $a[$prefix.'typeHint'];
|
||||
$a[$prefix.'typeHint'] = new ClassStub($v, array(class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', ''));
|
||||
} else {
|
||||
unset($a[$prefix.'allowsNull']);
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ class ReflectionCaster
|
||||
$x = isset($a[Caster::PREFIX_VIRTUAL.'extra']) ? $a[Caster::PREFIX_VIRTUAL.'extra']->value : array();
|
||||
|
||||
if (method_exists($c, 'getFileName') && $m = $c->getFileName()) {
|
||||
$x['file'] = $m;
|
||||
$x['file'] = new LinkStub($m, $c->getStartLine());
|
||||
$x['line'] = $c->getStartLine().' to '.$c->getEndLine();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user