diff --git a/.gitignore b/.gitignore index 54b1495..9db5212 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ composer-extra-assets.lock .env /tests/storage/api-docs/* /tests/storage/logs/* +.phpunit.cache .bowerrc bower.json package.json diff --git a/Dockerfile b/Dockerfile index b8267ea..6df5a79 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # # Base install # -FROM amd64/php:8.0-apache as base +FROM amd64/php:8.1-apache as base LABEL vendor="L5 Swagger" diff --git a/composer.json b/composer.json index 109bde9..25bd75d 100644 --- a/composer.json +++ b/composer.json @@ -20,16 +20,16 @@ ], "require": { "php": "^7.2 || ^8.0", - "laravel/framework": "^9.0 || >=8.40.0 || ^7.0", - "zircote/swagger-php": "^3.2 || ^4.0", + "laravel/framework": "^10.0 || ^9.0 || >=8.40.0 || ^7.0", + "zircote/swagger-php": "^3.2.0 || ^4.0.0", "swagger-api/swagger-ui": "^3.0 || ^4.0", "symfony/yaml": "^5.0 || ^6.0", "ext-json": "*" }, "require-dev": { - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^10.0 || ^9.5", "mockery/mockery": "1.*", - "orchestra/testbench": "7.* || ^6.15 || 5.*", + "orchestra/testbench": "^8.0 || 7.* || ^6.15 || 5.*", "php-coveralls/php-coveralls": "^2.0" }, "autoload": { diff --git a/phpunit.xml b/phpunit.xml index 1233bbf..11e592b 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,12 +1,11 @@ - diff --git a/src/Generator.php b/src/Generator.php index bbfb8a3..0e0dacc 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -202,10 +202,12 @@ protected function createOpenApiGenerator(): OpenApiGenerator { $generator = new OpenApiGenerator(); - // OpenApi spec version. - $generator->setVersion( - $this->scanOptions['open_api_spec_version'] ?? self::OPEN_API_DEFAULT_SPEC_VERSION - ); + // OpenApi spec version - only from zircote/swagger-php 4 + if (method_exists($generator, 'setVersion')) { + $generator->setVersion( + $this->scanOptions['open_api_spec_version'] ?? self::OPEN_API_DEFAULT_SPEC_VERSION + ); + } // Processors. $this->setProcessors($generator); diff --git a/tests/ConfigFactoryTest.php b/tests/ConfigFactoryTest.php index 57fd35e..7b44da5 100644 --- a/tests/ConfigFactoryTest.php +++ b/tests/ConfigFactoryTest.php @@ -57,7 +57,7 @@ public function canMergeConfigurationDeep(array $data, array $assert): void $this->assertArraySimilar($config, $assert); } - public function configDataProvider(): array + public static function configDataProvider(): array { return [ [ diff --git a/tests/ConsoleTest.php b/tests/ConsoleTest.php index 4e62ff0..f0b0ede 100644 --- a/tests/ConsoleTest.php +++ b/tests/ConsoleTest.php @@ -2,6 +2,7 @@ namespace Tests; +use Illuminate\Contracts\Filesystem\FileNotFoundException; use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Facades\Artisan; use L5Swagger\Exceptions\L5SwaggerException; @@ -18,6 +19,7 @@ class ConsoleTest extends TestCase * @param string $artisanCommand * * @throws L5SwaggerException + * @throws FileNotFoundException */ public function canGenerate(string $artisanCommand): void { @@ -38,7 +40,7 @@ public function canGenerate(string $artisanCommand): void /** * @return iterable */ - public function provideGenerateCommands(): iterable + public static function provideGenerateCommands(): iterable { yield 'default' => [ 'artisanCommand' => 'l5-swagger:generate', diff --git a/tests/SecurityDefinitionsTest.php b/tests/SecurityDefinitionsTest.php index 94e3ccf..c3eaea5 100644 --- a/tests/SecurityDefinitionsTest.php +++ b/tests/SecurityDefinitionsTest.php @@ -97,7 +97,7 @@ public function canGenerateApiJsonFileWithSecurityDefinition( /** * @return iterable */ - public function provideConfigAndSchemes(): iterable + public static function provideConfigAndSchemes(): iterable { $securitySchemes = [ 'new_api_key_securitye' => [