bug #22422 [FrameworkBundle][Console][EventDispatcher] Fixed debug:event command (lyrixx)
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle][Console][EventDispatcher] Fixed debug:event command
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
---
before:
![screenshot5](https://cloud.githubusercontent.com/assets/408368/25013888/bcd561ba-2075-11e7-8538-b977420640d2.png)
after:
![screenshot6](https://cloud.githubusercontent.com/assets/408368/25013894/c2bc9332-2075-11e7-97f6-ebfcca70b23b.png)
Commits
-------
9960b7e
[FrameworkBundle][Console][EventDispatcher] Fixed debug:event command
This commit is contained in:
commit
1674f9218b
@ -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,9 +466,15 @@ class TextDescriptor extends Descriptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($callable instanceof \Closure) {
|
if ($callable instanceof \Closure) {
|
||||||
|
$formatted = $this->formatClosure($callable);
|
||||||
|
|
||||||
|
if ('closure' === $formatted) {
|
||||||
return '\Closure()';
|
return '\Closure()';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $formatted.'()';
|
||||||
|
}
|
||||||
|
|
||||||
if (method_exists($callable, '__invoke')) {
|
if (method_exists($callable, '__invoke')) {
|
||||||
return sprintf('%s::__invoke()', get_class($callable));
|
return sprintf('%s::__invoke()', get_class($callable));
|
||||||
}
|
}
|
||||||
|
@ -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