Skip to content

Commit

Permalink
Fixes #354 Add class_exists before aliasing class (#356)
Browse files Browse the repository at this point in the history
* Use 3.5.x branch

* Update CHANGELOG.md

* Fix PHP-CS issues

* Improve changelog message

Co-authored-by: Alessandro Lai <[email protected]>
  • Loading branch information
annuh and Jean85 authored Jul 8, 2020
1 parent fcdd644 commit 6817cde
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## Unreleased
- Use `jean85/pretty-package-versions` `^1.5` to leverage the new `getRootPackageVersion` method (c8799ac)
- Fix support for PHP preloading (#354, thanks to @annuh)

## 3.5.1 (2020-05-07)
- Capture events using the `Hub` in the `MessengerListener` to avoid loosing `Scope` data (#339, thanks to @sh41)
Expand Down
16 changes: 12 additions & 4 deletions src/EventListener/RequestListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@
use Symfony\Component\Security\Core\User\UserInterface;

if (Kernel::MAJOR_VERSION >= 5) {
class_alias(RequestEvent::class, RequestListenerRequestEvent::class);
class_alias(ControllerEvent::class, RequestListenerControllerEvent::class);
if (! class_exists(RequestListenerRequestEvent::class, false)) {
class_alias(RequestEvent::class, RequestListenerRequestEvent::class);
}
if (! class_exists(RequestListenerControllerEvent::class, false)) {
class_alias(ControllerEvent::class, RequestListenerControllerEvent::class);
}
} else {
class_alias(GetResponseEvent::class, RequestListenerRequestEvent::class);
class_alias(FilterControllerEvent::class, RequestListenerControllerEvent::class);
if (! class_exists(RequestListenerRequestEvent::class, false)) {
class_alias(GetResponseEvent::class, RequestListenerRequestEvent::class);
}
if (! class_exists(RequestListenerControllerEvent::class, false)) {
class_alias(FilterControllerEvent::class, RequestListenerControllerEvent::class);
}
}

/**
Expand Down

0 comments on commit 6817cde

Please sign in to comment.