From 038eae56f987a2511eb0c9a5c85ecbb4e4d7c7d3 Mon Sep 17 00:00:00 2001 From: James Read Date: Thu, 29 Feb 2024 21:37:03 +0800 Subject: [PATCH 01/11] Bumping PHP Version Bumping PHP versionn to 8.3 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b74219b9a..2ecd45a2d 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ } ], "require": { - "php": "^7.4 || ^8.0", + "php": "^8.3", "ext-json": "*", "monolog/monolog": "^2.9", "php-di/php-di": "^6.4", From 543c4ff49c3b9651d334a679c2f57cfa54112912 Mon Sep 17 00:00:00 2001 From: James Read Date: Thu, 29 Feb 2024 21:45:42 +0800 Subject: [PATCH 02/11] Constructor property promotion changing constructors to user new syntax where it makes sense --- src/Application/Actions/Action.php | 10 +++--- src/Application/Actions/ActionError.php | 34 +++--------------- src/Application/Actions/ActionPayload.php | 36 ++----------------- src/Application/Actions/User/UserAction.php | 9 +++-- src/Application/Handlers/HttpErrorHandler.php | 23 ++++++------ src/Application/Handlers/ShutdownHandler.php | 12 ++----- src/Application/Settings/Settings.php | 7 ++-- src/Domain/User/User.php | 11 +++--- 8 files changed, 40 insertions(+), 102 deletions(-) diff --git a/src/Application/Actions/Action.php b/src/Application/Actions/Action.php index 1021c2023..ebd4f1908 100644 --- a/src/Application/Actions/Action.php +++ b/src/Application/Actions/Action.php @@ -13,17 +13,17 @@ abstract class Action { - protected LoggerInterface $logger; - protected Request $request; protected Response $response; + /** + * @var array + */ protected array $args; - public function __construct(LoggerInterface $logger) + public function __construct(protected LoggerInterface $logger) { - $this->logger = $logger; } /** @@ -87,6 +87,6 @@ protected function respond(ActionPayload $payload): Response return $this->response ->withHeader('Content-Type', 'application/json') - ->withStatus($payload->getStatusCode()); + ->withStatus($payload->statusCode); } } diff --git a/src/Application/Actions/ActionError.php b/src/Application/Actions/ActionError.php index 3a81cc53f..8b36f36cd 100644 --- a/src/Application/Actions/ActionError.php +++ b/src/Application/Actions/ActionError.php @@ -18,36 +18,10 @@ class ActionError implements JsonSerializable public const VALIDATION_ERROR = 'VALIDATION_ERROR'; public const VERIFICATION_ERROR = 'VERIFICATION_ERROR'; - private string $type; - - private ?string $description; - - public function __construct(string $type, ?string $description = null) - { - $this->type = $type; - $this->description = $description; - } - - public function getType(): string - { - return $this->type; - } - - public function setType(string $type): self - { - $this->type = $type; - return $this; - } - - public function getDescription(): ?string - { - return $this->description; - } - - public function setDescription(?string $description = null): self - { - $this->description = $description; - return $this; + public function __construct( + public readonly string $type, + public readonly ?string $description = null + ) { } #[\ReturnTypeWillChange] diff --git a/src/Application/Actions/ActionPayload.php b/src/Application/Actions/ActionPayload.php index cbf511040..6137e4a2a 100644 --- a/src/Application/Actions/ActionPayload.php +++ b/src/Application/Actions/ActionPayload.php @@ -8,41 +8,11 @@ class ActionPayload implements JsonSerializable { - private int $statusCode; - - /** - * @var array|object|null - */ - private $data; - - private ?ActionError $error; - public function __construct( - int $statusCode = 200, - $data = null, - ?ActionError $error = null + public readonly int $statusCode = 200, + public readonly array|object|null $data = null, + public ?ActionError $error = null ) { - $this->statusCode = $statusCode; - $this->data = $data; - $this->error = $error; - } - - public function getStatusCode(): int - { - return $this->statusCode; - } - - /** - * @return array|null|object - */ - public function getData() - { - return $this->data; - } - - public function getError(): ?ActionError - { - return $this->error; } #[\ReturnTypeWillChange] diff --git a/src/Application/Actions/User/UserAction.php b/src/Application/Actions/User/UserAction.php index 4ea2d8caf..dbc7ae8ff 100644 --- a/src/Application/Actions/User/UserAction.php +++ b/src/Application/Actions/User/UserAction.php @@ -10,11 +10,10 @@ abstract class UserAction extends Action { - protected UserRepository $userRepository; - - public function __construct(LoggerInterface $logger, UserRepository $userRepository) - { + public function __construct( + LoggerInterface $logger, + protected UserRepository $userRepository + ) { parent::__construct($logger); - $this->userRepository = $userRepository; } } diff --git a/src/Application/Handlers/HttpErrorHandler.php b/src/Application/Handlers/HttpErrorHandler.php index 64e02b1e3..275bbad90 100644 --- a/src/Application/Handlers/HttpErrorHandler.php +++ b/src/Application/Handlers/HttpErrorHandler.php @@ -26,27 +26,25 @@ protected function respond(): Response { $exception = $this->exception; $statusCode = 500; - $error = new ActionError( - ActionError::SERVER_ERROR, - 'An internal error has occurred while processing your request.' - ); + $errorType = ActionError::SERVER_ERROR; + $description = 'An internal error has occurred while processing your request.'; if ($exception instanceof HttpException) { $statusCode = $exception->getCode(); - $error->setDescription($exception->getMessage()); + $description = $exception->getMessage(); if ($exception instanceof HttpNotFoundException) { - $error->setType(ActionError::RESOURCE_NOT_FOUND); + $errorType = ActionError::RESOURCE_NOT_FOUND; } elseif ($exception instanceof HttpMethodNotAllowedException) { - $error->setType(ActionError::NOT_ALLOWED); + $errorType = ActionError::NOT_ALLOWED; } elseif ($exception instanceof HttpUnauthorizedException) { - $error->setType(ActionError::UNAUTHENTICATED); + $errorType = ActionError::UNAUTHENTICATED; } elseif ($exception instanceof HttpForbiddenException) { - $error->setType(ActionError::INSUFFICIENT_PRIVILEGES); + $errorType = ActionError::INSUFFICIENT_PRIVILEGES; } elseif ($exception instanceof HttpBadRequestException) { - $error->setType(ActionError::BAD_REQUEST); + $errorType = ActionError::BAD_REQUEST; } elseif ($exception instanceof HttpNotImplementedException) { - $error->setType(ActionError::NOT_IMPLEMENTED); + $errorType = ActionError::NOT_IMPLEMENTED; } } @@ -55,9 +53,10 @@ protected function respond(): Response && $exception instanceof Throwable && $this->displayErrorDetails ) { - $error->setDescription($exception->getMessage()); + $description = $exception->getMessage(); } + $error = new ActionError($errorType, $description); $payload = new ActionPayload($statusCode, null, $error); $encodedPayload = json_encode($payload, JSON_PRETTY_PRINT); diff --git a/src/Application/Handlers/ShutdownHandler.php b/src/Application/Handlers/ShutdownHandler.php index 72b6d46ea..20cecbdb1 100644 --- a/src/Application/Handlers/ShutdownHandler.php +++ b/src/Application/Handlers/ShutdownHandler.php @@ -10,16 +10,10 @@ class ShutdownHandler { - private Request $request; - - private HttpErrorHandler $errorHandler; - - private bool $displayErrorDetails; - public function __construct( - Request $request, - HttpErrorHandler $errorHandler, - bool $displayErrorDetails + private Request $request, + private HttpErrorHandler $errorHandler, + private bool $displayErrorDetails ) { $this->request = $request; $this->errorHandler = $errorHandler; diff --git a/src/Application/Settings/Settings.php b/src/Application/Settings/Settings.php index 6da55e4e8..09318f8e2 100644 --- a/src/Application/Settings/Settings.php +++ b/src/Application/Settings/Settings.php @@ -6,9 +6,10 @@ class Settings implements SettingsInterface { - private array $settings; - - public function __construct(array $settings) + /** + * @param array $settings + */ + public function __construct(private array $settings) { $this->settings = $settings; } diff --git a/src/Domain/User/User.php b/src/Domain/User/User.php index 217bb9ebf..8bbf7cd7d 100644 --- a/src/Domain/User/User.php +++ b/src/Domain/User/User.php @@ -8,17 +8,18 @@ class User implements JsonSerializable { - private ?int $id; - private string $username; private string $firstName; private string $lastName; - public function __construct(?int $id, string $username, string $firstName, string $lastName) - { - $this->id = $id; + public function __construct( + private readonly int|null $id, + string $username, + string $firstName, + string $lastName + ) { $this->username = strtolower($username); $this->firstName = ucfirst($firstName); $this->lastName = ucfirst($lastName); From 8f4b489cc13089322a32cfbb020249ae0f508e6d Mon Sep 17 00:00:00 2001 From: James Read Date: Thu, 29 Feb 2024 22:18:16 +0800 Subject: [PATCH 03/11] replace if else with match using match to get get error message --- src/Application/Handlers/ShutdownHandler.php | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/Application/Handlers/ShutdownHandler.php b/src/Application/Handlers/ShutdownHandler.php index 20cecbdb1..e36152428 100644 --- a/src/Application/Handlers/ShutdownHandler.php +++ b/src/Application/Handlers/ShutdownHandler.php @@ -52,18 +52,10 @@ private function getErrorMessage(array $error): string $errorMessage = $error['message']; $errorType = $error['type']; - if ($errorType === E_USER_ERROR) { - return "FATAL ERROR: {$errorMessage}. on line {$errorLine} in file {$errorFile}."; - } - - if ($errorType === E_USER_WARNING) { - return "WARNING: {$errorMessage}"; - } - - if ($errorType === E_USER_NOTICE) { - return "NOTICE: {$errorMessage}"; - } - - return "FATAL ERROR: {$errorMessage}. on line {$errorLine} in file {$errorFile}."; + return match ($errorType) { + E_USER_WARNING => "WARNING: {$errorMessage}", + E_USER_NOTICE => "NOTICE: {$errorMessage}", + default => "FATAL ERROR: {$errorMessage}. on line {$errorLine} in file {$errorFile}." + }; } } From a57d708fd58393cb521a07e5717cd2806797aea9 Mon Sep 17 00:00:00 2001 From: James Read Date: Thu, 29 Feb 2024 22:20:46 +0800 Subject: [PATCH 04/11] Union Types Adding union types for better type hinting --- src/Application/Actions/Action.php | 10 ++-------- src/Application/Handlers/ShutdownHandler.php | 8 ++++---- src/Application/Settings/Settings.php | 7 ++----- src/Application/Settings/SettingsInterface.php | 6 +----- 4 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/Application/Actions/Action.php b/src/Application/Actions/Action.php index ebd4f1908..bd146cbb2 100644 --- a/src/Application/Actions/Action.php +++ b/src/Application/Actions/Action.php @@ -49,10 +49,7 @@ public function __invoke(Request $request, Response $response, array $args): Res */ abstract protected function action(): Response; - /** - * @return array|object - */ - protected function getFormData() + protected function getFormData(): array|object|null { return $this->request->getParsedBody(); } @@ -70,10 +67,7 @@ protected function resolveArg(string $name) return $this->args[$name]; } - /** - * @param array|object|null $data - */ - protected function respondWithData($data = null, int $statusCode = 200): Response + protected function respondWithData(array|object|null $data = null, int $statusCode = 200): Response { $payload = new ActionPayload($statusCode, $data); diff --git a/src/Application/Handlers/ShutdownHandler.php b/src/Application/Handlers/ShutdownHandler.php index e36152428..2f9b58eb0 100644 --- a/src/Application/Handlers/ShutdownHandler.php +++ b/src/Application/Handlers/ShutdownHandler.php @@ -15,9 +15,6 @@ public function __construct( private HttpErrorHandler $errorHandler, private bool $displayErrorDetails ) { - $this->request = $request; - $this->errorHandler = $errorHandler; - $this->displayErrorDetails = $displayErrorDetails; } public function __invoke() @@ -41,7 +38,10 @@ public function __invoke() $responseEmitter->emit($response); } - private function getErrorMessage(array $error): string + /** + * @param array{type: int, message: string, file: string, line: int} $error + */ + private function getErrorMessage(array $error = null): string { if (!$this->displayErrorDetails) { return 'An error while processing your request. Please try again later.'; diff --git a/src/Application/Settings/Settings.php b/src/Application/Settings/Settings.php index 09318f8e2..40017532f 100644 --- a/src/Application/Settings/Settings.php +++ b/src/Application/Settings/Settings.php @@ -14,11 +14,8 @@ public function __construct(private array $settings) $this->settings = $settings; } - /** - * @return mixed - */ - public function get(string $key = '') + public function get(string $key = ''): mixed { - return (empty($key)) ? $this->settings : $this->settings[$key]; + return empty($key) ? $this->settings : $this->settings[$key]; } } diff --git a/src/Application/Settings/SettingsInterface.php b/src/Application/Settings/SettingsInterface.php index 557d98b8d..7867c5920 100644 --- a/src/Application/Settings/SettingsInterface.php +++ b/src/Application/Settings/SettingsInterface.php @@ -6,9 +6,5 @@ interface SettingsInterface { - /** - * @param string $key - * @return mixed - */ - public function get(string $key = ''); + public function get(string $key = ''): mixed; } From 08c8b3e2e4d8c47df0b00950be192db863836bb4 Mon Sep 17 00:00:00 2001 From: James Read Date: Fri, 1 Mar 2024 00:55:35 +0800 Subject: [PATCH 05/11] Removing readonly from entity --- src/Domain/User/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domain/User/User.php b/src/Domain/User/User.php index 8bbf7cd7d..e01e8366c 100644 --- a/src/Domain/User/User.php +++ b/src/Domain/User/User.php @@ -15,7 +15,7 @@ class User implements JsonSerializable private string $lastName; public function __construct( - private readonly int|null $id, + private int|null $id, string $username, string $firstName, string $lastName From 61ed8f6ae1114887d609e0a870e9a83f965d1676 Mon Sep 17 00:00:00 2001 From: James Read Date: Fri, 1 Mar 2024 00:56:23 +0800 Subject: [PATCH 06/11] Updating README Updating the php version in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 63f997258..09681f188 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This skeleton application was built for Composer. This makes setting up a new Sl ## Install the Application -Run this command from the directory in which you want to install your new Slim Framework application. You will require PHP 7.4 or newer. +Run this command from the directory in which you want to install your new Slim Framework application. You will require PHP 8.3 or newer. ```bash composer create-project slim/slim-skeleton [my-app-name] From 6fdeda0c25bdd14b547842148a4e3156416ac27c Mon Sep 17 00:00:00 2001 From: James Read Date: Sun, 12 May 2024 14:18:03 +0800 Subject: [PATCH 07/11] chore: Updating CI for PHP 8.3 only --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cd83ec5e1..4cc5b0966 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,10 +10,10 @@ jobs: strategy: fail-fast: false matrix: - php: [7.4, 8.0, 8.1, 8.2] + php: [8.3] experimental: [false] include: - - php: 8.1 + - php: 8.3 analysis: true steps: From f57f24033cd7cd234304b01e91cf46aca3701c81 Mon Sep 17 00:00:00 2001 From: James Read Date: Sun, 19 May 2024 19:24:23 +0800 Subject: [PATCH 08/11] chore: supporting PHP 8.2 Supporting all supported versions of PHP 8.2 and 8.3 --- .github/workflows/tests.yml | 2 +- composer.json | 2 +- public/index.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4cc5b0966..2d0533e95 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - php: [8.3] + php: [8.2, 8.3] experimental: [false] include: - php: 8.3 diff --git a/composer.json b/composer.json index 2ecd45a2d..37a3f127b 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ } ], "require": { - "php": "^8.3", + "php": "^8.2", "ext-json": "*", "monolog/monolog": "^2.9", "php-di/php-di": "^6.4", diff --git a/public/index.php b/public/index.php index bc583c821..75a373228 100644 --- a/public/index.php +++ b/public/index.php @@ -16,7 +16,7 @@ $containerBuilder = new ContainerBuilder(); if (false) { // Should be set to true in production - $containerBuilder->enableCompilation(__DIR__ . '/../var/cache'); + $containerBuilder->enableCompilation(__DIR__ . '/../var/cache'); } // Set up settings From 5a4847a30191da7a5d6153adfa95f77474f6c5f5 Mon Sep 17 00:00:00 2001 From: James Read Date: Sun, 26 Jan 2025 10:48:48 +0000 Subject: [PATCH 09/11] chore: updating to 8.4 --- .github/workflows/tests.yml | 2 +- app/settings.php | 3 ++- composer.json | 16 ++++++++-------- docker-compose.yml | 2 +- src/Application/Handlers/HttpErrorHandler.php | 1 - src/Application/Handlers/ShutdownHandler.php | 12 ++++++------ .../Persistence/User/InMemoryUserRepository.php | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2d0533e95..4131a3d34 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - php: [8.2, 8.3] + php: [8.3, 8.4] experimental: [false] include: - php: 8.3 diff --git a/app/settings.php b/app/settings.php index 79392bd8d..f823aafa5 100644 --- a/app/settings.php +++ b/app/settings.php @@ -5,6 +5,7 @@ use App\Application\Settings\Settings; use App\Application\Settings\SettingsInterface; use DI\ContainerBuilder; +use Monolog\Level; use Monolog\Logger; return function (ContainerBuilder $containerBuilder) { @@ -19,7 +20,7 @@ 'logger' => [ 'name' => 'slim-app', 'path' => isset($_ENV['docker']) ? 'php://stdout' : __DIR__ . '/../logs/app.log', - 'level' => Logger::DEBUG, + 'level' => Level::fromName('DEBUG'), ], ]); } diff --git a/composer.json b/composer.json index 37a3f127b..352e6f31c 100644 --- a/composer.json +++ b/composer.json @@ -22,20 +22,20 @@ } ], "require": { - "php": "^8.2", + "php": "^8.3", "ext-json": "*", - "monolog/monolog": "^2.9", - "php-di/php-di": "^6.4", + "monolog/monolog": "^3.8", + "php-di/php-di": "^7.0", "slim/psr7": "^1.6", "slim/slim": "^4.12" }, "require-dev": { - "jangregor/phpstan-prophecy": "^1.0.0", - "phpspec/prophecy-phpunit": "^2.2", + "jangregor/phpstan-prophecy": "^2.0", + "phpspec/prophecy-phpunit": "^2.3", "phpstan/extension-installer": "^1.3.1", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.6.17", - "squizlabs/php_codesniffer": "^3.9" + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^11.5", + "squizlabs/php_codesniffer": "^3.11" }, "config": { "allow-plugins": { diff --git a/docker-compose.yml b/docker-compose.yml index f8976b7fd..fa89ed71b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ volumes: services: slim: - image: php:8-alpine + image: php:8.4-alpine working_dir: /var/www command: php -S 0.0.0.0:8080 -t public environment: diff --git a/src/Application/Handlers/HttpErrorHandler.php b/src/Application/Handlers/HttpErrorHandler.php index 275bbad90..99f60515b 100644 --- a/src/Application/Handlers/HttpErrorHandler.php +++ b/src/Application/Handlers/HttpErrorHandler.php @@ -50,7 +50,6 @@ protected function respond(): Response if ( !($exception instanceof HttpException) - && $exception instanceof Throwable && $this->displayErrorDetails ) { $description = $exception->getMessage(); diff --git a/src/Application/Handlers/ShutdownHandler.php b/src/Application/Handlers/ShutdownHandler.php index 2f9b58eb0..0e173028d 100644 --- a/src/Application/Handlers/ShutdownHandler.php +++ b/src/Application/Handlers/ShutdownHandler.php @@ -39,18 +39,18 @@ public function __invoke() } /** - * @param array{type: int, message: string, file: string, line: int} $error + * @param array{type: int, message: string, file: string, line: int}|null$error */ - private function getErrorMessage(array $error = null): string + private function getErrorMessage(?array $error = null): string { if (!$this->displayErrorDetails) { return 'An error while processing your request. Please try again later.'; } - $errorFile = $error['file']; - $errorLine = $error['line']; - $errorMessage = $error['message']; - $errorType = $error['type']; + $errorFile = $error['file'] ?? null; + $errorLine = $error['line'] ?? null; + $errorMessage = $error['message'] ?? null; + $errorType = $error['type'] ?? null; return match ($errorType) { E_USER_WARNING => "WARNING: {$errorMessage}", diff --git a/src/Infrastructure/Persistence/User/InMemoryUserRepository.php b/src/Infrastructure/Persistence/User/InMemoryUserRepository.php index b85a74fa3..06d2d0fc7 100644 --- a/src/Infrastructure/Persistence/User/InMemoryUserRepository.php +++ b/src/Infrastructure/Persistence/User/InMemoryUserRepository.php @@ -18,7 +18,7 @@ class InMemoryUserRepository implements UserRepository /** * @param User[]|null $users */ - public function __construct(array $users = null) + public function __construct(?array $users = null) { $this->users = $users ?? [ 1 => new User(1, 'bill.gates', 'Bill', 'Gates'), From 7f32837f96c9afbcd7b0ee9a02712301c625bf91 Mon Sep 17 00:00:00 2001 From: James Read Date: Sun, 26 Jan 2025 11:05:45 +0000 Subject: [PATCH 10/11] chore: fixing phpunit and upgrade phpunit.xml --- phpunit.xml | 38 +++++++++++----------------------- tests/Domain/User/UserTest.php | 19 ++++------------- tests/bootstrap.php | 3 --- 3 files changed, 16 insertions(+), 44 deletions(-) delete mode 100644 tests/bootstrap.php diff --git a/phpunit.xml b/phpunit.xml index f83040094..b7d0e7286 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,27 +1,13 @@ - - - - ./tests/ - - - - - ./src/ - - + + + + + ./tests/ + + + + + ./src/ + + diff --git a/tests/Domain/User/UserTest.php b/tests/Domain/User/UserTest.php index 36f49259f..f7eae5eb9 100644 --- a/tests/Domain/User/UserTest.php +++ b/tests/Domain/User/UserTest.php @@ -5,11 +5,12 @@ namespace Tests\Domain\User; use App\Domain\User\User; +use PHPUnit\Framework\Attributes\DataProvider; use Tests\TestCase; class UserTest extends TestCase { - public function userProvider(): array + public static function userProvider(): array { return [ [1, 'bill.gates', 'Bill', 'Gates'], @@ -20,13 +21,7 @@ public function userProvider(): array ]; } - /** - * @dataProvider userProvider - * @param int $id - * @param string $username - * @param string $firstName - * @param string $lastName - */ + #[DataProvider('userProvider')] public function testGetters(int $id, string $username, string $firstName, string $lastName) { $user = new User($id, $username, $firstName, $lastName); @@ -37,13 +32,7 @@ public function testGetters(int $id, string $username, string $firstName, string $this->assertEquals($lastName, $user->getLastName()); } - /** - * @dataProvider userProvider - * @param int $id - * @param string $username - * @param string $firstName - * @param string $lastName - */ + #[DataProvider('userProvider')] public function testJsonSerialize(int $id, string $username, string $firstName, string $lastName) { $user = new User($id, $username, $firstName, $lastName); diff --git a/tests/bootstrap.php b/tests/bootstrap.php deleted file mode 100644 index d21c14df8..000000000 --- a/tests/bootstrap.php +++ /dev/null @@ -1,3 +0,0 @@ - Date: Sun, 26 Jan 2025 18:41:59 +0000 Subject: [PATCH 11/11] chore: adding support for 8.2 Adding 8.2 to CI pipeline and being stricter with php versions in composer --- .github/workflows/tests.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4131a3d34..6c3896ee4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - php: [8.3, 8.4] + php: [8.2, 8.3, 8.4] experimental: [false] include: - php: 8.3 diff --git a/composer.json b/composer.json index 352e6f31c..cfb6f9010 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ } ], "require": { - "php": "^8.3", + "php": "^8.2.0 || ^8.3.0 || ^8.4.0", "ext-json": "*", "monolog/monolog": "^3.8", "php-di/php-di": "^7.0",