Skip to content

Commit 8e61ce6

Browse files
Laravel 10 support (#525)
* WIP: Laravel 10 support * WIP: Laravel 10 support * fix #497 * Use php8.1 for doceker and phpunit 10 * Update usage of phpunit 10 * Apply fixes from StyleCI * Add to gitignore .phpunit.cache --------- Co-authored-by: StyleCI Bot <bot@styleci.io>
1 parent 0b1c3f5 commit 8e61ce6

File tree

8 files changed

+24
-20
lines changed

8 files changed

+24
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ composer-extra-assets.lock
88
.env
99
/tests/storage/api-docs/*
1010
/tests/storage/logs/*
11+
.phpunit.cache
1112
.bowerrc
1213
bower.json
1314
package.json

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# Base install
33
#
4-
FROM amd64/php:8.0-apache as base
4+
FROM amd64/php:8.1-apache as base
55

66
LABEL vendor="L5 Swagger"
77

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020
],
2121
"require": {
2222
"php": "^7.2 || ^8.0",
23-
"laravel/framework": "^9.0 || >=8.40.0 || ^7.0",
24-
"zircote/swagger-php": "^3.2 || ^4.0",
23+
"laravel/framework": "^10.0 || ^9.0 || >=8.40.0 || ^7.0",
24+
"zircote/swagger-php": "^3.2.0 || ^4.0.0",
2525
"swagger-api/swagger-ui": "^3.0 || ^4.0",
2626
"symfony/yaml": "^5.0 || ^6.0",
2727
"ext-json": "*"
2828
},
2929
"require-dev": {
30-
"phpunit/phpunit": "^9.5",
30+
"phpunit/phpunit": "^10.0 || ^9.5",
3131
"mockery/mockery": "1.*",
32-
"orchestra/testbench": "7.* || ^6.15 || 5.*",
32+
"orchestra/testbench": "^8.0 || 7.* || ^6.15 || 5.*",
3333
"php-coveralls/php-coveralls": "^2.0"
3434
},
3535
"autoload": {

phpunit.xml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
4-
bootstrap="vendor/autoload.php"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
stopOnFailure="false"
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
5+
bootstrap="vendor/autoload.php"
6+
colors="true"
7+
stopOnFailure="false"
8+
cacheDirectory=".phpunit.cache"
109
>
1110
<coverage>
1211
<include>

src/Generator.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,12 @@ protected function createOpenApiGenerator(): OpenApiGenerator
202202
{
203203
$generator = new OpenApiGenerator();
204204

205-
// OpenApi spec version.
206-
$generator->setVersion(
207-
$this->scanOptions['open_api_spec_version'] ?? self::OPEN_API_DEFAULT_SPEC_VERSION
208-
);
205+
// OpenApi spec version - only from zircote/swagger-php 4
206+
if (method_exists($generator, 'setVersion')) {
207+
$generator->setVersion(
208+
$this->scanOptions['open_api_spec_version'] ?? self::OPEN_API_DEFAULT_SPEC_VERSION
209+
);
210+
}
209211

210212
// Processors.
211213
$this->setProcessors($generator);

tests/ConfigFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function canMergeConfigurationDeep(array $data, array $assert): void
5757
$this->assertArraySimilar($config, $assert);
5858
}
5959

60-
public function configDataProvider(): array
60+
public static function configDataProvider(): array
6161
{
6262
return [
6363
[

tests/ConsoleTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Tests;
44

5+
use Illuminate\Contracts\Filesystem\FileNotFoundException;
56
use Illuminate\Filesystem\Filesystem;
67
use Illuminate\Support\Facades\Artisan;
78
use L5Swagger\Exceptions\L5SwaggerException;
@@ -18,6 +19,7 @@ class ConsoleTest extends TestCase
1819
* @param string $artisanCommand
1920
*
2021
* @throws L5SwaggerException
22+
* @throws FileNotFoundException
2123
*/
2224
public function canGenerate(string $artisanCommand): void
2325
{
@@ -38,7 +40,7 @@ public function canGenerate(string $artisanCommand): void
3840
/**
3941
* @return iterable
4042
*/
41-
public function provideGenerateCommands(): iterable
43+
public static function provideGenerateCommands(): iterable
4244
{
4345
yield 'default' => [
4446
'artisanCommand' => 'l5-swagger:generate',

tests/SecurityDefinitionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function canGenerateApiJsonFileWithSecurityDefinition(
9797
/**
9898
* @return iterable
9999
*/
100-
public function provideConfigAndSchemes(): iterable
100+
public static function provideConfigAndSchemes(): iterable
101101
{
102102
$securitySchemes = [
103103
'new_api_key_securitye' => [

0 commit comments

Comments
 (0)