[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;
|
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) {
|
if ($callable instanceof \Closure) {
|
||||||
$data['type'] = 'closure';
|
$data['type'] = $this->formatClosure($callable);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,8 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($callable instanceof \Closure) {
|
if ($callable instanceof \Closure) {
|
||||||
$string .= "\n- Type: `closure`";
|
$formatted = $this->formatClosure($callable);
|
||||||
|
$string .= "\n- Type: `$formatted`";
|
||||||
|
|
||||||
return $this->write($string."\n");
|
return $this->write($string."\n");
|
||||||
}
|
}
|
||||||
|
@ -466,7 +466,13 @@ class TextDescriptor extends Descriptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($callable instanceof \Closure) {
|
if ($callable instanceof \Closure) {
|
||||||
return '\Closure()';
|
$formatted = $this->formatClosure($callable);
|
||||||
|
|
||||||
|
if ('closure' === $formatted) {
|
||||||
|
return '\Closure()';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $formatted.'()';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (method_exists($callable, '__invoke')) {
|
if (method_exists($callable, '__invoke')) {
|
||||||
|
@ -593,7 +593,7 @@ class XmlDescriptor extends Descriptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($callable instanceof \Closure) {
|
if ($callable instanceof \Closure) {
|
||||||
$callableXML->setAttribute('type', 'closure');
|
$callableXML->setAttribute('type', $this->formatClosure($callable));
|
||||||
|
|
||||||
return $dom;
|
return $dom;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user