mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 23:16:03 +00:00
type fixes
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user