From 1a300f7cbfc50e2321027be95044404c1972faf5 Mon Sep 17 00:00:00 2001 From: michalsn Date: Tue, 28 Jan 2025 19:17:41 +0100 Subject: [PATCH 01/12] update composer dependencies and set the minimum PHP version to 8.1 --- composer.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 0d5e77f..5834ec9 100644 --- a/composer.json +++ b/composer.json @@ -22,24 +22,24 @@ ], "homepage": "https://github.com/codeigniter4/devkit", "require": { - "php": "^7.4 || ^8.0", + "php": "^8.1", "codeigniter/coding-standard": "^1.5", "fakerphp/faker": "^1.9", "mikey179/vfsstream": "^1.6", "nexusphp/cs-config": "^3.6", - "nexusphp/tachycardia": "^1.3 || ^2.0", + "nexusphp/tachycardia": "^2.0", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.0", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.3 || ^10.5.16", - "rector/rector": "^0.19 || ^1.0.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^10.5 || ^11.5", + "rector/rector": "^2.0", "roave/security-advisories": "dev-latest", "vimeo/psalm": "^5.0" }, "require-dev": { "codeigniter4/framework": "^4.1", - "icanhazstring/composer-unused": "^0.8.2" + "icanhazstring/composer-unused": "dev-main" }, "minimum-stability": "dev", "prefer-stable": true, From e781de81dfa75c55759747bb775fb258a4f6d5e1 Mon Sep 17 00:00:00 2001 From: michalsn Date: Tue, 28 Jan 2025 19:18:15 +0100 Subject: [PATCH 02/12] update cacheDirectory in phpunit template --- src/Template/phpunit.xml.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Template/phpunit.xml.dist b/src/Template/phpunit.xml.dist index 21a5f6e..968d75a 100644 --- a/src/Template/phpunit.xml.dist +++ b/src/Template/phpunit.xml.dist @@ -12,7 +12,7 @@ stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" - cacheDirectory=".phpunit.cache" + cacheDirectory="build/.phpunit.cache" beStrictAboutCoverageMetadata="true"> From 920945c9c287f6cb424affdfa8af2e70a7154746 Mon Sep 17 00:00:00 2001 From: michalsn Date: Tue, 28 Jan 2025 19:19:46 +0100 Subject: [PATCH 03/12] update rector template to use PHP 8.1 as minimum version --- src/Template/rector.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Template/rector.php b/src/Template/rector.php index 71c499e..0c364d1 100644 --- a/src/Template/rector.php +++ b/src/Template/rector.php @@ -47,7 +47,7 @@ return static function (RectorConfig $rectorConfig): void { $rectorConfig->sets([ SetList::DEAD_CODE, - LevelSetList::UP_TO_PHP_74, + LevelSetList::UP_TO_PHP_81, PHPUnitSetList::PHPUNIT_CODE_QUALITY, PHPUnitSetList::PHPUNIT_100, ]); @@ -81,7 +81,7 @@ } // Set the target version for refactoring - $rectorConfig->phpVersion(PhpVersion::PHP_74); + $rectorConfig->phpVersion(PhpVersion::PHP_81); // Auto-import fully qualified class names $rectorConfig->importNames(); From 3c98d37560d47b1cd4f42fc3f0faf78d330fb68e Mon Sep 17 00:00:00 2001 From: michalsn Date: Tue, 28 Jan 2025 19:20:06 +0100 Subject: [PATCH 04/12] update infection template --- src/Template/.github/workflows/infection.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Template/.github/workflows/infection.yml b/src/Template/.github/workflows/infection.yml index cb6dda1..f58dc6a 100644 --- a/src/Template/.github/workflows/infection.yml +++ b/src/Template/.github/workflows/infection.yml @@ -23,7 +23,7 @@ jobs: - name: Set up PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: '8.2' tools: infection, phpunit extensions: intl, json, mbstring, gd, xml, sqlite3 coverage: xdebug From c2d2f2a4536269720f210a9c5653a73c96c22f4e Mon Sep 17 00:00:00 2001 From: michalsn Date: Tue, 28 Jan 2025 19:22:57 +0100 Subject: [PATCH 05/12] update phpstan workflow template - PHP range from 8.1 to 8.4 --- src/Template/.github/workflows/phpstan.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Template/.github/workflows/phpstan.yml b/src/Template/.github/workflows/phpstan.yml index fd67635..19c1206 100644 --- a/src/Template/.github/workflows/phpstan.yml +++ b/src/Template/.github/workflows/phpstan.yml @@ -26,7 +26,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['7.4', '8.0', '8.1', '8.2'] + php-versions: ['8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout @@ -64,10 +64,15 @@ jobs: - name: Install dependencies run: | + OPTIONS='--no-progress --no-interaction --prefer-dist --optimize-autoloader' + if [[ '${{ matrix.php-versions }}' == '8.4' ]]; then + OPTIONS="$OPTIONS --ignore-platform-reqs" + fi + if [ -f composer.lock ]; then - composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader + composer install $OPTIONS else - composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader + composer update $OPTIONS fi - name: Run static analysis From d1f31cb4186b1847f8d2907567e5aa9ab3deb801 Mon Sep 17 00:00:00 2001 From: michalsn Date: Tue, 28 Jan 2025 19:23:11 +0100 Subject: [PATCH 06/12] update phpunit workflow template - PHP range from 8.1 to 8.4 --- src/Template/.github/workflows/phpunit.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Template/.github/workflows/phpunit.yml b/src/Template/.github/workflows/phpunit.yml index 7f355eb..86fbf1c 100644 --- a/src/Template/.github/workflows/phpunit.yml +++ b/src/Template/.github/workflows/phpunit.yml @@ -25,7 +25,7 @@ jobs: if: (! contains(github.event.head_commit.message, '[ci skip]')) strategy: matrix: - php-versions: ['7.4', '8.0', '8.1', '8.2'] + php-versions: ['8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout @@ -53,10 +53,15 @@ jobs: - name: Install dependencies run: | + OPTIONS="${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader" + if [[ '${{ matrix.php-versions }}' == '8.4' ]]; then + OPTIONS="$OPTIONS --ignore-platform-reqs" + fi + if [ -f composer.lock ]; then - composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader + composer install $OPTIONS else - composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader + composer update $OPTIONS fi - name: Test with PHPUnit From 613215bfcbdb54fe727435fd3cac3a68e467c80a Mon Sep 17 00:00:00 2001 From: michalsn Date: Tue, 28 Jan 2025 19:23:26 +0100 Subject: [PATCH 07/12] update rector workflow template - PHP range from 8.1 to 8.4 --- src/Template/.github/workflows/rector.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Template/.github/workflows/rector.yml b/src/Template/.github/workflows/rector.yml index 26b0b8c..8e5dfc9 100644 --- a/src/Template/.github/workflows/rector.yml +++ b/src/Template/.github/workflows/rector.yml @@ -26,7 +26,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['7.4', '8.0', '8.1', '8.2'] + php-versions: ['8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout @@ -54,10 +54,15 @@ jobs: - name: Install dependencies run: | + OPTIONS='--no-progress --no-interaction --prefer-dist --optimize-autoloader' + if [[ '${{ matrix.php-versions }}' == '8.4' ]]; then + OPTIONS="$OPTIONS --ignore-platform-reqs" + fi + if [ -f composer.lock ]; then - composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader + composer install $OPTIONS else - composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader + composer update $OPTIONS fi - name: Rector Cache From 91938ba19b312fe07169a9011b3857b3df388151 Mon Sep 17 00:00:00 2001 From: michalsn Date: Tue, 28 Jan 2025 19:23:43 +0100 Subject: [PATCH 08/12] update gitignore --- .gitignore | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 127 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 11192f3..988be09 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,129 @@ -vendor/ -build/ -phpunit*.xml +#------------------------- +# Operating Specific Junk Files +#------------------------- + +# OS X +.DS_Store +.AppleDouble +.LSOverride + +# OS X Thumbnails +._* + +# Windows image file caches +Thumbs.db +ehthumbs.db +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Linux +*~ + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +#------------------------- +# Environment Files +#------------------------- +# These should never be under version control, +# as it poses a security risk. +.env +.vagrant +Vagrantfile + +#------------------------- +# Temporary Files +#------------------------- +writable/cache/* +!writable/cache/index.html + +writable/logs/* +!writable/logs/index.html + +writable/session/* +!writable/session/index.html + +writable/uploads/* +!writable/uploads/index.html + +writable/debugbar/* +!writable/debugbar/index.html + +writable/**/*.db +writable/**/*.sqlite + +php_errors.log + +#------------------------- +# User Guide Temp Files +#------------------------- +user_guide_src/build/* + +#------------------------- +# Test Files +#------------------------- +tests/coverage* + +# Don't save phpunit under version control. phpunit -*.cache + +#------------------------- +# Composer +#------------------------- +vendor/ composer.lock -.DS_Store + +#------------------------- +# IDE / Development Files +#------------------------- + +# Modules Testing +_modules/* + +# phpenv local config +.php-version + +# Jetbrains editors (PHPStorm, etc) +.idea/ +*.iml + +# Netbeans +nbproject/ +build/ +nbbuild/ +dist/ +nbdist/ +nbactions.xml +nb-configuration.xml +.nb-gradle/ + +# Sublime Text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project +.phpintel +/api/ + +# Visual Studio Code +.vscode/ + +/results/ +/phpunit*.xml + +/.php-cs-fixer.php From 198b7dbf04dd77f6b1250fa122a68c5593cbd5ff Mon Sep 17 00:00:00 2001 From: michalsn Date: Wed, 29 Jan 2025 19:52:00 +0100 Subject: [PATCH 09/12] update psalm to v6 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5834ec9..c313b9d 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "phpunit/phpunit": "^10.5 || ^11.5", "rector/rector": "^2.0", "roave/security-advisories": "dev-latest", - "vimeo/psalm": "^5.0" + "vimeo/psalm": "^6.0" }, "require-dev": { "codeigniter4/framework": "^4.1", From b9703fb2c4d7acd392dd4eacbf0c59a3ecd3e35d Mon Sep 17 00:00:00 2001 From: michalsn Date: Wed, 29 Jan 2025 19:52:46 +0100 Subject: [PATCH 10/12] update template workflows for PHPStan, PHPUnit, and Rector --- src/Template/.github/workflows/phpstan.yml | 9 ++------- src/Template/.github/workflows/phpunit.yml | 9 ++------- src/Template/.github/workflows/rector.yml | 9 ++------- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/src/Template/.github/workflows/phpstan.yml b/src/Template/.github/workflows/phpstan.yml index 19c1206..eb62cd4 100644 --- a/src/Template/.github/workflows/phpstan.yml +++ b/src/Template/.github/workflows/phpstan.yml @@ -64,15 +64,10 @@ jobs: - name: Install dependencies run: | - OPTIONS='--no-progress --no-interaction --prefer-dist --optimize-autoloader' - if [[ '${{ matrix.php-versions }}' == '8.4' ]]; then - OPTIONS="$OPTIONS --ignore-platform-reqs" - fi - if [ -f composer.lock ]; then - composer install $OPTIONS + composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader else - composer update $OPTIONS + composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader fi - name: Run static analysis diff --git a/src/Template/.github/workflows/phpunit.yml b/src/Template/.github/workflows/phpunit.yml index 86fbf1c..5df1604 100644 --- a/src/Template/.github/workflows/phpunit.yml +++ b/src/Template/.github/workflows/phpunit.yml @@ -53,15 +53,10 @@ jobs: - name: Install dependencies run: | - OPTIONS="${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader" - if [[ '${{ matrix.php-versions }}' == '8.4' ]]; then - OPTIONS="$OPTIONS --ignore-platform-reqs" - fi - if [ -f composer.lock ]; then - composer install $OPTIONS + composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader else - composer update $OPTIONS + composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader fi - name: Test with PHPUnit diff --git a/src/Template/.github/workflows/rector.yml b/src/Template/.github/workflows/rector.yml index 8e5dfc9..8694f14 100644 --- a/src/Template/.github/workflows/rector.yml +++ b/src/Template/.github/workflows/rector.yml @@ -54,15 +54,10 @@ jobs: - name: Install dependencies run: | - OPTIONS='--no-progress --no-interaction --prefer-dist --optimize-autoloader' - if [[ '${{ matrix.php-versions }}' == '8.4' ]]; then - OPTIONS="$OPTIONS --ignore-platform-reqs" - fi - if [ -f composer.lock ]; then - composer install $OPTIONS + composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader else - composer update $OPTIONS + composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader fi - name: Rector Cache From 53451808379a2a4318cda02ae7b1501beb4e91d0 Mon Sep 17 00:00:00 2001 From: michalsn Date: Wed, 29 Jan 2025 19:53:42 +0100 Subject: [PATCH 11/12] update repo workflows for PHPStan and Rector --- .github/workflows/phpstan.yml | 2 +- .github/workflows/rector.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 0bd947e..eb62cd4 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -26,7 +26,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['7.4', '8.0', '8.1'] + php-versions: ['8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index b93f852..8694f14 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -26,7 +26,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['7.4', '8.0', '8.1'] + php-versions: ['8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout From 5a7c357ce60898fb5247fdf8cab2e34cc95822bb Mon Sep 17 00:00:00 2001 From: michalsn Date: Wed, 29 Jan 2025 20:01:55 +0100 Subject: [PATCH 12/12] fix phpstan.neon.dist file for the repo --- phpstan.neon.dist | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 113d258..83cbc02 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -6,8 +6,7 @@ parameters: bootstrapFiles: - vendor/codeigniter4/framework/system/Test/bootstrap.php excludePaths: - - src/Config/Routes.php - - src/Views/* + - src/docker/* ignoreErrors: universalObjectCratesClasses: - CodeIgniter\Entity