-
Notifications
You must be signed in to change notification settings - Fork 1
Fix: PHP 8.3 compatibility #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
e501987
727193b
f3f460d
d46423b
d4583ef
2bcfc1a
5678036
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -75,7 +75,7 @@ public function setExceptionHandler(IExceptionHandler $exceptionHandler) | |||||
| * @param string $eventName The name of the event to dispatch. The name of the event is the name of the method that is invoked on listeners. | ||||||
| * @param \Doctrine\Common\EventArgs $eventArgs The event arguments to pass to the event handlers/listeners. If not supplied, the single empty EventArgs instance is used | ||||||
| */ | ||||||
| public function dispatchEvent($eventName, DoctrineEventArgs $eventArgs = NULL) | ||||||
| public function dispatchEvent(string $eventName, ?DoctrineEventArgs $eventArgs = NULL): void | ||||||
| { | ||||||
| if ($this->panel) { | ||||||
| $this->panel->eventDispatch($eventName, $eventArgs); | ||||||
|
|
@@ -118,7 +118,7 @@ public function dispatchEvent($eventName, DoctrineEventArgs $eventArgs = NULL) | |||||
| * @param string|null $eventName | ||||||
| * @return \Doctrine\Common\EventSubscriber[]|callable[]|\Doctrine\Common\EventSubscriber[][]|callable[][] | ||||||
| */ | ||||||
| public function getListeners($eventName = NULL) | ||||||
| public function getListeners(string $eventName = NULL): array | ||||||
|
||||||
| public function getListeners(string $eventName = NULL): array | |
| public function getListeners(?string $eventName = NULL): array |
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typing the subscriber as object prevents using callable listeners (e.g., closures or array callables) that may have been supported previously. If callable listeners are still intended to be supported, widen the type to callable|object and handle callables accordingly.
| public function addEventListener(string|array $events, object $subscriber, $priority = 0): void | |
| public function addEventListener(string|array $events, $subscriber, $priority = 0): void |
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This narrows the API and removes previously supported inputs (e.g., EventSubscriber or Closure as the first argument), as indicated by the removed instanceof checks. To preserve backward compatibility, either reintroduce handling for EventSubscriber/Closure (delegating to removeEventSubscriber/extractCallable) or widen the signature to accept callable|object for the subscriber and detect EventSubscriber when passed as the first parameter.
| public function removeEventListener(string|array $unsubscribe, object $subscriber = NULL): void | |
| public function removeEventListener(string|array $unsubscribe, $subscriber = NULL): void |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -50,7 +50,7 @@ public function setPanel(Panel $panel) | |||||
| /** | ||||||
| * {@inheritdoc} | ||||||
| */ | ||||||
| public function getListeners($eventName = NULL) | ||||||
| public function getListeners(string $eventName = NULL): array | ||||||
|
||||||
| public function getListeners(string $eventName = NULL): array | |
| public function getListeners(?string $eventName = NULL): array |
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new signature drops support for passing EventSubscriber or Closure as the first parameter, which the previous implementation handled. Consider restoring that behavior (e.g., detect EventSubscriber/Closure and delegate) or widen accepted types to callable|object for compatibility.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -40,7 +40,7 @@ public function __construct($namespace, EventManager $eventManager) | |||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * {@inheritDoc} | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| public function dispatchEvent($eventName, DoctrineEventArgs $eventArgs = NULL) | ||||||||||||||||||||||
| public function dispatchEvent(string $eventName, ?DoctrineEventArgs $eventArgs = NULL): void | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| [$ns, $event] = Event::parseName($eventName); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -54,7 +54,7 @@ public function dispatchEvent($eventName, DoctrineEventArgs $eventArgs = NULL) | |||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * {@inheritDoc} | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| public function getListeners($eventName = NULL) | ||||||||||||||||||||||
| public function getListeners(string $eventName = null): array | ||||||||||||||||||||||
|
||||||||||||||||||||||
| public function getListeners(string $eventName = null): array | |
| public function getListeners(?string $eventName = null): array |
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new object-only subscriber type excludes callable listeners. If callables are valid in this layer, change the parameter type to callable|object and adapt usage accordingly.
| public function addEventListener(string|array $events, object $subscriber, $priority = 0): void | |
| public function addEventListener(string|array $events, callable|object $subscriber, $priority = 0): void |
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This narrows the accepted types and removes the previous convenience of passing an EventSubscriber as the first argument (the conversion block was removed). To avoid breaking existing usage, either re-add the EventSubscriber handling or provide/route through a removeEventSubscriber method in this class.
| public function removeEventListener(string|array $unsubscribe, object $subscriber = NULL): void | |
| { | |
| public function removeEventListener(string|array|EventSubscriber $unsubscribe, object $subscriber = NULL): void | |
| { | |
| // Backward compatibility: allow passing EventSubscriber as first argument | |
| if ($unsubscribe instanceof EventSubscriber) { | |
| $events = $unsubscribe->getSubscribedEvents(); | |
| $this->evm->removeEventListener($events, $unsubscribe); | |
| return; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These abstract signatures no longer allow callable listeners and will force downstream implementations to reject closures/array callables. If callable listeners are part of the supported API, widen these to callable|object to keep the interface compatible with implementations.