Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions Driver/ODM/Pager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ class Pager implements PagerInterface, \IteratorAggregate, \Countable, \ArrayAcc
*/
protected $lastPage;

/**
* @var integer
*/
protected $page;

/**
* @var integer
*/
Expand Down Expand Up @@ -51,55 +56,55 @@ public function paginate($target, $page = 1, $limit = 10)
/**
* {@inheritdoc}
*/
public function getLastPage()
public function getLastPage(): int
{
return $this->lastPage;
}

/**
* {@inheritdoc}
*/
public function getPage()
public function getPage(): int
{
return $this->page;
}

/**
* {@inheritdoc}
*/
public function haveToPaginate()
public function haveToPaginate(): bool
{
return $this->getLastPage() > 1;
}

/**
* {@inheritdoc}
*/
public function getNbResults()
public function getNbResults(): int
{
return $this->nbResults;
}

/**
* @param array $items items
*/
public function setItems(array $items)
public function setItems(array $items): void
{
$this->items = $items;
}

/**
* @return \ArrayIterator
*/
public function getIterator()
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->items);
}

/**
* @return integer
*/
public function count()
public function count(): int
{
return count($this->items);
}
Expand All @@ -108,7 +113,7 @@ public function count()
* @param mixed $offset
* @param mixed $value
*/
public function offsetSet($offset, $value)
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->items[] = $value;
Expand All @@ -121,15 +126,15 @@ public function offsetSet($offset, $value)
* @param mixed $offset
* @return boolean
*/
public function offsetExists($offset)
public function offsetExists(mixed $offset): bool
{
return isset($this->items[$offset]);
}

/**
* @param mixed $offset
*/
public function offsetUnset($offset)
public function offsetUnset(mixed $offset): void
{
unset($this->items[$offset]);
}
Expand All @@ -138,8 +143,8 @@ public function offsetUnset($offset)
* @param mixed $offset
* @return mixed
*/
public function offsetGet($offset)
public function offsetGet(mixed $offset): mixed
{
return isset($this->items[$offset]) ? $this->items[$offset] : null;
return $this->items[$offset] ?? null;
}
}
10 changes: 5 additions & 5 deletions Driver/ORM/Pager.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,39 +58,39 @@ public function paginate($target, $page = 1, $limit = 10)
/**
* {@inheritdoc}
*/
public function getLastPage()
public function getLastPage(): int
{
return $this->lastPage;
}

/**
* {@inheritdoc}
*/
public function getPage()
public function getPage(): int
{
return $this->page;
}

/**
* {@inheritdoc}
*/
public function haveToPaginate()
public function haveToPaginate(): bool
{
return $this->getLastPage() > 1;
}

/**
* {@inheritdoc}
*/
public function getNbResults()
public function getNbResults(): int
{
return $this->nbResults;
}

/**
* @param array $items items
*/
public function setItems(array $items)
public function setItems(array $items): void
{
$this->items = $items;
}
Expand Down
2 changes: 1 addition & 1 deletion Driver/ORM/QueryBuilder/Criteria/CriteriaCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function addFromAsserter(Asserter $asserter)
/**
* @return \ArrayIterator
*/
public function getIterator()
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->criterias);
}
Expand Down
7 changes: 7 additions & 0 deletions Driver/ORM/QueryBuilder/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ protected function filterCriterias($qb)
$visitor = new OperatorVisitor();
} elseif ($this->criterias instanceof Asserter) {
$visitor = new AsserterVisitor();
} else {
throw new \InvalidArgumentException(sprintf(
'Criterias must be an instance of %s or %s, %s given',
Operator::class,
Asserter::class,
get_class($this->criterias)
));
}

$criteriaCollection = new CriteriaCollection();
Expand Down
2 changes: 1 addition & 1 deletion Filter/DataHydrator/Locator/DoctrineORM.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function locate($model, array $components)
}

if (count($fields) > 1) {
return $this->locateComposite($objectManager, $metadata, $model, $components, $oids, $fields);
$this->locateComposite($objectManager, $metadata, $model, $components, $oids, $fields);
}

$alias = 'r';
Expand Down