mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-30 03:57:21 +00:00
Remove usage of ReturnTypeWillChange
This commit is contained in:
+2
-10
@@ -32,20 +32,12 @@ class Markup implements \Countable, \JsonSerializable
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return mb_strlen($this->content, $this->charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
+1
-5
@@ -144,11 +144,7 @@ class Node implements \Countable, \IteratorAggregate
|
||||
unset($this->nodes[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return \count($this->nodes);
|
||||
}
|
||||
|
||||
@@ -16,20 +16,12 @@ namespace Twig\Util;
|
||||
*/
|
||||
class TemplateDirIterator extends \IteratorIterator
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
public function current(): mixed
|
||||
{
|
||||
return file_get_contents(parent::current());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
public function key(): mixed
|
||||
{
|
||||
return (string) parent::key();
|
||||
}
|
||||
|
||||
@@ -381,8 +381,7 @@ final class CoreTestIterator implements \Iterator
|
||||
$this->position = 0;
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
public function current(): mixed
|
||||
{
|
||||
if ($this->allowValueAccess) {
|
||||
return $this->array[$this->key()];
|
||||
@@ -391,8 +390,7 @@ final class CoreTestIterator implements \Iterator
|
||||
throw new \LogicException('Code should only use the keys, not the values provided by iterator.');
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
public function key(): mixed
|
||||
{
|
||||
return $this->arrayKeys[$this->position];
|
||||
}
|
||||
|
||||
@@ -19,10 +19,8 @@
|
||||
class ItemsIterator implements \Iterator
|
||||
{
|
||||
protected $values = ['foo' => 'bar', 'bar' => 'foo'];
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current() { return current($this->values); }
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key() { return key($this->values); }
|
||||
public function current(): mixed { return current($this->values); }
|
||||
public function key(): mixed { return key($this->values); }
|
||||
public function next(): void { next($this->values); }
|
||||
public function rewind(): void { reset($this->values); }
|
||||
public function valid(): bool { return false !== current($this->values); }
|
||||
|
||||
@@ -20,10 +20,8 @@
|
||||
class ItemsIteratorCountable implements \Iterator, \Countable
|
||||
{
|
||||
protected $values = ['foo' => 'bar', 'bar' => 'foo'];
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current() { return current($this->values); }
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key() { return key($this->values); }
|
||||
public function current(): mixed { return current($this->values); }
|
||||
public function key(): mixed { return key($this->values); }
|
||||
public function next(): void { next($this->values); }
|
||||
public function rewind(): void { reset($this->values); }
|
||||
public function valid(): bool { return false !== current($this->values); }
|
||||
|
||||
@@ -106,14 +106,12 @@ class TwigTestFoo implements \Iterator
|
||||
$this->position = 0;
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
public function current(): mixed
|
||||
{
|
||||
return $this->array[$this->position];
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
public function key(): mixed
|
||||
{
|
||||
return 'a';
|
||||
}
|
||||
@@ -366,8 +364,7 @@ class SimpleIteratorForTesting implements \Iterator
|
||||
private $data = [1, 2, 3, 4, 5, 6, 7];
|
||||
private $key = 0;
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
public function current(): mixed
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
@@ -377,8 +374,7 @@ class SimpleIteratorForTesting implements \Iterator
|
||||
++$this->key;
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
public function key(): mixed
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
@@ -469,8 +469,7 @@ class TemplateArrayAccessObject implements \ArrayAccess
|
||||
return \array_key_exists($name, $this->attributes);
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($name)
|
||||
public function offsetGet($name): mixed
|
||||
{
|
||||
return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null;
|
||||
}
|
||||
@@ -559,8 +558,7 @@ class TemplatePropertyObjectAndArrayAccess extends TemplatePropertyObject implem
|
||||
return \array_key_exists($offset, $this->data);
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
public function offsetGet($offset): mixed
|
||||
{
|
||||
return $this->offsetExists($offset) ? $this->data[$offset] : 'n/a';
|
||||
}
|
||||
@@ -708,8 +706,7 @@ class TemplateArrayAccess implements \ArrayAccess
|
||||
return \array_key_exists($offset, $this->children);
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
public function offsetGet($offset): mixed
|
||||
{
|
||||
return $this->children[$offset];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user