Skip to content

Commit 3829c3b

Browse files
committed
Merge branch '5.4' into 6.2
* 5.4: Update "Web debug toolbar" profiler docs Fix incorrect example for CommandCompletionTester
2 parents 74ee5c7 + d0ecbbc commit 3829c3b

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

console/input.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,9 @@ to help you unit test the completion logic::
399399
$suggestions = $tester->complete(['']);
400400
$this->assertSame(['Fabien', 'Fabrice', 'Wouter'], $suggestions);
401401

402-
// complete the input with "Fa" as input
402+
// If you filter the values inside your own code (not recommended, unless you
403+
// need to improve performance of e.g. a database query), you can test this
404+
// by passing the user input
403405
$suggestions = $tester->complete(['Fa']);
404406
$this->assertSame(['Fabien', 'Fabrice'], $suggestions);
405407
}

profiler.rst

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,23 +189,35 @@ production. To do that, create an :doc:`event subscriber </event_dispatcher>`
189189
and listen to the :ref:`kernel.response <component-http-kernel-kernel-response>`
190190
event::
191191

192+
193+
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
192194
use Symfony\Component\HttpKernel\Event\ResponseEvent;
195+
use Symfony\Component\HttpKernel\KernelInterface;
193196

194197
// ...
195-
196-
public function onKernelResponse(ResponseEvent $event)
198+
199+
class MySubscriber implements EventSubscriberInterface
197200
{
198-
if (!$event->getKernel()->isDebug()) {
199-
return;
201+
public function __construct(private KernelInterface $kernel)
202+
{
200203
}
204+
205+
// ...
201206

202-
$request = $event->getRequest();
203-
if (!$request->isXmlHttpRequest()) {
204-
return;
205-
}
207+
public function onKernelResponse(ResponseEvent $event)
208+
{
209+
if (!$this->kernel->isDebug()) {
210+
return;
211+
}
206212

207-
$response = $event->getResponse();
208-
$response->headers->set('Symfony-Debug-Toolbar-Replace', 1);
213+
$request = $event->getRequest();
214+
if (!$request->isXmlHttpRequest()) {
215+
return;
216+
}
217+
218+
$response = $event->getResponse();
219+
$response->headers->set('Symfony-Debug-Toolbar-Replace', 1);
220+
}
209221
}
210222

211223
.. index::

0 commit comments

Comments
 (0)