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..499e65c 100644 --- a/composer.json +++ b/composer.json @@ -18,16 +18,16 @@ } ], "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" + "codeigniter4/framework": "<4.6" }, "require-dev": { - "codeigniter/coding-standard": "^1.7.15", - "codeigniter4/framework": "^4.5.1", - "phpstan/phpstan": "^2.0", - "phpunit/phpunit": "^10.5.20", + "codeigniter/coding-standard": "^1.8.2", + "codeigniter4/framework": "^4.6", + "phpstan/phpstan": "^2.0.4", + "phpunit/phpunit": "^11.5.2", "rector/rector": "dev-main" }, "config": { diff --git a/rector.php b/rector.php index 7530927..985e7b7 100644 --- a/rector.php +++ b/rector.php @@ -21,7 +21,8 @@ naming: true, codingStyle: true ) - ->withPhpSets(php81: true) + ->withPhpSets(php82: true) + ->withComposerBased(phpunit: true) ->withPaths([__DIR__ . '/src', __DIR__ . '/test']) ->withRootFiles() ->withImportNames(removeUnusedImports: true) 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/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; 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), ); } }