From 0545d9f5ea1220fb922cf08055cc60edd1ebd0fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Letord?= Date: Tue, 17 Jun 2025 12:33:05 +0200 Subject: [PATCH 1/2] Bump doctrine --- .github/workflows/tests.yml | 5 +++-- composer.json | 16 ++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index df4e6fc..c07b840 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,8 @@ jobs: strategy: matrix: php-versions: [ '8.2', '8.3', '8.4' ] - symfony-version: ['5.4.*', '6.4.*', '7.2.*'] + symfony-version: ['6.4.*', '7.2.*'] + dependencies-version: ['--prefer-lowest', '--prefer-stable'] fail-fast: false steps: - uses: actions/checkout@v4 @@ -33,7 +34,7 @@ jobs: run: composer config extra.symfony.require "${{ matrix.symfony-version }}" - name: Update project dependencies - run: composer update --no-progress --ansi --prefer-stable + run: composer update --no-progress --ansi ${{ matrix.dependencies-version }} - name: Composer install run: composer install --no-scripts --no-interaction --prefer-dist -oa diff --git a/composer.json b/composer.json index 6b63d06..15a5b57 100644 --- a/composer.json +++ b/composer.json @@ -22,17 +22,17 @@ "require": { "php": ">=8.2", "openclassrooms/use-case": "^2.0", - "symfony/cache": "~5.4 || ~6.4 || ~7.1", - "symfony/dependency-injection": "~5.4 || ~6.4 || ~7.1", - "symfony/config": "~5.0 || ~6.4 || ~7.1", - "symfony/http-kernel": "~5.0 || ~6.4 || ~7.1 || ~7.1", - "symfony/security-core": "~5.0 || ~6.4 || ~7.1", + "symfony/cache": "~6.4 || ~7.1", + "symfony/dependency-injection": "~6.4 || ~7.1", + "symfony/config": "~6.4 || ~7.1", + "symfony/http-kernel": "~6.4 || ~7.1 || ~7.1", + "symfony/security-core": "~6.4 || ~7.1", "doctrine/orm": "~2.3 || ~3.2", - "doctrine/dbal": "~3.2", - "symfony/event-dispatcher": "~5.0 || ~6.4 || ~7.1" + "doctrine/dbal": "~3.2 || 4.0", + "symfony/event-dispatcher": "~6.4 || ~7.1" }, "require-dev": { - "phpunit/phpunit": "^10" + "phpunit/phpunit": "^10.5" }, "extra": { "branch-alias": { From 002b67f65fa2bbb71fd066014ccc2fe4b1a777f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Letord?= Date: Tue, 17 Jun 2025 13:02:27 +0200 Subject: [PATCH 2/2] Fix 8.4 compatibility --- Services/Event/Impl/EventFactoryImpl.php | 6 +++--- Services/Event/Impl/UseCaseEventBuilderImpl.php | 6 +++--- Services/Event/UseCaseEventBuilder.php | 6 +++--- .../Fixtures/Util/AuthorizationCheckerSpy.php | 2 +- .../Fixtures/Util/EventDispatcherSpy.php | 2 +- Tests/DependencyInjection/Fixtures/Util/EventFactorySpy.php | 6 +++--- .../Fixtures/Util/NotGrantedAuthorizationCheckerStub.php | 2 +- Tests/bootstrap.php | 6 +++--- composer.json | 4 ++-- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Services/Event/Impl/EventFactoryImpl.php b/Services/Event/Impl/EventFactoryImpl.php index b325f3a..bbb1d66 100644 --- a/Services/Event/Impl/EventFactoryImpl.php +++ b/Services/Event/Impl/EventFactoryImpl.php @@ -25,9 +25,9 @@ class EventFactoryImpl implements EventFactory */ public function make( $eventName, - UseCaseRequest $useCaseRequest = null, - UseCaseResponse $useCaseResponse = null, - \Exception $exception = null + ?UseCaseRequest $useCaseRequest = null, + ?UseCaseResponse $useCaseResponse = null, + ?\Exception $exception = null ) { return $this->useCaseEventBuilder ->create() diff --git a/Services/Event/Impl/UseCaseEventBuilderImpl.php b/Services/Event/Impl/UseCaseEventBuilderImpl.php index b70ba07..69f7eba 100644 --- a/Services/Event/Impl/UseCaseEventBuilderImpl.php +++ b/Services/Event/Impl/UseCaseEventBuilderImpl.php @@ -39,7 +39,7 @@ public function named($name) /** * @return UseCaseEventBuilder */ - public function withUseCaseRequest(UseCaseRequest $useCaseRequest = null) + public function withUseCaseRequest(?UseCaseRequest $useCaseRequest = null) { if (null !== $useCaseRequest) { $this->event->setUseCaseRequest($useCaseRequest); @@ -51,7 +51,7 @@ public function withUseCaseRequest(UseCaseRequest $useCaseRequest = null) /** * @return UseCaseEventBuilder */ - public function withUseCaseResponse(UseCaseResponse $useCaseResponse = null) + public function withUseCaseResponse(?UseCaseResponse $useCaseResponse = null) { if (null !== $useCaseResponse) { $this->event->setUseCaseResponse($useCaseResponse); @@ -63,7 +63,7 @@ public function withUseCaseResponse(UseCaseResponse $useCaseResponse = null) /** * @return UseCaseEventBuilder */ - public function withUseCaseException(\Exception $exception = null) + public function withUseCaseException(?\Exception $exception = null) { if (null !== $exception) { $this->event->setUseCaseException($exception); diff --git a/Services/Event/UseCaseEventBuilder.php b/Services/Event/UseCaseEventBuilder.php index 3501bdc..b4c5934 100644 --- a/Services/Event/UseCaseEventBuilder.php +++ b/Services/Event/UseCaseEventBuilder.php @@ -31,19 +31,19 @@ abstract public function named($name); * @return UseCaseEventBuilder * @codeCoverageIgnore */ - abstract public function withUseCaseRequest(UseCaseRequest $useCaseRequest = null); + abstract public function withUseCaseRequest(?UseCaseRequest $useCaseRequest = null); /** * @return UseCaseEventBuilder * @codeCoverageIgnore */ - abstract public function withUseCaseResponse(UseCaseResponse $useCaseResponse = null); + abstract public function withUseCaseResponse(?UseCaseResponse $useCaseResponse = null); /** * @return UseCaseEventBuilder * @codeCoverageIgnore */ - abstract public function withUseCaseException(\Exception $exception = null); + abstract public function withUseCaseException(?\Exception $exception = null); /** * @return UseCaseEvent diff --git a/Tests/DependencyInjection/Fixtures/Util/AuthorizationCheckerSpy.php b/Tests/DependencyInjection/Fixtures/Util/AuthorizationCheckerSpy.php index 6f178b3..11395f8 100644 --- a/Tests/DependencyInjection/Fixtures/Util/AuthorizationCheckerSpy.php +++ b/Tests/DependencyInjection/Fixtures/Util/AuthorizationCheckerSpy.php @@ -30,7 +30,7 @@ public function getToken() * * @param TokenInterface $token A TokenInterface token, or null if no further authentication information should be stored */ - public function setToken(TokenInterface $token = null) + public function setToken(?TokenInterface $token = null) { return; } diff --git a/Tests/DependencyInjection/Fixtures/Util/EventDispatcherSpy.php b/Tests/DependencyInjection/Fixtures/Util/EventDispatcherSpy.php index bfd0aa0..c5f5363 100644 --- a/Tests/DependencyInjection/Fixtures/Util/EventDispatcherSpy.php +++ b/Tests/DependencyInjection/Fixtures/Util/EventDispatcherSpy.php @@ -25,7 +25,7 @@ public function __construct() self::$sent = false; } - public function dispatch(object $event, string $eventName = null): object + public function dispatch(object $event, ?string $eventName = null): object { self::$eventName = $eventName; self::$sent = true; diff --git a/Tests/DependencyInjection/Fixtures/Util/EventFactorySpy.php b/Tests/DependencyInjection/Fixtures/Util/EventFactorySpy.php index cc2666d..a4b90e2 100644 --- a/Tests/DependencyInjection/Fixtures/Util/EventFactorySpy.php +++ b/Tests/DependencyInjection/Fixtures/Util/EventFactorySpy.php @@ -20,9 +20,9 @@ class EventFactorySpy implements EventFactory */ public function make( $eventName, - UseCaseRequest $useCaseRequest = null, - UseCaseResponse $useCaseResponse = null, - \Exception $exception = null + ?UseCaseRequest $useCaseRequest = null, + ?UseCaseResponse $useCaseResponse = null, + ?\Exception $exception = null ) { if (EventUseCaseStub::EVENT_NAME === $eventName) { return new Event(); diff --git a/Tests/DependencyInjection/Fixtures/Util/NotGrantedAuthorizationCheckerStub.php b/Tests/DependencyInjection/Fixtures/Util/NotGrantedAuthorizationCheckerStub.php index 11b9505..705dd39 100644 --- a/Tests/DependencyInjection/Fixtures/Util/NotGrantedAuthorizationCheckerStub.php +++ b/Tests/DependencyInjection/Fixtures/Util/NotGrantedAuthorizationCheckerStub.php @@ -25,7 +25,7 @@ public function getToken() * * @param TokenInterface $token A TokenInterface token, or null if no further authentication information should be stored */ - public function setToken(TokenInterface $token = null) + public function setToken(?TokenInterface $token = null) { return; } diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php index 72913f7..5263547 100644 --- a/Tests/bootstrap.php +++ b/Tests/bootstrap.php @@ -4,6 +4,6 @@ use Composer\Autoload\ClassLoader; -error_reporting(E_ALL | E_STRICT); -/** @var ClassLoader $loader */ -require __DIR__.'/../vendor/autoload.php'; +error_reporting(E_ALL); + +require __DIR__ . "/../vendor/autoload.php"; diff --git a/composer.json b/composer.json index 15a5b57..b77efd6 100644 --- a/composer.json +++ b/composer.json @@ -21,14 +21,14 @@ }, "require": { "php": ">=8.2", - "openclassrooms/use-case": "^2.0", + "openclassrooms/use-case": "dev-php8.4@dev", "symfony/cache": "~6.4 || ~7.1", "symfony/dependency-injection": "~6.4 || ~7.1", "symfony/config": "~6.4 || ~7.1", "symfony/http-kernel": "~6.4 || ~7.1 || ~7.1", "symfony/security-core": "~6.4 || ~7.1", "doctrine/orm": "~2.3 || ~3.2", - "doctrine/dbal": "~3.2 || 4.0", + "doctrine/dbal": "~3.2 || ~4.0", "symfony/event-dispatcher": "~6.4 || ~7.1" }, "require-dev": {