Skip to content
Snippets Groups Projects
Commit 0f0bd50d authored by tr's avatar tr Committed by Tim Rohaly
Browse files

Issue #3249556 by TR: PHP 8.1 changes

parent b40cc125
No related branches found
Tags 7.x-1.10
No related merge requests found
...@@ -553,6 +553,7 @@ class EntityStructureWrapper extends EntityMetadataWrapper implements IteratorAg ...@@ -553,6 +553,7 @@ class EntityStructureWrapper extends EntityMetadataWrapper implements IteratorAg
return isset($this->propertyInfo['properties'][$name]); return isset($this->propertyInfo['properties'][$name]);
} }
#[\ReturnTypeWillChange]
public function getIterator() { public function getIterator() {
$this->spotInfo(); $this->spotInfo();
return new EntityMetadataWrapperIterator($this, array_keys($this->propertyInfo['properties'])); return new EntityMetadataWrapperIterator($this, array_keys($this->propertyInfo['properties']));
...@@ -1123,6 +1124,7 @@ class EntityListWrapper extends EntityMetadataWrapper implements IteratorAggrega ...@@ -1123,6 +1124,7 @@ class EntityListWrapper extends EntityMetadataWrapper implements IteratorAggrega
/** /**
* If we wrap a list, we return an iterator over the data list. * If we wrap a list, we return an iterator over the data list.
*/ */
#[\ReturnTypeWillChange]
public function getIterator() { public function getIterator() {
// In case there is no data available, just iterate over the first item. // In case there is no data available, just iterate over the first item.
return new EntityMetadataWrapperIterator($this, ($this->dataAvailable() && is_array(parent::value())) ? array_keys(parent::value()) : array(0)); return new EntityMetadataWrapperIterator($this, ($this->dataAvailable() && is_array(parent::value())) ? array_keys(parent::value()) : array(0));
...@@ -1131,18 +1133,22 @@ class EntityListWrapper extends EntityMetadataWrapper implements IteratorAggrega ...@@ -1131,18 +1133,22 @@ class EntityListWrapper extends EntityMetadataWrapper implements IteratorAggrega
/** /**
* Implements the ArrayAccess interface. * Implements the ArrayAccess interface.
*/ */
#[\ReturnTypeWillChange]
public function offsetGet($delta) { public function offsetGet($delta) {
return $this->get($delta); return $this->get($delta);
} }
#[\ReturnTypeWillChange]
public function offsetExists($delta) { public function offsetExists($delta) {
return $this->dataAvailable() && ($data = $this->value()) && array_key_exists($delta, $data); return $this->dataAvailable() && ($data = $this->value()) && array_key_exists($delta, $data);
} }
#[\ReturnTypeWillChange]
public function offsetSet($delta, $value) { public function offsetSet($delta, $value) {
$this->get($delta)->set($value); $this->get($delta)->set($value);
} }
#[\ReturnTypeWillChange]
public function offsetUnset($delta) { public function offsetUnset($delta) {
if ($this->offsetExists($delta)) { if ($this->offsetExists($delta)) {
unset($this->data[$delta]); unset($this->data[$delta]);
...@@ -1150,6 +1156,7 @@ class EntityListWrapper extends EntityMetadataWrapper implements IteratorAggrega ...@@ -1150,6 +1156,7 @@ class EntityListWrapper extends EntityMetadataWrapper implements IteratorAggrega
} }
} }
#[\ReturnTypeWillChange]
public function count() { public function count() {
return $this->dataAvailable() ? count($this->value()) : 0; return $this->dataAvailable() ? count($this->value()) : 0;
} }
...@@ -1209,30 +1216,37 @@ class EntityMetadataWrapperIterator implements RecursiveIterator { ...@@ -1209,30 +1216,37 @@ class EntityMetadataWrapperIterator implements RecursiveIterator {
$this->keys = $keys; $this->keys = $keys;
} }
#[\ReturnTypeWillChange]
public function rewind() { public function rewind() {
$this->position = 0; $this->position = 0;
} }
#[\ReturnTypeWillChange]
public function current() { public function current() {
return $this->wrapper->get($this->keys[$this->position]); return $this->wrapper->get($this->keys[$this->position]);
} }
#[\ReturnTypeWillChange]
public function key() { public function key() {
return $this->keys[$this->position]; return $this->keys[$this->position];
} }
#[\ReturnTypeWillChange]
public function next() { public function next() {
$this->position++; $this->position++;
} }
#[\ReturnTypeWillChange]
public function valid() { public function valid() {
return isset($this->keys[$this->position]); return isset($this->keys[$this->position]);
} }
#[\ReturnTypeWillChange]
public function hasChildren() { public function hasChildren() {
return $this->current() instanceof IteratorAggregate; return $this->current() instanceof IteratorAggregate;
} }
#[\ReturnTypeWillChange]
public function getChildren() { public function getChildren() {
return $this->current()->getIterator(); return $this->current()->getIterator();
} }
...@@ -1258,26 +1272,32 @@ class EntityMetadataArrayObject implements ArrayAccess, Countable, IteratorAggre ...@@ -1258,26 +1272,32 @@ class EntityMetadataArrayObject implements ArrayAccess, Countable, IteratorAggre
/** /**
* Implements the ArrayAccess interface. * Implements the ArrayAccess interface.
*/ */
#[\ReturnTypeWillChange]
public function offsetGet($delta) { public function offsetGet($delta) {
return $this->data[$delta]; return $this->data[$delta];
} }
#[\ReturnTypeWillChange]
public function offsetExists($delta) { public function offsetExists($delta) {
return array_key_exists($delta, $this->data); return array_key_exists($delta, $this->data);
} }
#[\ReturnTypeWillChange]
public function offsetSet($delta, $value) { public function offsetSet($delta, $value) {
$this->data[$delta] = $value; $this->data[$delta] = $value;
} }
#[\ReturnTypeWillChange]
public function offsetUnset($delta) { public function offsetUnset($delta) {
unset($this->data[$delta]); unset($this->data[$delta]);
} }
#[\ReturnTypeWillChange]
public function count() { public function count() {
return count($this->data); return count($this->data);
} }
#[\ReturnTypeWillChange]
public function getIterator() { public function getIterator() {
return new ArrayIterator($this->data); return new ArrayIterator($this->data);
} }
......
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