diff --git a/application/Espo/Core/Formula/ArgumentList.php b/application/Espo/Core/Formula/ArgumentList.php index 82633db1da..5e0ee9c143 100644 --- a/application/Espo/Core/Formula/ArgumentList.php +++ b/application/Espo/Core/Formula/ArgumentList.php @@ -67,7 +67,7 @@ class ArgumentList implements Evaluatable, Iterator, Countable, ArrayAccess, See return $i; } - public function rewind() + public function rewind(): void { $this->position = 0; @@ -81,22 +81,32 @@ class ArgumentList implements Evaluatable, Iterator, Countable, ArrayAccess, See return new Argument($this->dataList[$index]); } + /** + * @return mixed + */ public function current() { return $this->getArgumentByIndex($this->position); } + /** + * @return mixed + */ public function key() { return $this->position; } - public function next() + public function next(): void { do { $this->position ++; $next = false; - if (!$this->valid() && $this->position <= $this->getLastValidKey()) { + + if ( + !$this->valid() && + $this->position <= $this->getLastValidKey() + ) { $next = true; } } while ($next); @@ -107,11 +117,18 @@ class ArgumentList implements Evaluatable, Iterator, Countable, ArrayAccess, See return array_key_exists($this->position, $this->dataList); } + /** + * @param mixed $offset + */ public function offsetExists($offset): bool { return array_key_exists($offset, $this->dataList); } + /** + * @param mixed $offset + * @return mixed + */ public function offsetGet($offset) { if (!$this->offsetExists($offset)) { @@ -120,12 +137,19 @@ class ArgumentList implements Evaluatable, Iterator, Countable, ArrayAccess, See return $this->getArgumentByIndex($offset); } - public function offsetSet($offset, $value) + /** + * @param mixed $offset + * @param mixed $value + */ + public function offsetSet($offset, $value): void { throw new BadMethodCallException('Setting is not allowed.'); } - public function offsetUnset($offset) + /** + * @param mixed $offset + */ + public function offsetUnset($offset): void { throw new BadMethodCallException('Unsetting is not allowed.'); } @@ -135,7 +159,10 @@ class ArgumentList implements Evaluatable, Iterator, Countable, ArrayAccess, See return count($this->dataList); } - public function seek($offset) + /** + * @param int $offset + */ + public function seek($offset): void { $this->position = $offset; diff --git a/application/Espo/ORM/EntityCollection.php b/application/Espo/ORM/EntityCollection.php index d07277e1e0..103337f954 100644 --- a/application/Espo/ORM/EntityCollection.php +++ b/application/Espo/ORM/EntityCollection.php @@ -65,7 +65,7 @@ class EntityCollection implements Collection, Iterator, Countable, ArrayAccess, $this->entityFactory = $entityFactory; } - public function rewind() + public function rewind(): void { $this->position = 0; @@ -74,17 +74,23 @@ class EntityCollection implements Collection, Iterator, Countable, ArrayAccess, } } + /** + * @return mixed + */ public function current() { return $this->getEntityByOffset($this->position); } + /** + * @return mixed + */ public function key() { return $this->position; } - public function next() + public function next(): void { do { $this->position ++; @@ -114,16 +120,23 @@ class EntityCollection implements Collection, Iterator, Countable, ArrayAccess, return $i; } - public function valid() + public function valid(): bool { return isset($this->dataList[$this->position]); } - public function offsetExists($offset) + /** + * @param mixed $offset + */ + public function offsetExists($offset): bool { return isset($this->dataList[$offset]); } + /** + * @param mixed $offset + * @return mixed + */ public function offsetGet($offset) { if (!isset($this->dataList[$offset])) { @@ -133,7 +146,11 @@ class EntityCollection implements Collection, Iterator, Countable, ArrayAccess, return $this->getEntityByOffset($offset); } - public function offsetSet($offset, $value) + /** + * @param mixed $offset + * @param mixed $value + */ + public function offsetSet($offset, $value): void { if (!($value instanceof Entity)) { throw new InvalidArgumentException('Only Entity is allowed to be added to EntityCollection.'); @@ -148,17 +165,23 @@ class EntityCollection implements Collection, Iterator, Countable, ArrayAccess, $this->dataList[$offset] = $value; } + /** + * @param mixed $offset + */ public function offsetUnset($offset) { unset($this->dataList[$offset]); } - public function count() + public function count(): int { return count($this->dataList); } - public function seek($offset) + /** + * @param int $offset + */ + public function seek($offset): void { $this->position = $offset; @@ -167,7 +190,7 @@ class EntityCollection implements Collection, Iterator, Countable, ArrayAccess, } } - public function append(Entity $entity) + public function append(Entity $entity): void { $this->dataList[] = $entity; } diff --git a/application/Espo/ORM/Query/Part/OrderList.php b/application/Espo/ORM/Query/Part/OrderList.php index a1e0ac7853..fb6526f30e 100644 --- a/application/Espo/ORM/Query/Part/OrderList.php +++ b/application/Espo/ORM/Query/Part/OrderList.php @@ -62,40 +62,27 @@ class OrderList implements Iterator return new self($list); } - /** - * @return void - */ - public function rewind() + public function rewind(): void { $this->position = 0; } - /** - * @return Order - */ - public function current() + public function current(): Order { return $this->list[$this->position]; } - /** - * - * @return int - */ - public function key() + public function key(): int { return $this->position; } - public function next() + public function next(): void { ++$this->position; } - /** - * @return bool - */ - public function valid() + public function valid(): bool { return isset($this->list[$this->position]); } diff --git a/application/Espo/ORM/SthCollection.php b/application/Espo/ORM/SthCollection.php index 9908acd4c1..96030e2c95 100644 --- a/application/Espo/ORM/SthCollection.php +++ b/application/Espo/ORM/SthCollection.php @@ -34,6 +34,7 @@ use Espo\ORM\QueryComposer\QueryComposer as QueryComposer; use IteratorAggregate; use Countable; +use Traversable; use PDO; /** @@ -103,7 +104,7 @@ class SthCollection implements Collection, IteratorAggregate, Countable return $this->query; } - public function getIterator() + public function getIterator(): Traversable { return (function () { if (isset($this->sth)) {