Add some return types

This commit is contained in:
Nicolas Grekas
2021-02-02 16:16:41 +01:00
parent bfcf4091a9
commit 50d032c4df
3 changed files with 14 additions and 5 deletions
+3
View File
@@ -32,6 +32,9 @@ class Markup implements \Countable
return $this->content;
}
/**
* @return int
*/
public function count()
{
return \function_exists('mb_get_info') ? mb_strlen($this->content, $this->charset) : \strlen($this->content);
+6
View File
@@ -207,11 +207,17 @@ class Node implements \Twig_NodeInterface
unset($this->nodes[$name]);
}
/**
* @return int
*/
public function count()
{
return \count($this->nodes);
}
/**
* @return \Traversable
*/
public function getIterator()
{
return new \ArrayIterator($this->nodes);
+5 -5
View File
@@ -153,17 +153,17 @@ class Profile implements \IteratorAggregate, \Serializable
$this->enter();
}
public function getIterator()
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->profiles);
}
public function serialize()
public function serialize(): string
{
return serialize($this->__serialize());
}
public function unserialize($data)
public function unserialize($data): void
{
$this->__unserialize(unserialize($data));
}
@@ -171,7 +171,7 @@ class Profile implements \IteratorAggregate, \Serializable
/**
* @internal
*/
public function __serialize()
public function __serialize(): array
{
return [$this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles];
}
@@ -179,7 +179,7 @@ class Profile implements \IteratorAggregate, \Serializable
/**
* @internal
*/
public function __unserialize(array $data)
public function __unserialize(array $data): void
{
list($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles) = $data;
}