Skip to content
Open
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
8 changes: 4 additions & 4 deletions src/Cortex/Route/DerivativeRouteTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function toArray()
* @param string $offset
* @return bool
*/
public function offsetExists($offset)
public function offsetExists($offset): bool
{
return $this->route->offsetExists($offset);
}
Expand All @@ -50,7 +50,7 @@ public function offsetExists($offset)
* @param string $offset
* @return mixed
*/
public function offsetGet($offset)
public function offsetGet($offset): mixed
{
return $this->route->offsetGet($offset);
}
Expand All @@ -60,7 +60,7 @@ public function offsetGet($offset)
* @param string $offset
* @param mixed $value
*/
public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
$this->route->offsetSet($offset, $value);
}
Expand All @@ -69,7 +69,7 @@ public function offsetSet($offset, $value)
* @see RouteInterface::offsetUnset()
* @param string $offset
*/
public function offsetUnset($offset)
public function offsetUnset($offset): void
{
$this->route->offsetUnset($offset);
}
Expand Down
12 changes: 6 additions & 6 deletions src/Cortex/Route/PriorityRouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,47 +71,47 @@ public function addRoute(RouteInterface $route)
/**
* @inheritdoc
*/
public function current()
public function current(): mixed
{
return $this->queue->current();
}

/**
* @inheritdoc
*/
public function next()
public function next(): void
{
$this->queue->next();
}

/**
* @inheritdoc
*/
public function key()
public function key(): mixed
{
return $this->queue->key();
}

/**
* @inheritdoc
*/
public function valid()
public function valid(): bool
{
return $this->queue->valid();
}

/**
* @inheritdoc
*/
public function rewind()
public function rewind(): void
{
$this->queue->rewind();
}

/**
* @inheritdoc
*/
public function count()
public function count(): int
{
return $this->queue->count();
}
Expand Down
8 changes: 4 additions & 4 deletions src/Cortex/Route/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,31 +83,31 @@ public function toArray()
/**
* @inheritdoc
*/
public function offsetExists($offset)
public function offsetExists($offset): bool
{
return array_key_exists($offset, $this->storage);
}

/**
* @inheritdoc
*/
public function offsetGet($offset)
public function offsetGet($offset): mixed
{
return $this->offsetExists($offset) ? $this->storage[$offset] : null;
}

/**
* @inheritdoc
*/
public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
$this->storage[$offset] = $value;
}

/**
* @inheritdoc
*/
public function offsetUnset($offset)
public function offsetUnset($offset): void
{
if ($this->offsetExists($offset) && $offset !== 'id') {
unset($this->storage[$offset]);
Expand Down
2 changes: 1 addition & 1 deletion src/Cortex/Router/RouteFilterIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct(RouteCollectionInterface $routes, UriInterface $uri)
/**
* @inheritdoc
*/
public function accept()
public function accept(): bool
{
/** @var RouteInterface $route */
$route = $this->getInnerIterator()->current();
Expand Down
2 changes: 1 addition & 1 deletion src/Cortex/Uri/WordPressUri.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function path()
* `example.com/subfolder` we need to strip down `/subfolder` from path and build a path
* for route matching that is relative to home url.
*/
$homePath = trim(parse_url(home_url(), PHP_URL_PATH), '/');
$homePath = \trim((string) \parse_url(home_url(), \PHP_URL_PATH), '/');
$path = trim($this->uri->getPath(), '/');
if ($homePath && strpos($path, $homePath) === 0) {
$path = trim(substr($path, strlen($homePath)), '/');
Expand Down