[FrameworkBundle][Console][EventDispatcher] Fixed debug:event command
This commit is contained in:
parent
4f0daa740a
commit
9960b7e1d4
@ -311,4 +311,15 @@ abstract class Descriptor implements DescriptorInterface
|
||||
|
||||
return $serviceIds;
|
||||
}
|
||||
|
||||
protected function formatClosure(\Closure $closure)
|
||||
{
|
||||
$r = new \ReflectionFunction($closure);
|
||||
|
||||
if (preg_match('#^/\*\* @closure-proxy ([^: ]++)::([^: ]++) \*/$#', $r->getDocComment(), $m)) {
|
||||
return sprintf('%s::%s', $m[1], $m[2]);
|
||||
}
|
||||
|
||||
return 'closure';
|
||||
}
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ class JsonDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
if ($callable instanceof \Closure) {
|
||||
$data['type'] = 'closure';
|
||||
$data['type'] = $this->formatClosure($callable);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
@ -343,7 +343,8 @@ class MarkdownDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
if ($callable instanceof \Closure) {
|
||||
$string .= "\n- Type: `closure`";
|
||||
$formatted = $this->formatClosure($callable);
|
||||
$string .= "\n- Type: `$formatted`";
|
||||
|
||||
return $this->write($string."\n");
|
||||
}
|
||||
|
@ -466,9 +466,15 @@ class TextDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
if ($callable instanceof \Closure) {
|
||||
$formatted = $this->formatClosure($callable);
|
||||
|
||||
if ('closure' === $formatted) {
|
||||
return '\Closure()';
|
||||
}
|
||||
|
||||
return $formatted.'()';
|
||||
}
|
||||
|
||||
if (method_exists($callable, '__invoke')) {
|
||||
return sprintf('%s::__invoke()', get_class($callable));
|
||||
}
|
||||
|
@ -593,7 +593,7 @@ class XmlDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
if ($callable instanceof \Closure) {
|
||||
$callableXML->setAttribute('type', 'closure');
|
||||
$callableXML->setAttribute('type', $this->formatClosure($callable));
|
||||
|
||||
return $dom;
|
||||
}
|
||||
|
Reference in New Issue
Block a user