From 99b84392f907079dbda2c3392e8e2b4e34c60096 Mon Sep 17 00:00:00 2001 From: DerManoMann Date: Fri, 19 Jun 2026 11:37:40 +1200 Subject: [PATCH 1/5] Remove Lumen support (#61) Lumen was abandoned in 2024. Remove the routing adapter, tests, and CI workflow. Also remove erroneous `laravel/laravel` dev dependency. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/build.yml | 4 -- .github/workflows/lumen.yml | 49 --------------- README.md | 1 - src/Adapters/LumenRoutingAdapter.php | 85 --------------------------- tests/Lumen/CallsApplicationTrait.php | 58 ------------------ tests/Lumen/LumenTest.php | 51 ---------------- tests/Lumen/LumenTestCase.php | 13 ---- tests/Lumen/ParametersTest.php | 58 ------------------ 8 files changed, 319 deletions(-) delete mode 100644 .github/workflows/lumen.yml delete mode 100644 src/Adapters/LumenRoutingAdapter.php delete mode 100644 tests/Lumen/CallsApplicationTrait.php delete mode 100644 tests/Lumen/LumenTest.php delete mode 100644 tests/Lumen/LumenTestCase.php delete mode 100644 tests/Lumen/ParametersTest.php diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5f65788..503da53 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,10 +15,6 @@ jobs: uses: ./.github/workflows/laravel.yml with: php-versions: '8.2,8.3,8.4,8.5' - call-lumen: - uses: ./.github/workflows/lumen.yml - with: - php-versions: '8.2,8.3,8.4,8.5' call-slim: uses: ./.github/workflows/slim.yml with: diff --git a/.github/workflows/lumen.yml b/.github/workflows/lumen.yml deleted file mode 100644 index 6b356fd..0000000 --- a/.github/workflows/lumen.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: lumen - -on: - workflow_call: - inputs: - php-versions: - required: true - type: string - -jobs: - test: - runs-on: ${{ matrix.operating-system }} - env: - COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}' - COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - strategy: - fail-fast: true - matrix: - operating-system: [ ubuntu-latest ] - php: ${{ fromJson(format('[{0}]', inputs.php-versions)) }} - lumen: [ '10.0' ] - dependencies: [ 'highest' ] - - name: PHP ${{ matrix.php }} / Lumen ${{ matrix.lumen }} on ${{ matrix.operating-system }} with ${{ matrix.dependencies }} dependencies - - steps: - - uses: actions/checkout@v6 - name: Checkout repository - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: pcov - - - name: Install framework deps - run: | - composer require --dev laravel/lumen "^${{ matrix.lumen }}" -W - - - name: Composer install - uses: ramsey/composer-install@v4 - with: - dependency-versions: ${{ matrix.dependencies }} - composer-options: ${{ matrix.composer-options }} - - - name: PHPUnit + Code coverage - run: | - mkdir -p build/logs - vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml diff --git a/README.md b/README.md index 99f8174..ea4ea4f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ Allows to (re-)use [Swagger-PHP](https://github.com/zircote/swagger-php) attribu to configure routes in the following frameworks: * [Laravel](https://github.com/laravel/laravel) -* [Lumen](https://github.com/laravel/lumen) * [Slim](https://github.com/slimphp/Slim) diff --git a/src/Adapters/LumenRoutingAdapter.php b/src/Adapters/LumenRoutingAdapter.php deleted file mode 100644 index 06b79c9..0000000 --- a/src/Adapters/LumenRoutingAdapter.php +++ /dev/null @@ -1,85 +0,0 @@ -app = $app; - $this->options = array_merge([ - static::OPTION_AUTO_REGEX => true, - static::OPTION_NAMESPACE => 'App\\Http\\Controllers\\', - ], $options); - } - - /** - * @inheritdoc - */ - public function register(Operation $operation, string $controller, array $parameters, array $custom): void - { - $path = $operation->path; - $controller = str_replace('::__invoke', '', $controller); - if ($namespace = $this->options[self::OPTION_NAMESPACE]) { - $controller = str_replace($namespace, '', $controller); - } - - /** @var Parameter $parameter */ - foreach ($parameters as $name => $parameter) { - if (!$parameter['required']) { - if (false !== strpos($path, $needle = "/{{$name}}[/{")) { - // multiple optional parameters - $path = preg_replace("#/{{$name}}(\[?.*}\])#", "[/{{$name}}$1]", $path); - } else { - $path = str_replace("/{{$name}}", "[/{{$name}}]", $path); - } - } - - switch ($parameter['type']) { - case 'regex': - if ($pattern = $parameter['pattern']) { - $path = str_replace("{{$name}}", "{{$name}:$pattern}", $path); - } - break; - - case 'integer': - if ($this->options[self::OPTION_AUTO_REGEX]) { - $path = str_replace("{{$name}}", "{{$name}:[0-9]+}", $path); - } - break; - } - } - - /** @var Router $router */ - $router = $this->app->router; - - $action = [ - 'uses' => str_replace('::', '@', $controller), - ]; - if ($custom[static::X_NAME]) { - $action['as'] = $custom[static::X_NAME]; - } - - $router->addRoute(strtoupper($operation->method), $path, $action); - } - - /** - * @inheritdoc - */ - public function registerCached(): bool - { - return false; - } -} diff --git a/tests/Lumen/CallsApplicationTrait.php b/tests/Lumen/CallsApplicationTrait.php deleted file mode 100644 index 6158ae8..0000000 --- a/tests/Lumen/CallsApplicationTrait.php +++ /dev/null @@ -1,58 +0,0 @@ -markTestSkipped('not installed.'); - } - parent::setUp(); - } - - /** @inheritdoc */ - public function createApplication() - { - $app = new Application(); - app('config')->set([ - 'app.environment' => 'local', - 'app.debug' => true, - ]); - - $options = [ - OpenApiRouter::OPTION_OA_INFO_INJECT => true, - OpenApiRouter::OPTION_OA_OPERATION_ID_AS_NAME => true, - ]; - - (new OpenApiRouter($this->getFixtureFinder(), new LumenRoutingAdapter($app), $options)) - ->registerRoutes(); - $openapi = (new OpenApiRouter($this->getFixtureFinder(), new LumenRoutingAdapter($app), $options)) - ->scan(); - file_put_contents(__DIR__ . '/openapi.yaml', $openapi->toYaml()); - - return $app; - } - - protected function getRouter(?Application $app = null): Router - { - $app = $app ?: $this->app; - - return $app->router; - } - - public function route($name, $parameters = [], $secure = null) - { - return $this->app['url']->route($name, $parameters, $secure); - } -} diff --git a/tests/Lumen/LumenTest.php b/tests/Lumen/LumenTest.php deleted file mode 100644 index 0f32731..0000000 --- a/tests/Lumen/LumenTest.php +++ /dev/null @@ -1,51 +0,0 @@ -assertTrue(array_key_exists('invoke', $this->getRouter()->namedRoutes)); - } - - /** @test */ - public function invoke() - { - $this->get('/foo/invoke/joe'); - $this->assertEquals(200, $this->response->getStatusCode()); - } - - /** @test */ - public function prefixed() - { - $this->get($this->route('prefixed')); - $this->assertEquals(200, $this->response->getStatusCode()); - - $this->get('foo/prefixed'); - $this->assertEquals(200, $this->response->getStatusCode()); - } - - /** @test */ - public function middleware() - { - $this->get($this->route('mw')); - $this->assertEquals(200, $this->response->getStatusCode()); - } - - /** - * @test - * - * @requires PHP 8.1 - */ - public function attributesPrefixed() - { - $this->get('attributes/prefixed'); - $this->assertEquals(200, $this->response->getStatusCode()); - } -} diff --git a/tests/Lumen/LumenTestCase.php b/tests/Lumen/LumenTestCase.php deleted file mode 100644 index 64a596f..0000000 --- a/tests/Lumen/LumenTestCase.php +++ /dev/null @@ -1,13 +0,0 @@ -get($this->route('hey', ['name' => 'joe'])); - $this->assertEquals(200, $this->response->getStatusCode()); - } - - /** @test */ - public function optionalParameter() - { - $this->get($this->route('oi', ['name' => 'joe'])); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Oi: joe', $this->response->getContent()); - - $this->get($this->route('oi')); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Oi: you', $this->response->getContent()); - } - - /** @test */ - public function typedParameterMatch() - { - $this->get($this->route('id', ['id' => '123'])); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('ID: 123', $this->response->getContent()); - } - - /** @test */ - public function typedParameterFail() - { - $this->get($this->route('id', ['id' => 'x123'])); - $this->assertEquals(404, $this->response->getStatusCode()); - } - - /** @test */ - public function regexParameterMatch() - { - $this->get($this->route('hid', ['hid' => 'a1b2c3'])); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('HID: a1b2c3', $this->response->getContent()); - } - - /** @test */ - public function regexParameterFail() - { - $this->get($this->route('hid', ['hid' => 'za1b2c3'])); - $this->assertEquals(404, $this->response->getStatusCode()); - } -} From f6f6075dfe56928fdd39483313e1ed0207b629e4 Mon Sep 17 00:00:00 2001 From: DerManoMann Date: Fri, 19 Jun 2026 11:39:25 +1200 Subject: [PATCH 2/5] Remove OPTION_NAMESPACE, obsolete since Laravel 8+ Laravel 8 removed controller namespace prefixes from routing, making this option a no-op. Co-Authored-By: Claude Opus 4.6 --- src/Adapters/LaravelRoutingAdapter.php | 4 ---- src/RoutingAdapterInterface.php | 1 - 2 files changed, 5 deletions(-) diff --git a/src/Adapters/LaravelRoutingAdapter.php b/src/Adapters/LaravelRoutingAdapter.php index 5e8901b..93b220d 100644 --- a/src/Adapters/LaravelRoutingAdapter.php +++ b/src/Adapters/LaravelRoutingAdapter.php @@ -21,7 +21,6 @@ public function __construct(Application $app, array $options = []) $this->app = $app; $this->options = array_merge([ static::OPTION_AUTO_REGEX => true, - static::OPTION_NAMESPACE => 'App\\Http\\Controllers\\', ], $options); } @@ -55,9 +54,6 @@ public function register(Operation $operation, string $controller, array $parame } $controller = str_replace('::__invoke', '', $controller); - if ($namespace = $this->options[static::OPTION_NAMESPACE]) { - $controller = str_replace($namespace, '', $controller); - } /** @var Router $router */ $router = $this->app->get('router'); diff --git a/src/RoutingAdapterInterface.php b/src/RoutingAdapterInterface.php index 978ca36..b98a8e7 100644 --- a/src/RoutingAdapterInterface.php +++ b/src/RoutingAdapterInterface.php @@ -13,7 +13,6 @@ interface RoutingAdapterInterface public const X_NAME = 'name'; public const X_MIDDLEWARE = 'middleware'; - public const OPTION_NAMESPACE = 'namespace'; public const OPTION_AUTO_REGEX = 'autoregex'; /** From d654426078ea8be041f5281e70a4733145e9cdbc Mon Sep 17 00:00:00 2001 From: DerManoMann Date: Fri, 19 Jun 2026 11:39:37 +1200 Subject: [PATCH 3/5] . --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5928085..55640a2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ composer.lock vendor/ tests/storage/ tests/*/openapi.yaml +/.claude/settings.local.json From 77146d6bc6a5ed10576272849ac77ac0c0bd0f0c Mon Sep 17 00:00:00 2001 From: DerManoMann Date: Fri, 19 Jun 2026 11:56:31 +1200 Subject: [PATCH 4/5] Drop openapi-extras ^3.0 support and fix middleware order assertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit openapi-extras 4.0 changed middleware ordering (class-level before method-level). Also remove laravel/laravel dev dependency — frameworks are CI-only deps. Co-Authored-By: Claude Opus 4.6 --- composer.json | 2 +- tests/Laravel/LaravelTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index ed30ca7..cb460e0 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ "php": ">=8.2", "psr/log": "^1.1 || ^2.0 || ^3.0", "psr/simple-cache": "^1.0 || ^2.0 || ^3.0", - "radebatz/openapi-extras": "^3.0 || ^4.0", + "radebatz/openapi-extras": "^4.0", "zircote/swagger-php": "^4.11.1 || ^5.0.2 || ^6.0" }, "require-dev": { diff --git a/tests/Laravel/LaravelTest.php b/tests/Laravel/LaravelTest.php index 0913184..e2901bf 100644 --- a/tests/Laravel/LaravelTest.php +++ b/tests/Laravel/LaravelTest.php @@ -56,6 +56,6 @@ public function attributesMiddleware() $route = $this->getRouter()->getRoutes()->getByName('attributes'); $this->assertNotNull($route); - $this->assertEquals([BarMiddleware::class, FooMiddleware::class], $route->gatherMiddleware()); + $this->assertSame([FooMiddleware::class, BarMiddleware::class], $route->gatherMiddleware()); } } From b6e08337b76661424942f000675376ff7eecc815 Mon Sep 17 00:00:00 2001 From: DerManoMann Date: Fri, 19 Jun 2026 12:01:50 +1200 Subject: [PATCH 5/5] . --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index cb460e0..1f40b64 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ "php": ">=8.2", "psr/log": "^1.1 || ^2.0 || ^3.0", "psr/simple-cache": "^1.0 || ^2.0 || ^3.0", - "radebatz/openapi-extras": "^4.0", + "radebatz/openapi-extras": "^4.2", "zircote/swagger-php": "^4.11.1 || ^5.0.2 || ^6.0" }, "require-dev": {