Skip to content
Snippets Groups Projects
Commit 708168c2 authored by Jürgen Haas's avatar Jürgen Haas
Browse files

Issue #3380771 by jurgenhaas, mxh: Cleanup usage of Event classes

parent b41fb449
No related branches found
No related tags found
1 merge request!407Issue #3380771 by mxh, jurgenhaas: Cleanup usage of Event classes
Pipeline #102498 passed
Showing
with 29 additions and 28 deletions
......@@ -2,11 +2,11 @@
namespace Drupal\eca_access\Event;
use Drupal\Component\EventDispatcher\Event;
use Drupal\Core\Access\AccessResultInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\eca\Event\AccessEventInterface;
use Drupal\eca\Plugin\DataType\DataTransferObject;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Dispatched when being asked for access to create an entity.
......
......@@ -2,7 +2,6 @@
namespace Drupal\eca_access\Event;
use Drupal\Component\EventDispatcher\Event;
use Drupal\Core\Access\AccessResultInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
......@@ -10,6 +9,7 @@ use Drupal\eca\Event\AccessEventInterface;
use Drupal\eca\Event\EntityApplianceTrait;
use Drupal\eca\Event\EntityEventInterface;
use Drupal\eca\Plugin\DataType\DataTransferObject;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Dispatched when an entity is being asked for access.
......
......@@ -5,6 +5,7 @@ namespace Drupal\eca_access;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\eca\Event\BaseHookHandler;
use Symfony\Contracts\EventDispatcher\Event;
/**
* The handler for hook implementations within the eca_access.module file.
......@@ -25,10 +26,10 @@ class HookHandler extends BaseHookHandler {
* @param \Drupal\Core\Session\AccountInterface $account
* The account that asks for access.
*
* @return \Drupal\Component\EventDispatcher\Event|\Symfony\Contracts\EventDispatcher\Event|null
* @return \Symfony\Contracts\EventDispatcher\Event|null
* The dispatched event, nor NULL if no event was dispatched.
*/
public function entityAccess(EntityInterface $entity, string $operation, AccountInterface $account): ?object {
public function entityAccess(EntityInterface $entity, string $operation, AccountInterface $account): ?Event {
return $this->triggerEvent->dispatchFromPlugin('access:entity', $entity, $operation, $account);
}
......@@ -44,10 +45,10 @@ class HookHandler extends BaseHookHandler {
* @param string $field_name
* The field name.
*
* @return \Drupal\Component\EventDispatcher\Event|\Symfony\Contracts\EventDispatcher\Event|null
* @return \Symfony\Contracts\EventDispatcher\Event|null
* The dispatched event, nor NULL if no event was dispatched.
*/
public function fieldAccess(EntityInterface $entity, string $operation, AccountInterface $account, string $field_name): ?object {
public function fieldAccess(EntityInterface $entity, string $operation, AccountInterface $account, string $field_name): ?Event {
return $this->triggerEvent->dispatchFromPlugin('access:field', $entity, $operation, $account, $field_name);
}
......@@ -64,10 +65,10 @@ class HookHandler extends BaseHookHandler {
* @param \Drupal\Core\Session\AccountInterface $account
* The account that asks for access.
*
* @return \Drupal\Component\EventDispatcher\Event|\Symfony\Contracts\EventDispatcher\Event|null
* @return \Symfony\Contracts\EventDispatcher\Event|null
* The dispatched event, nor NULL if no event was dispatched.
*/
public function createAccess(array $context, string $entity_bundle, AccountInterface $account): ?object {
public function createAccess(array $context, string $entity_bundle, AccountInterface $account): ?Event {
return $this->triggerEvent->dispatchFromPlugin('access:create', $context, $entity_bundle, $account);
}
......
......@@ -3,10 +3,10 @@
namespace Drupal\eca_base\Event;
use Cron\CronExpression;
use Drupal\Component\EventDispatcher\Event;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\eca\EcaState;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Provides a cron event.
......
......@@ -2,9 +2,9 @@
namespace Drupal\eca_base\Event;
use Drupal\Component\EventDispatcher\Event;
use Drupal\eca\Event\TokenReceiverInterface;
use Drupal\eca\Event\TokenReceiverTrait;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Provides a custom event.
......
......@@ -2,7 +2,7 @@
namespace Drupal\eca_content\Event;
use Drupal\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Base class for entity related events.
......
......@@ -2,8 +2,8 @@
namespace Drupal\eca_content\Event;
use Drupal\Component\EventDispatcher\Event;
use Drupal\eca\Event\ContentEntityEventInterface;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Base class for field selection events.
......
......@@ -2,8 +2,8 @@
namespace Drupal\eca_endpoint\Event;
use Drupal\Component\EventDispatcher\Event;
use Drupal\eca\Plugin\DataType\DataTransferObject;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Base class of ECA endpoint events.
......
......@@ -2,10 +2,10 @@
namespace Drupal\eca_form\Event;
use Drupal\Component\EventDispatcher\Event;
use Drupal\Core\Form\FormStateInterface;
use Drupal\eca\Event\EntityApplianceTrait;
use Drupal\eca\Event\FormEventInterface;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Abstract base class for form events.
......
......@@ -2,7 +2,7 @@
namespace Drupal\eca_language\Event;
use Drupal\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Dispatched on language negotiation.
......
......@@ -2,8 +2,8 @@
namespace Drupal\eca_log\Event;
use Drupal\Component\EventDispatcher\Event;
use Drupal\eca\Plugin\DataType\DataTransferObject;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Provides an event when a log message is being submitted.
......
......@@ -2,7 +2,6 @@
namespace Drupal\eca_misc\Plugin\ECA\Event;
use Drupal\Component\EventDispatcher\Event;
use Drupal\Core\DrupalKernelInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\eca\Plugin\DataType\DataTransferObject;
......@@ -16,6 +15,7 @@ use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\Event\TerminateEvent;
use Symfony\Component\HttpKernel\Event\ViewEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Plugin implementation of the ECA Events for the kernel.
......
......@@ -2,11 +2,11 @@
namespace Drupal\eca_misc\Plugin\ECA\Event;
use Drupal\Component\EventDispatcher\Event;
use Drupal\Core\Routing\RouteBuildEvent;
use Drupal\Core\Routing\RoutingEvents;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\eca\Plugin\ECA\Event\EventBase;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Plugin implementation of the ECA Events for routing.
......
......@@ -2,7 +2,6 @@
namespace Drupal\Tests\eca_misc\Kernel;
use Drupal\Component\EventDispatcher\Event;
use Drupal\Core\DrupalKernelInterface;
use Drupal\eca\Entity\Eca;
use Drupal\eca_test_array\Plugin\Action\ArrayIncrement;
......@@ -21,6 +20,7 @@ use Symfony\Component\HttpKernel\Event\ViewEvent;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Kernel event tests provided by "eca_misc".
......
......@@ -2,8 +2,8 @@
namespace Drupal\eca_queue\Event;
use Drupal\Component\EventDispatcher\Event;
use Drupal\eca_queue\Task;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Dispatches when a queued ECA task is being processed.
......
......@@ -2,9 +2,9 @@
namespace Drupal\eca_render\Event;
use Drupal\Component\EventDispatcher\Event;
use Drupal\eca\Event\RenderEventInterface;
use Drupal\eca\Plugin\DataType\DataTransferObject;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Base class of ECA render events.
......
......@@ -2,9 +2,9 @@
namespace Drupal\eca_user\Event;
use Drupal\Component\EventDispatcher\Event;
use Drupal\Core\Session\AccountInterface;
use Drupal\eca\Event\AccountEventInterface;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Abstract base class for user related events.
......
......@@ -2,10 +2,10 @@
namespace Drupal\eca_workflow\Event;
use Drupal\Component\EventDispatcher\Event;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\eca\Event\ContentEntityEventInterface;
use Drupal\eca\Service\ContentEntityTypes;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Dispatched when a moderation state changed.
......
......@@ -22,6 +22,7 @@ use Drupal\eca\Entity\Objects\EcaObject;
use Drupal\eca\Form\RuntimePluginForm;
use Drupal\eca\Plugin\ECA\Modeller\ModellerInterface;
use Drupal\eca\Plugin\PluginUsageInterface;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Defines the ECA entity type.
......@@ -711,7 +712,7 @@ class Eca extends ConfigEntityBase implements EntityWithPluginCollectionInterfac
*
* @param \Drupal\eca\Entity\Objects\EcaObject $eca_object
* The ECA item, for which the successors are requested.
* @param \Drupal\Component\EventDispatcher\Event|\Symfony\Contracts\EventDispatcher\Event $event
* @param \Symfony\Contracts\EventDispatcher\Event $event
* The originally triggered event in which context to determine the list
* of valid successors.
* @param array $context
......@@ -721,7 +722,7 @@ class Eca extends ConfigEntityBase implements EntityWithPluginCollectionInterfac
* @return \Drupal\eca\Entity\Objects\EcaObject[]
* The list of valid successors.
*/
public function getSuccessors(EcaObject $eca_object, object $event, array $context): array {
public function getSuccessors(EcaObject $eca_object, Event $event, array $context): array {
$successors = [];
foreach ($eca_object->getSuccessors() as $successor) {
$context['%successorid'] = $successor['id'];
......
......@@ -2,7 +2,6 @@
namespace Drupal\eca\Entity\Objects;
use Drupal\Component\EventDispatcher\Event;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Core\Access\AccessResultReasonInterface;
use Drupal\Core\Action\ActionInterface as CoreActionInterface;
......@@ -17,7 +16,7 @@ use Drupal\eca\Event\BeforeActionExecutionEvent;
use Drupal\eca\Plugin\Action\ActionInterface;
use Drupal\eca\Plugin\ObjectWithPluginInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\EventDispatcher\Event as SymfonyEvent;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Provides an ECA item of type action for internal processing.
......@@ -60,7 +59,7 @@ class EcaAction extends EcaObject implements ObjectWithPluginInterface {
/**
* {@inheritdoc}
*/
public function execute(?EcaObject $predecessor, Event|SymfonyEvent $event, array $context): bool {
public function execute(?EcaObject $predecessor, Event $event, array $context): bool {
if (!parent::execute($predecessor, $event, $context)) {
return FALSE;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment