10000 minor #37669 [EventDispatcher] Minor: Avoid not needed null check in … · symfony/symfony@4105e93 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4105e93

Browse files
committed
minor #37669 [EventDispatcher] Minor: Avoid not needed null check in dispatch() (brainexe)
This PR was merged into the 5.2-dev branch. Discussion ---------- [EventDispatcher] Minor: Avoid not needed null check in dispatch() | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | no | License | MIT | Doc PR | - Just found a not needed null check in the heavyly called EventDispatcher::dispatch() method - the $eventName get's always a string now - no null anymore, as it gets the class name instead. Commits ------- 0d36c11 [EventDispatcher] Avoid not needed null check in dispatch()
2 parents f76ac74 + 0d36c11 commit 4105e93

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/EventDispatcher/EventDispatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function dispatch(object $event, string $eventName = null): object
4949
{
5050
$eventName = $eventName ?? \get_class($event);
5151

52-
if (null !== $this->optimized && null !== $eventName) {
52+
if (null !== $this->optimized) {
5353
$listeners = $this->optimized[$eventName] ?? (empty($this->listeners[$eventName]) ? [] : $this->optimizeListeners($eventName));
5454
} else {
5555
$listeners = $this->getListeners($eventName);

0 commit comments

Comments
 (0)
0