8000 --- · githubfromgui/symfony-docs@8119968 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8119968

Browse files
committed
---
yaml --- r: 73430 b: refs/heads/5.x c: ca8980e h: refs/heads/5.x
1 parent 4014ede commit 8119968

File tree

5 files changed

+28
-18
lines changed

5 files changed

+28
-18
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,4 @@ refs/heads/3.3: 93587037fef6a2f40e0cbdea41754e1e76255fe6
9292
refs/heads/weaverryan-patch-1: a52aee3dceba3357dd59558677811a2ff86d1357
9393
refs/heads/4.0: e887a8b5e5d102235545837506f1d4e883f051a5
9494
refs/heads/4.1: 67f3845bc17a81379c609af1944099706e5b429e
95-
refs/heads/5.x: 6166cfab85402876e9f50a0f7837868fbe027a86
95+
refs/heads/5.x: ca8980edf53ada122195eddabae5e36d01f0bd8d

trunk/event_dispatcher.rst

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ The most common way to listen to an event is to register an **event listener**::
2727
namespace App\EventListener;
2828

2929
use Symfony\Component\HttpFoundation\Response;
30-
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
30+
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
3131
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
3232

3333
class ExceptionListener
3434
{
35-
public function onKernelException(GetResponseForExceptionEvent $event)
35+
public function onKernelException(ExceptionEvent $event)
3636
{
3737
// You get the exception object from the received event
3838
$exception = $event->getException();
@@ -63,10 +63,16 @@ The most common way to listen to an event is to register an **event listener**::
6363
.. tip::
6464

6565
Each event receives a slightly different type of ``$event`` object. For
66-
the ``kernel.exception`` event, it is :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent`.
66+
the ``kernel.exception`` event, it is :class:`Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent`.
6767
Check out the :doc:`Symfony events reference </reference/events>` to see
6868
what type of object each event provides.
6969

70+
.. versionadded::
71+
72+
The :class:`Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent` class was
73+
introduced in Symfony 4.3. In previous versions it was called
74+
``Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent``.
75+
7076
Now that the class is created, you need to register it as a service and
7177
n 10000 otify Symfony that it is a "listener" on the ``kernel.exception`` event by
7278
using a special "tag":
@@ -151,7 +157,7 @@ listen to the same ``kernel.exception`` event::
151157
namespace App\EventSubscriber;
152158

153159
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
154-
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
160+
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
155161
use Symfony\Component\HttpKernel\KernelEvents;
156162

157163
class ExceptionSubscriber implements EventSubscriberInterface
@@ -168,17 +174,17 @@ listen to the same ``kernel.exception`` event::
168174
];
169175
}
170176

171-
public function processException(GetResponseForExceptionEvent $event)
177+
public function processException(ExceptionEvent $event)
172178
{
173179
// ...
174180
}
175181

176-
public function logException(GetResponseForExceptionEvent $event)
182+
public function logException(ExceptionEvent $event)
177183
{
178184
// ...
179185
}
180186

181-
public function notifyException(GetResponseForExceptionEvent $event)
187+
public function notifyException(ExceptionEvent $event)
182188
{
183189
// ...
184190
}
@@ -207,11 +213,11 @@ or a "sub request"::
207213
// src/EventListener/RequestListener.php
208214
namespace App\EventListener;
209215

210-
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
216+
use Symfony\Component\HttpKernel\Event\RequestEvent;
211217

212218
class RequestListener
213219
{
214-
public function onKernelRequest(GetResponseEvent $event)
220+
public function onKernelRequest(RequestEvent $event)
215221
{
216222
if (!$event->isMasterRequest()) {
217223
// don't do anything if it's not the master request

trunk/frontend.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,6 @@ Other Front-End Articles
109109
.. _`Webpack`: https://webpack.js.org/
110110
.. _`Webpacker`: https://github.com/rails/webpacker
111111
.. _`Mix`: https://laravel.com/docs/mix
112-
.. _`Symfony`: http://symfony.com/
112+
.. _`Symfony`: https://symfony.com/
113113
.. _`Full API`: https://github.com/symfony/webpack-encore/blob/master/index.js
114114
.. _`Webpack Encore screencast series`: https://symfonycasts.com/screencast/webpack-encore

trunk/profiler.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ which provides utilities to profile code and displays the results on the
9797

9898
When using :ref:`autowiring <services-autowire>`, type-hint any argument with
9999
the :class:`Symfony\\Component\\Stopwatch\\Stopwatch` class and Symfony will
100-
inject the Stopwatch service. Then, use the ``start()``, ``lapse()`` and
100+
inject the Stopwatch service. Then, use the ``start()``, ``lap()`` and
101101
``stop()`` methods to measure time::
102102

103103
// a user signs up and the timer starts...
104104
$stopwatch->start('user-sign-up');
105105

106106
// ...do things to sign up the user...
107-
$stopwatch->lapse('user-sign-up');
107+
$stopwatch->lap('user-sign-up');
108108

109109
// ...the sign up process is finished
110110
$stopwatch->stop('user-sign-up');

trunk/setup/built_in_web_server.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@
44
How to Use PHP's built-in Web Server
55
====================================
66

7+
.. deprecated:: 4.4
8+
9+
This article explains how to use the WebServerBundle to run Symfony
10+
applications on your local computer. However, that bundle is deprecated
11+
since Symfony 4.4 and will be removed in Symfony 5.0.
12+
13+
Instead of using WebServerBundle, the preferred way to run your Symfony
14+
applications locally is to use the :doc:`Symfony Local Web Server </setup/symfony_server>`.
15+
716
The PHP CLI SAPI comes with a `built-in web server`_. It can be used to run your
817
PHP applications locally during development, for testing or for application
918
demonstrations. This way, you don't have to bother configuring a full-featured
1019
web server such as :doc:`Apache or Nginx </setup/web_server_configuration>`.
1120

12-
.. tip::
13-
14-
The preferred way to develop your Symfony application is to use
15-
:doc:`Symfony Local Web Server </setup/symfony_server>`.
16-
1721
.. caution::
1822

1923
The built-in web server is meant to be run in a controlled environment.

0 commit comments

Comments
 (0)
0