From 626151c2c37c3fdad4ab4b3627fd1732f7ac24c3 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Thu, 9 Nov 2023 07:19:57 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Builder/GroupBuilder.php | 2 +- src/Builder/RouteBuilder.php | 4 +--- src/Group.php | 4 ++-- src/RouteCollection.php | 4 +--- src/RouteCollector.php | 2 +- src/RouteCollectorInterface.php | 2 +- tests/Builder/GroupBuilderTest.php | 1 - tests/Builder/RouteBuilderTest.php | 1 - tests/Debug/RouterCollectorTest.php | 1 - tests/GroupTest.php | 2 +- 10 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/Builder/GroupBuilder.php b/src/Builder/GroupBuilder.php index 9268b80..55fc5c2 100644 --- a/src/Builder/GroupBuilder.php +++ b/src/Builder/GroupBuilder.php @@ -12,7 +12,7 @@ final class GroupBuilder implements RoutableInterface { /** - * @var Group[]|Route[]|RoutableInterface[] + * @var Group[]|RoutableInterface[]|Route[] */ private array $routes = []; diff --git a/src/Builder/RouteBuilder.php b/src/Builder/RouteBuilder.php index f00607a..f87bd7d 100644 --- a/src/Builder/RouteBuilder.php +++ b/src/Builder/RouteBuilder.php @@ -10,8 +10,6 @@ use Yiisoft\Router\RoutableInterface; use Yiisoft\Router\Route; -use function in_array; - /** * Route defines a mapping from URL to callback / name and vice versa. */ @@ -20,7 +18,7 @@ final class RouteBuilder implements RoutableInterface private ?string $name = null; /** - * @var array|string|callable|null + * @var array|callable|string|null */ private $action = null; diff --git a/src/Group.php b/src/Group.php index f1b2783..f34b54f 100644 --- a/src/Group.php +++ b/src/Group.php @@ -9,7 +9,7 @@ final class Group { /** - * @var Group[]|Route[]|RoutableInterface[] + * @var Group[]|RoutableInterface[]|Route[] */ private array $routes = []; @@ -195,7 +195,7 @@ private function assertMiddlewares(array $middlewares): void */ private function assertRoutes(array $routes): void { - /** @var Route|Group|RoutableInterface $route */ + /** @var Group|RoutableInterface|Route $route */ foreach ($routes as $route) { if ($route instanceof Route || $route instanceof self || $route instanceof RoutableInterface) { continue; diff --git a/src/RouteCollection.php b/src/RouteCollection.php index 0b167ff..10a29a3 100644 --- a/src/RouteCollection.php +++ b/src/RouteCollection.php @@ -8,8 +8,6 @@ use Psr\Http\Message\ResponseFactoryInterface; use Yiisoft\Http\Method; -use Yiisoft\Router\Builder\RouteBuilder; - use function array_key_exists; use function in_array; use function is_array; @@ -67,7 +65,7 @@ private function ensureItemsInjected(): void /** * Build routes array. * - * @param Group[]|Route[]|RoutableInterface[] $items + * @param Group[]|RoutableInterface[]|Route[] $items */ private function injectItems(array $items): void { diff --git a/src/RouteCollector.php b/src/RouteCollector.php index 52c9d0f..8c4d365 100644 --- a/src/RouteCollector.php +++ b/src/RouteCollector.php @@ -7,7 +7,7 @@ final class RouteCollector implements RouteCollectorInterface { /** - * @var Group[]|Route[]|RoutableInterface[] + * @var Group[]|RoutableInterface[]|Route[] */ private array $items = []; diff --git a/src/RouteCollectorInterface.php b/src/RouteCollectorInterface.php index 8cf56aa..711c83d 100644 --- a/src/RouteCollectorInterface.php +++ b/src/RouteCollectorInterface.php @@ -24,7 +24,7 @@ public function middleware(array|callable|string ...$definition): self; public function prependMiddleware(array|callable|string ...$definition): self; /** - * @return Group[]|Route[]|RoutableInterface[] + * @return Group[]|RoutableInterface[]|Route[] */ public function getItems(): array; diff --git a/tests/Builder/GroupBuilderTest.php b/tests/Builder/GroupBuilderTest.php index 4541ddc..7526d05 100644 --- a/tests/Builder/GroupBuilderTest.php +++ b/tests/Builder/GroupBuilderTest.php @@ -273,7 +273,6 @@ public function testName(): void $this->assertSame('api', $group->toRoute()->getNamePrefix()); } - public function testWithCors(): void { $group = Group::create() diff --git a/tests/Builder/RouteBuilderTest.php b/tests/Builder/RouteBuilderTest.php index 68cdca5..3596ca3 100644 --- a/tests/Builder/RouteBuilderTest.php +++ b/tests/Builder/RouteBuilderTest.php @@ -12,7 +12,6 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; -use RuntimeException; use Yiisoft\Http\Method; use Yiisoft\Middleware\Dispatcher\MiddlewareDispatcher; use Yiisoft\Middleware\Dispatcher\MiddlewareFactory; diff --git a/tests/Debug/RouterCollectorTest.php b/tests/Debug/RouterCollectorTest.php index 4c375b4..e13b71b 100644 --- a/tests/Debug/RouterCollectorTest.php +++ b/tests/Debug/RouterCollectorTest.php @@ -11,7 +11,6 @@ use Yiisoft\Router\Builder\GroupBuilder; use Yiisoft\Router\Builder\RouteBuilder; use Yiisoft\Router\Debug\RouterCollector; -use Yiisoft\Router\Group; use Yiisoft\Router\Route; use Yiisoft\Router\RouteCollection; use Yiisoft\Router\RouteCollectionInterface; diff --git a/tests/GroupTest.php b/tests/GroupTest.php index aa82bb6..39e64dd 100644 --- a/tests/GroupTest.php +++ b/tests/GroupTest.php @@ -50,7 +50,7 @@ public function testSetMiddlewaresAfterGetEnabledMiddlewares(): void public function testDisableMiddlewareAfterGetEnabledMiddlewares(): void { - $group = (new Group) + $group = (new Group()) ->setMiddlewares([TestMiddleware1::class, TestMiddleware2::class, TestMiddleware3::class]); $group->getEnabledMiddlewares();