From f454bf96b5f98cb0ca1522eb1539432ac48f0280 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 29 Dec 2024 10:58:34 +0700 Subject: [PATCH 1/6] Bump php requirement to php 8.2, add php 8.4 support --- .github/workflows/ci_build.yaml | 2 +- composer.json | 2 +- rector.php | 2 +- src/Infrastructure/Persistence/Album/SQLAlbumRepository.php | 2 +- .../AlbumTrackSummary/SQLAlbumTrackSummaryRepository.php | 4 ++-- src/Infrastructure/Persistence/Track/SQLTrackRepository.php | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_build.yaml b/.github/workflows/ci_build.yaml index 88c41d8..11787a1 100644 --- a/.github/workflows/ci_build.yaml +++ b/.github/workflows/ci_build.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.1', '8.2'] + php-versions: ['8.2', '8.3', '8.4'] steps: - name: Setup PHP Action uses: shivammathur/setup-php@v2 diff --git a/composer.json b/composer.json index 7b4d4d2..9153d43 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ } ], "require": { - "php": "~8.1.0 || ~8.2.0 || ~8.3.0" + "php": "~8.2.0 || ~8.3.0 || ~8.4.0" }, "conflict": { "codeigniter4/framework": "<4.5.1" diff --git a/rector.php b/rector.php index 7530927..3889aed 100644 --- a/rector.php +++ b/rector.php @@ -21,7 +21,7 @@ naming: true, codingStyle: true ) - ->withPhpSets(php81: true) + ->withPhpSets(php82: true) ->withPaths([__DIR__ . '/src', __DIR__ . '/test']) ->withRootFiles() ->withImportNames(removeUnusedImports: true) diff --git a/src/Infrastructure/Persistence/Album/SQLAlbumRepository.php b/src/Infrastructure/Persistence/Album/SQLAlbumRepository.php index 805b6bf..f848560 100644 --- a/src/Infrastructure/Persistence/Album/SQLAlbumRepository.php +++ b/src/Infrastructure/Persistence/Album/SQLAlbumRepository.php @@ -18,7 +18,7 @@ use Album\Infrastructure\Persistence\DMLPersistence; use Album\Models\AlbumModel; -final class SQLAlbumRepository implements AlbumRepository +final readonly class SQLAlbumRepository implements AlbumRepository { use DMLPersistence; diff --git a/src/Infrastructure/Persistence/AlbumTrackSummary/SQLAlbumTrackSummaryRepository.php b/src/Infrastructure/Persistence/AlbumTrackSummary/SQLAlbumTrackSummaryRepository.php index 92fd2b8..722a475 100644 --- a/src/Infrastructure/Persistence/AlbumTrackSummary/SQLAlbumTrackSummaryRepository.php +++ b/src/Infrastructure/Persistence/AlbumTrackSummary/SQLAlbumTrackSummaryRepository.php @@ -17,9 +17,9 @@ use Album\Models\AlbumModel; use Album\Models\TrackModel; -final class SQLAlbumTrackSummaryRepository implements AlbumTrackSummaryRepository +final readonly class SQLAlbumTrackSummaryRepository implements AlbumTrackSummaryRepository { - public function __construct(private readonly AlbumModel $albumModel, private readonly TrackModel $trackModel) + public function __construct(private AlbumModel $albumModel, private TrackModel $trackModel) { } diff --git a/src/Infrastructure/Persistence/Track/SQLTrackRepository.php b/src/Infrastructure/Persistence/Track/SQLTrackRepository.php index 9332ad9..d0e560c 100644 --- a/src/Infrastructure/Persistence/Track/SQLTrackRepository.php +++ b/src/Infrastructure/Persistence/Track/SQLTrackRepository.php @@ -21,7 +21,7 @@ use Album\Models\TrackModel; use Config\Services; -final class SQLTrackRepository implements TrackRepository +final readonly class SQLTrackRepository implements TrackRepository { use DMLPersistence { save as saveData; From cc655dd8c4e7fb688b219bb5a20e237bd88b9d2a Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 29 Dec 2024 11:00:17 +0700 Subject: [PATCH 2/6] bump codeigniter requirement --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 9153d43..00b6b7c 100644 --- a/composer.json +++ b/composer.json @@ -21,11 +21,11 @@ "php": "~8.2.0 || ~8.3.0 || ~8.4.0" }, "conflict": { - "codeigniter4/framework": "<4.5.1" + "codeigniter4/framework": "<4.5.6" }, "require-dev": { "codeigniter/coding-standard": "^1.7.15", - "codeigniter4/framework": "^4.5.1", + "codeigniter4/framework": "^4.5.6", "phpstan/phpstan": "^2.0", "phpunit/phpunit": "^10.5.20", "rector/rector": "dev-main" From fcd7c5df84e6bc359ac6f7ac183e1380bee3a138 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 29 Dec 2024 11:00:57 +0700 Subject: [PATCH 3/6] bump requirements --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 00b6b7c..8a86498 100644 --- a/composer.json +++ b/composer.json @@ -24,10 +24,10 @@ "codeigniter4/framework": "<4.5.6" }, "require-dev": { - "codeigniter/coding-standard": "^1.7.15", + "codeigniter/coding-standard": "^1.8.2", "codeigniter4/framework": "^4.5.6", - "phpstan/phpstan": "^2.0", - "phpunit/phpunit": "^10.5.20", + "phpstan/phpstan": "^2.0.4", + "phpunit/phpunit": "^11.5.2", "rector/rector": "dev-main" }, "config": { From a68710b92425df30d5c38f93d3391010686ddd39 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 29 Dec 2024 11:01:34 +0700 Subject: [PATCH 4/6] update set --- rector.php | 1 + 1 file changed, 1 insertion(+) diff --git a/rector.php b/rector.php index 3889aed..985e7b7 100644 --- a/rector.php +++ b/rector.php @@ -22,6 +22,7 @@ codingStyle: true ) ->withPhpSets(php82: true) + ->withComposerBased(phpunit: true) ->withPaths([__DIR__ . '/src', __DIR__ . '/test']) ->withRootFiles() ->withImportNames(removeUnusedImports: true) From 971fdf6a9ff763f09b1e01d9783b91eb5b5a7a3e Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 20 Jan 2025 18:44:15 +0700 Subject: [PATCH 5/6] bump to use codeigniter 4.6 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 8a86498..499e65c 100644 --- a/composer.json +++ b/composer.json @@ -21,11 +21,11 @@ "php": "~8.2.0 || ~8.3.0 || ~8.4.0" }, "conflict": { - "codeigniter4/framework": "<4.5.6" + "codeigniter4/framework": "<4.6" }, "require-dev": { "codeigniter/coding-standard": "^1.8.2", - "codeigniter4/framework": "^4.5.6", + "codeigniter4/framework": "^4.6", "phpstan/phpstan": "^2.0.4", "phpunit/phpunit": "^11.5.2", "rector/rector": "dev-main" From e71e6c89108db2927d07d4249b673fc3794e4be2 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 20 Jan 2025 18:48:34 +0700 Subject: [PATCH 6/6] cs fix --- src/Config/Services.php | 2 +- src/Domain/Album/AlbumNotFoundException.php | 2 +- src/Domain/Track/TrackDuplicatedRectorException.php | 2 +- src/Domain/Track/TrackNotFoundException.php | 2 +- .../Persistence/Track/SQLTrackRepositoryTest.php | 10 +++++----- test/unit/Domain/Album/AlbumNotFoundExceptionTest.php | 2 +- test/unit/Domain/Track/TrackNotFoundExceptionTest.php | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Config/Services.php b/src/Config/Services.php index f17633d..02c6ebc 100644 --- a/src/Config/Services.php +++ b/src/Config/Services.php @@ -46,7 +46,7 @@ public static function albumTrackSummary(bool $getShared = true): SQLAlbumTrackS return new SQLAlbumTrackSummaryRepository( model(AlbumModel::class), - model(TrackModel::class) + model(TrackModel::class), ); } } diff --git a/src/Domain/Album/AlbumNotFoundException.php b/src/Domain/Album/AlbumNotFoundException.php index c9d2830..79d336d 100644 --- a/src/Domain/Album/AlbumNotFoundException.php +++ b/src/Domain/Album/AlbumNotFoundException.php @@ -19,7 +19,7 @@ public static function forAlbumDoesnotExistOfId(int $id): self { return new self(sprintf( 'The album with album ID %d you requested does not exist.', - $id + $id, )); } } diff --git a/src/Domain/Track/TrackDuplicatedRectorException.php b/src/Domain/Track/TrackDuplicatedRectorException.php index 0c44d7f..d821743 100644 --- a/src/Domain/Track/TrackDuplicatedRectorException.php +++ b/src/Domain/Track/TrackDuplicatedRectorException.php @@ -19,7 +19,7 @@ public static function forDuplicatedTitle(int $id): self { return new self(sprintf( 'The track with album id %d has duplicated title.', - $id + $id, )); } } diff --git a/src/Domain/Track/TrackNotFoundException.php b/src/Domain/Track/TrackNotFoundException.php index 9aa77d1..4c93596 100644 --- a/src/Domain/Track/TrackNotFoundException.php +++ b/src/Domain/Track/TrackNotFoundException.php @@ -19,7 +19,7 @@ public static function forAlbumTrackDoesnotExistOfId(int $id): self { return new self(sprintf( 'The album track with track ID %d you requested does not exist.', - $id + $id, )); } } diff --git a/test/Database/Infrastructure/Persistence/Track/SQLTrackRepositoryTest.php b/test/Database/Infrastructure/Persistence/Track/SQLTrackRepositoryTest.php index ba2979a..5ba30fe 100644 --- a/test/Database/Infrastructure/Persistence/Track/SQLTrackRepositoryTest.php +++ b/test/Database/Infrastructure/Persistence/Track/SQLTrackRepositoryTest.php @@ -165,7 +165,7 @@ public function testSaveDuplicateDataInsert(): void 'album_id' => 1, 'title' => 'Sahabat Sejati', 'author' => 'Erros Chandra', - ] + ], )); $this->expectException(DuplicatedRecordException::class); @@ -174,7 +174,7 @@ public function testSaveDuplicateDataInsert(): void 'album_id' => 1, 'title' => 'Sahabat Sejati', 'author' => 'Erros Chandra', - ] + ], ); } @@ -185,7 +185,7 @@ public function testSaveDuplicateDataUpdate(): void 'album_id' => 1, 'title' => 'Sahabat Sejati', 'author' => 'Erros Chandra', - ] + ], )); $this->assertTrue($this->repository->save( @@ -193,7 +193,7 @@ public function testSaveDuplicateDataUpdate(): void 'album_id' => 1, 'title' => 'Temani Aku', 'author' => 'Erros Chandra', - ] + ], )); $lastId = Database::connect()->insertID(); @@ -205,7 +205,7 @@ public function testSaveDuplicateDataUpdate(): void 'album_id' => 1, 'title' => 'Sahabat Sejati', 'author' => 'Erros Chandra', - ] + ], ); } } diff --git a/test/unit/Domain/Album/AlbumNotFoundExceptionTest.php b/test/unit/Domain/Album/AlbumNotFoundExceptionTest.php index 601698d..3443bcb 100644 --- a/test/unit/Domain/Album/AlbumNotFoundExceptionTest.php +++ b/test/unit/Domain/Album/AlbumNotFoundExceptionTest.php @@ -30,7 +30,7 @@ public function testInstantiateforAlbumDoesnotExistOfId(): void { $this->assertInstanceOf( AlbumNotFoundException::class, - AlbumNotFoundException::forAlbumDoesnotExistOfId(1) + AlbumNotFoundException::forAlbumDoesnotExistOfId(1), ); } } diff --git a/test/unit/Domain/Track/TrackNotFoundExceptionTest.php b/test/unit/Domain/Track/TrackNotFoundExceptionTest.php index 1361f45..e5465a7 100644 --- a/test/unit/Domain/Track/TrackNotFoundExceptionTest.php +++ b/test/unit/Domain/Track/TrackNotFoundExceptionTest.php @@ -30,7 +30,7 @@ public function testInstantiateforAlbumTrackDoesnotExistOfId(): void { $this->assertInstanceOf( TrackNotFoundException::class, - TrackNotFoundException::forAlbumTrackDoesnotExistOfId(1) + TrackNotFoundException::forAlbumTrackDoesnotExistOfId(1), ); } }