minor #14866 Updated UPGRADE-2.4.md (mickaelandrieu)

This PR was submitted for the 2.8 branch but it was merged into the 2.6 branch instead (closes #14866).

Discussion
----------

Updated UPGRADE-2.4.md

| Q             | A
| ------------- | ---
| Bug fix?      | [no]
| New feature?  | [no]
| BC breaks?    | [no]
| Deprecations? | [yes ?]
| Tests pass?   | [yes]
| Fixed tickets |
| License       | MIT
| Doc PR        |

A missing deprecation in the upgrade guide.

Commits
-------

b631a56 Updated UPGRADE-2.4.md
This commit is contained in:
Fabien Potencier 2015-06-08 16:44:58 +02:00
commit 6fcdcb509a
1 changed files with 41 additions and 0 deletions

View File

@ -7,3 +7,44 @@ Form
* The constructor parameter `$precision` in `IntegerToLocalizedStringTransformer`
is now ignored completely, because a precision does not make sense for
integers.
EventDispatcher
----------------
* The `getDispatcher()` and `getName()` methods from `Symfony\Component\EventDispatcher\Event`
are deprecated, the event dispatcher instance and event name can be received in the listener call instead.
Before:
```php
use Symfony\Component\EventDispatcher\Event;
class Foo
{
public function myFooListener(Event $event)
{
$dispatcher = $event->getDispatcher();
$eventName = $event->getName();
$dispatcher->dispatch('log', $event);
// ... more code
}
}
```
After:
```php
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class Foo
{
public function myFooListener(Event $event, $eventName, EventDispatcherInterface $dispatcher)
{
$dispatcher->dispatch('log', $event);
// ... more code
}
}
```