Skip to content

Commit dd32e7f

Browse files
committed
Merge branch '2.5' into 2.6
* 2.5: Update filesystem readme.md to include exists method Add machine readable events [HttpKernel][2.6] Adding support for invokable controllers in the RequestDataCollector fixed typo [Translations] Added missing Hebrew language trans-unit sources [DependencyInjection] inlined factory not referenced Fixed case for empty folder Fixed whitespace control for password form widget [Routing] correctly initialize condition as string
2 parents fc4bd90 + c7aaf59 commit dd32e7f

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

DataCollector/RequestDataCollector.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ public function collect(Request $request, Response $response, \Exception $except
147147
'file' => $r->getFilename(),
148148
'line' => $r->getStartLine(),
149149
);
150+
} elseif (is_object($controller)) {
151+
$r = new \ReflectionClass($controller);
152+
$this->data['controller'] = array(
153+
'class' => $r->getName(),
154+
'method' => null,
155+
'file' => $r->getFileName(),
156+
'line' => $r->getStartLine(),
157+
);
150158
} else {
151159
$this->data['controller'] = (string) $controller ?: 'n/a';
152160
}

KernelEvents.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ final class KernelEvents
2929
* receives a Symfony\Component\HttpKernel\Event\GetResponseEvent
3030
* instance.
3131
*
32+
* @Event
33+
*
3234
* @var string
3335
*
3436
* @api
@@ -43,6 +45,8 @@ final class KernelEvents
4345
* a Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent
4446
* instance.
4547
*
48+
* @Event
49+
*
4650
* @var string
4751
*
4852
* @api
@@ -58,6 +62,8 @@ final class KernelEvents
5862
* Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent
5963
* instance.
6064
*
65+
* @Event
66+
*
6167
* @var string
6268
*
6369
* @api
@@ -72,6 +78,8 @@ final class KernelEvents
7278
* request. The event listener method receives a
7379
* Symfony\Component\HttpKernel\Event\FilterControllerEvent instance.
7480
*
81+
* @Event
82+
*
7583
* @var string
7684
*
7785
* @api
@@ -86,6 +94,8 @@ final class KernelEvents
8694
* replied. The event listener method receives a
8795
* Symfony\Component\HttpKernel\Event\FilterResponseEvent instance.
8896
*
97+
* @Event
98+
*
8999
* @var string
90100
*
91101
* @api
@@ -99,6 +109,8 @@ final class KernelEvents
99109
* The event listener method receives a
100110
* Symfony\Component\HttpKernel\Event\PostResponseEvent instance.
101111
*
112+
* @Event
113+
*
102114
* @var string
103115
*/
104116
const TERMINATE = 'kernel.terminate';

Tests/DataCollector/RequestDataCollectorTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function testControllerInspection()
5959
// make sure we always match the line number
6060
$r1 = new \ReflectionMethod($this, 'testControllerInspection');
6161
$r2 = new \ReflectionMethod($this, 'staticControllerMethod');
62+
$r3 = new \ReflectionClass($this);
6263
// test name, callable, expected
6364
$controllerTests = array(
6465
array(
@@ -132,6 +133,17 @@ function () { return 'foo'; },
132133
'line' => 'n/a',
133134
),
134135
),
136+
137+
array(
138+
'Invokable controller',
139+
$this,
140+
array(
141+
'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest',
142+
'method' => null,
143+
'file' => __FILE__,
144+
'line' => $r3->getStartLine(),
145+
),
146+
),
135147
);
136148

137149
$c = new RequestDataCollector();
@@ -202,4 +214,9 @@ public static function __callStatic($method, $args)
202214
{
203215
throw new \LogicException('Unexpected method call');
204216
}
217+
218+
public function __invoke()
219+
{
220+
throw new \LogicException('Unexpected method call');
221+
}
205222
}

0 commit comments

Comments
 (0)