mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 20:36:33 +00:00
minor #3554 Add explicit `@return type next to #[ReturnTypeWillChange]` (nicolas-grekas)
This PR was merged into the 2.x branch.
Discussion
----------
Add explicit ``@return`` type next to `#[ReturnTypeWillChange]`
Commits
-------
1d0bab9d Add explicit ``@return`` type next to `#[ReturnTypeWillChange]`
This commit is contained in:
@@ -41,6 +41,9 @@ class Markup implements \Countable, \JsonSerializable
|
||||
return mb_strlen($this->content, $this->charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
+11
-2
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user