mirror of
https://github.com/doctrine/event-manager.git
synced 2026-03-23 22:32:21 +01:00
Introduce EventManagerInterface
In theory, having small interfaces is great, but in practice, migrating
the ORM to them would involve DNF types, which are not available with
PHP 8.1, for use in e.g. the constructor of EntityManager.
public function __construct(
private Connection $conn,
private Configuration $config,
- EventManager|null $eventManager = null,
+ (EventListenerIntrospector&EventListenerRegistry&EventSubscriberRegistry)|null $eventManager = null,
) {
This commit is contained in:
@@ -17,6 +17,10 @@
|
||||
|
||||
<rule ref="Doctrine" />
|
||||
|
||||
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix">
|
||||
<exclude-pattern>src/EventManagerInterface.php</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint">
|
||||
<!-- This interface is commonly implemented by userland code.
|
||||
We omit the return type to ease the migration to 2.0 -->
|
||||
|
||||
@@ -11,10 +11,7 @@ use function spl_object_id;
|
||||
* Listeners are registered on the manager and events are dispatched through the
|
||||
* manager.
|
||||
*/
|
||||
class EventManager implements
|
||||
EventListenerIntrospector,
|
||||
EventListenerRegistry,
|
||||
EventSubscriberRegistry
|
||||
class EventManager implements EventManagerInterface
|
||||
{
|
||||
/**
|
||||
* Map of registered listeners.
|
||||
|
||||
13
src/EventManagerInterface.php
Normal file
13
src/EventManagerInterface.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\Common;
|
||||
|
||||
/** Provided for convenience, but consider using the individual interfaces directly. */
|
||||
interface EventManagerInterface extends
|
||||
EventListenerIntrospector,
|
||||
EventListenerRegistry,
|
||||
EventSubscriberRegistry
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user