diff --git a/src/Markup.php b/src/Markup.php index 19ba9baac..0cc45bef1 100644 --- a/src/Markup.php +++ b/src/Markup.php @@ -41,6 +41,9 @@ class Markup implements \Countable, \JsonSerializable return mb_strlen($this->content, $this->charset); } + /** + * @return mixed + */ #[\ReturnTypeWillChange] public function jsonSerialize() { diff --git a/src/Util/TemplateDirIterator.php b/src/Util/TemplateDirIterator.php index 1ab0dac59..b0356d4c2 100644 --- a/src/Util/TemplateDirIterator.php +++ b/src/Util/TemplateDirIterator.php @@ -16,11 +16,19 @@ namespace Twig\Util; */ class TemplateDirIterator extends \IteratorIterator { + /** + * @return mixed + */ + #[\ReturnTypeWillChange] public function current() { return file_get_contents(parent::current()); } + /** + * @return mixed + */ + #[\ReturnTypeWillChange] public function key() { return (string) parent::key(); diff --git a/tests/Extension/CoreTest.php b/tests/Extension/CoreTest.php index 40255fefa..5f82ccad5 100644 --- a/tests/Extension/CoreTest.php +++ b/tests/Extension/CoreTest.php @@ -305,6 +305,9 @@ final class CoreTestIterator implements \Iterator $this->position = 0; } + /** + * @return mixed + */ #[\ReturnTypeWillChange] public function current() { @@ -315,6 +318,9 @@ final class CoreTestIterator implements \Iterator throw new \LogicException('Code should only use the keys, not the values provided by iterator.'); } + /** + * @return mixed + */ #[\ReturnTypeWillChange] public function key() { diff --git a/tests/IntegrationTest.php b/tests/IntegrationTest.php index 4b82c9bb6..79674d1fc 100644 --- a/tests/IntegrationTest.php +++ b/tests/IntegrationTest.php @@ -104,12 +104,18 @@ class TwigTestFoo implements \Iterator $this->position = 0; } + /** + * @return mixed + */ #[\ReturnTypeWillChange] public function current() { return $this->array[$this->position]; } + /** + * @return mixed + */ #[\ReturnTypeWillChange] public function key() { @@ -363,6 +369,9 @@ class SimpleIteratorForTesting implements \Iterator private $data = [1, 2, 3, 4, 5, 6, 7]; private $key = 0; + /** + * @return mixed + */ #[\ReturnTypeWillChange] public function current() { @@ -374,6 +383,9 @@ class SimpleIteratorForTesting implements \Iterator ++$this->key; } + /** + * @return mixed + */ #[\ReturnTypeWillChange] public function key() { diff --git a/tests/TemplateTest.php b/tests/TemplateTest.php index f586027a1..f256ebfd5 100644 --- a/tests/TemplateTest.php +++ b/tests/TemplateTest.php @@ -476,6 +476,9 @@ class TemplateArrayAccessObject implements \ArrayAccess return \array_key_exists($name, $this->attributes); } + /** + * @return mixed + */ #[\ReturnTypeWillChange] public function offsetGet($name) { @@ -509,7 +512,7 @@ class TemplateMagicPropertyObject protected $protected = 'protected'; - public function __isset($name) + public function __isset($name): bool { return \array_key_exists($name, $this->attributes); } @@ -522,7 +525,7 @@ class TemplateMagicPropertyObject class TemplateMagicPropertyObjectWithException { - public function __isset($key) + public function __isset($key): bool { throw new \Exception('Hey! Don\'t try to isset me!'); } @@ -566,6 +569,9 @@ class TemplatePropertyObjectAndArrayAccess extends TemplatePropertyObject implem return \array_key_exists($offset, $this->data); } + /** + * @return mixed + */ #[\ReturnTypeWillChange] public function offsetGet($offset) { @@ -715,6 +721,9 @@ class TemplateArrayAccess implements \ArrayAccess return \array_key_exists($offset, $this->children); } + /** + * @return mixed + */ #[\ReturnTypeWillChange] public function offsetGet($offset) {