Skip to content
Snippets Groups Projects
Commit 276e51fc authored by Pedro Cambra's avatar Pedro Cambra Committed by Sascha Grossenbacher
Browse files

Issue #3500327 by pcambra, klausi: Nullable types must be explicit

parent 51bc434f
Branches
Tags
1 merge request!41Issue #3500327: Nullable types must be explicit
Pipeline #517432 passed with warnings
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Drupal\entity\Form; namespace Drupal\entity\Form;
use Drupal\Core\Datetime\DateFormatterInterface; use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Entity\RevisionableInterface; use Drupal\Core\Entity\RevisionableInterface;
use Drupal\Core\Form\ConfirmFormBase; use Drupal\Core\Form\ConfirmFormBase;
...@@ -11,6 +12,9 @@ use Drupal\Core\Entity\RevisionLogInterface; ...@@ -11,6 +12,9 @@ use Drupal\Core\Entity\RevisionLogInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/**
* Form to confirm reverting an entity revision.
*/
class RevisionRevertForm extends ConfirmFormBase { class RevisionRevertForm extends ConfirmFormBase {
/** /**
...@@ -101,7 +105,7 @@ class RevisionRevertForm extends ConfirmFormBase { ...@@ -101,7 +105,7 @@ class RevisionRevertForm extends ConfirmFormBase {
/** /**
* {@inheritdoc} * {@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; $this->revision = $_entity_revision;
$form = parent::buildForm($form, $form_state); $form = parent::buildForm($form, $form_state);
......
...@@ -68,7 +68,7 @@ final class EventOnlyQueryAccessHandler implements EntityHandlerInterface, Query ...@@ -68,7 +68,7 @@ final class EventOnlyQueryAccessHandler implements EntityHandlerInterface, Query
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getConditions($operation, AccountInterface $account = NULL) { public function getConditions($operation, ?AccountInterface $account = NULL) {
$account = $account ?: $this->currentUser; $account = $account ?: $this->currentUser;
$entity_type_id = $this->entityType->id(); $entity_type_id = $this->entityType->id();
$conditions = new ConditionGroup('OR'); $conditions = new ConditionGroup('OR');
......
...@@ -81,7 +81,7 @@ abstract class QueryAccessHandlerBase implements EntityHandlerInterface, QueryAc ...@@ -81,7 +81,7 @@ abstract class QueryAccessHandlerBase implements EntityHandlerInterface, QueryAc
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getConditions($operation, AccountInterface $account = NULL) { public function getConditions($operation, ?AccountInterface $account = NULL) {
$account = $account ?: $this->currentUser; $account = $account ?: $this->currentUser;
$entity_type_id = $this->entityType->id(); $entity_type_id = $this->entityType->id();
$conditions = $this->buildConditions($operation, $account); $conditions = $this->buildConditions($operation, $account);
......
...@@ -30,13 +30,13 @@ interface QueryAccessHandlerInterface { ...@@ -30,13 +30,13 @@ interface QueryAccessHandlerInterface {
* @param string $operation * @param string $operation
* The access operation. Usually one of "view", "update", "duplicate", * The access operation. Usually one of "view", "update", "duplicate",
* or "delete". * or "delete".
* @param \Drupal\Core\Session\AccountInterface $account * @param \Drupal\Core\Session\AccountInterface|null $account
* The user for which to restrict access, or NULL * The user for which to restrict access, or NULL
* to assume the current user. Defaults to NULL. * to assume the current user. Defaults to NULL.
* *
* @return \Drupal\entity\QueryAccess\ConditionGroup * @return \Drupal\entity\QueryAccess\ConditionGroup
* The conditions. * The conditions.
*/ */
public function getConditions($operation, AccountInterface $account = NULL); public function getConditions($operation, ?AccountInterface $account = NULL);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment