Skip to content
Snippets Groups Projects

fix(StateItem): PHP 8.4 compatibility for nullable types

1 file
+ 4
4
Compare changes
  • Side-by-side
  • Inline
@@ -175,14 +175,14 @@ class StateItem extends FieldItemBase implements StateItemInterface, OptionsProv
@@ -175,14 +175,14 @@ class StateItem extends FieldItemBase implements StateItemInterface, OptionsProv
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public function getPossibleValues(AccountInterface $account = NULL) {
public function getPossibleValues(?AccountInterface $account = NULL) {
return array_keys($this->getPossibleOptions($account));
return array_keys($this->getPossibleOptions($account));
}
}
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public function getPossibleOptions(AccountInterface $account = NULL) {
public function getPossibleOptions(?AccountInterface $account = NULL) {
$workflow = $this->getWorkflow();
$workflow = $this->getWorkflow();
if (!$workflow) {
if (!$workflow) {
// The workflow is not known yet, the field is probably being created.
// The workflow is not known yet, the field is probably being created.
@@ -198,14 +198,14 @@ class StateItem extends FieldItemBase implements StateItemInterface, OptionsProv
@@ -198,14 +198,14 @@ class StateItem extends FieldItemBase implements StateItemInterface, OptionsProv
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public function getSettableValues(AccountInterface $account = NULL) {
public function getSettableValues(?AccountInterface $account = NULL) {
return array_keys($this->getSettableOptions($account));
return array_keys($this->getSettableOptions($account));
}
}
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public function getSettableOptions(AccountInterface $account = NULL) {
public function getSettableOptions(?AccountInterface $account = NULL) {
// $this->value is unpopulated due to https://www.drupal.org/node/2629932
// $this->value is unpopulated due to https://www.drupal.org/node/2629932
$field_name = $this->getFieldDefinition()->getName();
$field_name = $this->getFieldDefinition()->getName();
if (!$this->getEntity()->hasField($field_name)) {
if (!$this->getEntity()->hasField($field_name)) {
Loading