diff --git a/composer.json b/composer.json index db3247e..d949bf7 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "prefer-stable": true, "scripts": { "cs": "php-cs-fixer fix --allow-risky=yes", - "rector": "rector process src test", + "rector": "rector process src tests", "lint": [ "@cs --dry-run", "@rector --dry-run" diff --git a/rector.php b/rector.php index a5a5306..cf258a1 100644 --- a/rector.php +++ b/rector.php @@ -9,4 +9,4 @@ TypedPropertyFromStrictConstructorRector::class ]) ->withPreparedSets(true, true) - ->withPhpVersion(PhpVersion::PHP_74); + ->withPhpVersion(PhpVersion::PHP_81); diff --git a/tests/Concerns/Fixtures.php b/tests/Concerns/Fixtures.php index 9a838b7..b9800de 100644 --- a/tests/Concerns/Fixtures.php +++ b/tests/Concerns/Fixtures.php @@ -9,15 +9,11 @@ trait Fixtures public function getFixtureFinder(): Finder { $controllersDir = __DIR__ . '/../Fixtures/Controllers'; - $finder = (new Finder()) + + return (new Finder()) ->files() ->followLinks() ->name('*.php') ->in($controllersDir); - if (\PHP_VERSION_ID < 80100) { - $finder->notName('AttributeController.php'); - } - - return $finder; } } diff --git a/tests/Fixtures/Controllers/AttributeController.php b/tests/Fixtures/Controllers/AttributeController.php index 36c8125..a72f491 100644 --- a/tests/Fixtures/Controllers/AttributeController.php +++ b/tests/Fixtures/Controllers/AttributeController.php @@ -7,18 +7,16 @@ use Radebatz\OpenApi\Routing\Tests\Fixtures\Middleware\BarMiddleware; use Radebatz\OpenApi\Routing\Tests\Fixtures\Middleware\FooMiddleware; -if (\PHP_VERSION_ID >= 80100) { - #[OAX\Controller(prefix: '/attributes')] - #[OAT\Response(response: 403, description: 'Not allowed')] - #[OAX\Middleware([FooMiddleware::class])] - class AttributeController +#[OAX\Controller(prefix: '/attributes')] +#[OAT\Response(response: 403, description: 'Not allowed')] +#[OAX\Middleware([FooMiddleware::class])] +class AttributeController +{ + #[OAT\Get(path: '/prefixed', x: ['name' => 'attributes'])] + #[OAT\Response(response: 200, description: 'All good')] + #[OAX\Middleware([BarMiddleware::class])] + public function prefixed() { - #[OAT\Get(path: '/prefixed', x: ['name' => 'attributes'])] - #[OAT\Response(response: 200, description: 'All good')] - #[OAX\Middleware([BarMiddleware::class])] - public function prefixed() - { - return FakeResponse::create('Get fooya'); - } + return FakeResponse::create('Get fooya'); } } diff --git a/tests/Laravel/CachingTest.php b/tests/Laravel/CachingTest.php index 883071f..5bdfc65 100644 --- a/tests/Laravel/CachingTest.php +++ b/tests/Laravel/CachingTest.php @@ -43,7 +43,7 @@ public function testReload(?CacheInterface $cache, $reload, $openapisCached) $router = $app['router']; $this->assertNotNull($router->getRoutes()->getByName('getya')); - $this->assertEquals($openapisCached, $cache ? $cache->has(OpenApiRouter::CACHE_KEY_OPENAPI) : false); + $this->assertEquals($openapisCached, $cache && $cache->has(OpenApiRouter::CACHE_KEY_OPENAPI)); } protected function getApp(): Application diff --git a/tests/Laravel/CallsApplicationTrait.php b/tests/Laravel/CallsApplicationTrait.php index 94780a7..d81f055 100644 --- a/tests/Laravel/CallsApplicationTrait.php +++ b/tests/Laravel/CallsApplicationTrait.php @@ -14,7 +14,7 @@ trait CallsApplicationTrait { use Fixtures; - protected $app = null; + protected $app; protected function setUp(): void { diff --git a/tests/Lumen/LumenTest.php b/tests/Lumen/LumenTest.php index 18e2bc8..0f32731 100644 --- a/tests/Lumen/LumenTest.php +++ b/tests/Lumen/LumenTest.php @@ -4,6 +4,8 @@ class LumenTest extends LumenTestCase { + public $response; + use CallsApplicationTrait; /** @test */ diff --git a/tests/Lumen/ParametersTest.php b/tests/Lumen/ParametersTest.php index 25121b4..c1ea2b3 100644 --- a/tests/Lumen/ParametersTest.php +++ b/tests/Lumen/ParametersTest.php @@ -4,6 +4,7 @@ class ParametersTest extends LumenTestCase { + public $response; use CallsApplicationTrait; /** @test */ diff --git a/tests/Slim4/CallsControllerTrait.php b/tests/Slim/CallsControllerTrait.php similarity index 96% rename from tests/Slim4/CallsControllerTrait.php rename to tests/Slim/CallsControllerTrait.php index a84c725..1dca745 100644 --- a/tests/Slim4/CallsControllerTrait.php +++ b/tests/Slim/CallsControllerTrait.php @@ -1,6 +1,6 @@