From 0c4f83f4ec3d12adb9c21f94e313269ba7ad74aa Mon Sep 17 00:00:00 2001 From: Rey C Date: Sat, 24 Jan 2026 14:52:56 +0800 Subject: [PATCH 1/2] Fix: PHP 8.3 deprecated warning for Brain-WP/Cortex library Resolves https://github.com/WPUserManager/wp-user-manager/issues/418 @polevaultweb --- src/Cortex/Route/PriorityRouteCollection.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Cortex/Route/PriorityRouteCollection.php b/src/Cortex/Route/PriorityRouteCollection.php index 341ad76..7ddda25 100644 --- a/src/Cortex/Route/PriorityRouteCollection.php +++ b/src/Cortex/Route/PriorityRouteCollection.php @@ -71,7 +71,7 @@ public function addRoute(RouteInterface $route) /** * @inheritdoc */ - public function current() + public function current(): mixed { return $this->queue->current(); } @@ -79,7 +79,7 @@ public function current() /** * @inheritdoc */ - public function next() + public function next(): void { $this->queue->next(); } @@ -87,7 +87,7 @@ public function next() /** * @inheritdoc */ - public function key() + public function key(): mixed { return $this->queue->key(); } @@ -95,7 +95,7 @@ public function key() /** * @inheritdoc */ - public function valid() + public function valid(): bool { return $this->queue->valid(); } @@ -103,7 +103,7 @@ public function valid() /** * @inheritdoc */ - public function rewind() + public function rewind(): void { $this->queue->rewind(); } @@ -111,7 +111,7 @@ public function rewind() /** * @inheritdoc */ - public function count() + public function count(): int { return $this->queue->count(); } From 32c72b2bf13e98d507b374861a6b935759e4df83 Mon Sep 17 00:00:00 2001 From: Rey C Date: Sat, 24 Jan 2026 15:56:18 +0800 Subject: [PATCH 2/2] Fix: PHP 8.3 deprecated warning for Brain-WP/Cortex library Resolves https://github.com/WPUserManager/wp-user-manager/issues/418 @polevaultweb --- src/Cortex/Route/DerivativeRouteTrait.php | 8 ++++---- src/Cortex/Route/Route.php | 8 ++++---- src/Cortex/Router/RouteFilterIterator.php | 2 +- src/Cortex/Uri/WordPressUri.php | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Cortex/Route/DerivativeRouteTrait.php b/src/Cortex/Route/DerivativeRouteTrait.php index d0b3476..5a9350b 100644 --- a/src/Cortex/Route/DerivativeRouteTrait.php +++ b/src/Cortex/Route/DerivativeRouteTrait.php @@ -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); } @@ -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); } @@ -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); } @@ -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); } diff --git a/src/Cortex/Route/Route.php b/src/Cortex/Route/Route.php index a3b963e..adb8e98 100644 --- a/src/Cortex/Route/Route.php +++ b/src/Cortex/Route/Route.php @@ -83,7 +83,7 @@ public function toArray() /** * @inheritdoc */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return array_key_exists($offset, $this->storage); } @@ -91,7 +91,7 @@ public function offsetExists($offset) /** * @inheritdoc */ - public function offsetGet($offset) + public function offsetGet($offset): mixed { return $this->offsetExists($offset) ? $this->storage[$offset] : null; } @@ -99,7 +99,7 @@ public function offsetGet($offset) /** * @inheritdoc */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { $this->storage[$offset] = $value; } @@ -107,7 +107,7 @@ public function offsetSet($offset, $value) /** * @inheritdoc */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { if ($this->offsetExists($offset) && $offset !== 'id') { unset($this->storage[$offset]); diff --git a/src/Cortex/Router/RouteFilterIterator.php b/src/Cortex/Router/RouteFilterIterator.php index 057e0e2..48319c7 100644 --- a/src/Cortex/Router/RouteFilterIterator.php +++ b/src/Cortex/Router/RouteFilterIterator.php @@ -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(); diff --git a/src/Cortex/Uri/WordPressUri.php b/src/Cortex/Uri/WordPressUri.php index 3a464e4..e73087e 100644 --- a/src/Cortex/Uri/WordPressUri.php +++ b/src/Cortex/Uri/WordPressUri.php @@ -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)), '/');