From 6c1e5611348e3947bb75e03dbb415f6d6e41ebe5 Mon Sep 17 00:00:00 2001 From: Pedro Cambra <pedro@cambrico.net> Date: Thu, 16 Jan 2025 17:35:06 +0100 Subject: [PATCH 1/3] Issue #3500327: Nullable types must be explicit --- src/Form/RevisionRevertForm.php | 5 ++++- src/QueryAccess/EventOnlyQueryAccessHandler.php | 2 +- src/QueryAccess/QueryAccessHandlerBase.php | 2 +- src/QueryAccess/QueryAccessHandlerInterface.php | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Form/RevisionRevertForm.php b/src/Form/RevisionRevertForm.php index f1e5707..6d2fb57 100644 --- a/src/Form/RevisionRevertForm.php +++ b/src/Form/RevisionRevertForm.php @@ -11,6 +11,9 @@ use Drupal\Core\Entity\RevisionLogInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; +/** + * + */ class RevisionRevertForm extends ConfirmFormBase { /** @@ -101,7 +104,7 @@ class RevisionRevertForm extends ConfirmFormBase { /** * {@inheritdoc} */ - public function buildForm(array $form, FormStateInterface $form_state, $_entity_revision = NULL, Request $request = NULL) { + public function buildForm(array $form, FormStateInterface $form_state, EntityInterface|RevisionableInterface|RevisionLogInterface|NULL $_entity_revision = NULL, ?Request $request = NULL) { $this->revision = $_entity_revision; $form = parent::buildForm($form, $form_state); diff --git a/src/QueryAccess/EventOnlyQueryAccessHandler.php b/src/QueryAccess/EventOnlyQueryAccessHandler.php index 1f65745..c58ec24 100644 --- a/src/QueryAccess/EventOnlyQueryAccessHandler.php +++ b/src/QueryAccess/EventOnlyQueryAccessHandler.php @@ -68,7 +68,7 @@ final class EventOnlyQueryAccessHandler implements EntityHandlerInterface, Query /** * {@inheritdoc} */ - public function getConditions($operation, AccountInterface $account = NULL) { + public function getConditions($operation, ?AccountInterface $account = NULL) { $account = $account ?: $this->currentUser; $entity_type_id = $this->entityType->id(); $conditions = new ConditionGroup('OR'); diff --git a/src/QueryAccess/QueryAccessHandlerBase.php b/src/QueryAccess/QueryAccessHandlerBase.php index 8df9c47..2285f33 100644 --- a/src/QueryAccess/QueryAccessHandlerBase.php +++ b/src/QueryAccess/QueryAccessHandlerBase.php @@ -81,7 +81,7 @@ abstract class QueryAccessHandlerBase implements EntityHandlerInterface, QueryAc /** * {@inheritdoc} */ - public function getConditions($operation, AccountInterface $account = NULL) { + public function getConditions($operation, ?AccountInterface $account = NULL) { $account = $account ?: $this->currentUser; $entity_type_id = $this->entityType->id(); $conditions = $this->buildConditions($operation, $account); diff --git a/src/QueryAccess/QueryAccessHandlerInterface.php b/src/QueryAccess/QueryAccessHandlerInterface.php index 36e8324..0bc7a4d 100644 --- a/src/QueryAccess/QueryAccessHandlerInterface.php +++ b/src/QueryAccess/QueryAccessHandlerInterface.php @@ -37,6 +37,6 @@ interface QueryAccessHandlerInterface { * @return \Drupal\entity\QueryAccess\ConditionGroup * The conditions. */ - public function getConditions($operation, AccountInterface $account = NULL); + public function getConditions($operation, ?AccountInterface $account = NULL); } -- GitLab From b0529e852e117b35ada5ae18ca0f234c1c88be82 Mon Sep 17 00:00:00 2001 From: Klaus Purer <klaus.purer@protonmail.ch> Date: Thu, 6 Feb 2025 13:55:56 +0100 Subject: [PATCH 2/3] fix type and comment --- src/Form/RevisionRevertForm.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Form/RevisionRevertForm.php b/src/Form/RevisionRevertForm.php index 6d2fb57..fc7ee77 100644 --- a/src/Form/RevisionRevertForm.php +++ b/src/Form/RevisionRevertForm.php @@ -3,6 +3,7 @@ namespace Drupal\entity\Form; use Drupal\Core\Datetime\DateFormatterInterface; +use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Entity\RevisionableInterface; use Drupal\Core\Form\ConfirmFormBase; @@ -12,7 +13,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; /** - * + * Form to confirm reverting an entity revision. */ class RevisionRevertForm extends ConfirmFormBase { -- GitLab From 3b71fd2bf30a4774dcb5f0cd030241a4bc831271 Mon Sep 17 00:00:00 2001 From: Klaus Purer <klaus.purer@protonmail.ch> Date: Thu, 6 Feb 2025 14:00:00 +0100 Subject: [PATCH 3/3] doc type --- src/QueryAccess/QueryAccessHandlerInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/QueryAccess/QueryAccessHandlerInterface.php b/src/QueryAccess/QueryAccessHandlerInterface.php index 0bc7a4d..ea7e1dc 100644 --- a/src/QueryAccess/QueryAccessHandlerInterface.php +++ b/src/QueryAccess/QueryAccessHandlerInterface.php @@ -30,7 +30,7 @@ interface QueryAccessHandlerInterface { * @param string $operation * The access operation. Usually one of "view", "update", "duplicate", * or "delete". - * @param \Drupal\Core\Session\AccountInterface $account + * @param \Drupal\Core\Session\AccountInterface|null $account * The user for which to restrict access, or NULL * to assume the current user. Defaults to NULL. * -- GitLab