From bb80a2836475366ff0ec37398b4d52f7833fe6b0 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sat, 30 Dec 2023 01:07:46 +0800 Subject: [PATCH 1/9] Bump PHP to 8.1 --- .github/workflows/test-coding-standards.yml | 2 -- .github/workflows/test-phpstan.yml | 2 -- .github/workflows/test-phpunit.yml | 2 -- composer.json | 2 +- 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/test-coding-standards.yml b/.github/workflows/test-coding-standards.yml index 463adbe..c9026a8 100644 --- a/.github/workflows/test-coding-standards.yml +++ b/.github/workflows/test-coding-standards.yml @@ -27,8 +27,6 @@ jobs: fail-fast: false matrix: php-version: - - '7.4' - - '8.0' - '8.1' - '8.2' - '8.3' diff --git a/.github/workflows/test-phpstan.yml b/.github/workflows/test-phpstan.yml index 33222f3..e7b5233 100644 --- a/.github/workflows/test-phpstan.yml +++ b/.github/workflows/test-phpstan.yml @@ -27,8 +27,6 @@ jobs: fail-fast: false matrix: php-version: - - '7.4' - - '8.0' - '8.1' - '8.2' - '8.3' diff --git a/.github/workflows/test-phpunit.yml b/.github/workflows/test-phpunit.yml index fff06df..d5c4dd4 100644 --- a/.github/workflows/test-phpunit.yml +++ b/.github/workflows/test-phpunit.yml @@ -27,8 +27,6 @@ jobs: fail-fast: false matrix: php-version: - - '7.4' - - '8.0' - '8.1' - '8.2' - '8.3' diff --git a/composer.json b/composer.json index 939d6a9..b66f788 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "slack": "https://codeigniterchat.slack.com" }, "require": { - "php": "^7.4 || ^8.0", + "php": "^8.1", "ext-tokenizer": "*", "friendsofphp/php-cs-fixer": "^3.50", "nexusphp/cs-config": "<=3.18.0" From 066f621a8b0914dde36caa83e3d3ad15f5d452fd Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sat, 30 Dec 2023 01:14:59 +0800 Subject: [PATCH 2/9] Bump to phpunit v10.5 --- composer.json | 4 +-- phpunit.xml.dist | 53 ++++++++++++++++++-------------------- tests/CodeIgniter4Test.php | 7 ++--- 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/composer.json b/composer.json index b66f788..246cd86 100644 --- a/composer.json +++ b/composer.json @@ -25,9 +25,9 @@ "nexusphp/cs-config": "<=3.18.0" }, "require-dev": { - "nexusphp/tachycardia": "^1.3", + "nexusphp/tachycardia": "^2.1", "phpstan/phpstan": "^1.0", - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.5" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 68bfbe1..8627a72 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,39 +1,36 @@ + + + tests/ + + - - - tests/ - - - - - - src/ - + + + src/ + + - - - - - + + + + + + - - - + + + diff --git a/tests/CodeIgniter4Test.php b/tests/CodeIgniter4Test.php index eb8223e..228cb2f 100644 --- a/tests/CodeIgniter4Test.php +++ b/tests/CodeIgniter4Test.php @@ -13,20 +13,21 @@ namespace CodeIgniter\CodingStandard\Tests; +use CodeIgniter\CodingStandard\CodeIgniter4; use Nexus\CsConfig\Ruleset\RulesetInterface; use Nexus\CsConfig\Test\AbstractRulesetTestCase; use PhpCsFixer\Preg; +use PHPUnit\Framework\Attributes\CoversClass; /** * @internal - * - * @covers \CodeIgniter\CodingStandard\CodeIgniter4 */ +#[CoversClass(CodeIgniter4::class)] final class CodeIgniter4Test extends AbstractRulesetTestCase { protected static function createRuleset(): RulesetInterface { - /** @phpstan-var class-string $ruleset */ + /** @var class-string $ruleset */ $ruleset = Preg::replace('/^(CodeIgniter\\\\CodingStandard)\\\\Tests(\\\\\S+)Test/', '$1$2', self::class); return new $ruleset(); From 560b78d83a8e23379b4a2aeb6daacf2722e83502 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Mon, 22 Apr 2024 23:43:37 +0800 Subject: [PATCH 3/9] Enable `modernize_strpos` --- src/CodeIgniter4.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CodeIgniter4.php b/src/CodeIgniter4.php index 16de03b..42c7d31 100644 --- a/src/CodeIgniter4.php +++ b/src/CodeIgniter4.php @@ -243,7 +243,7 @@ public function __construct() 'attribute_placement' => 'standalone', ], 'method_chaining_indentation' => true, - 'modernize_strpos' => false, // requires 8.0+ + 'modernize_strpos' => true, 'modernize_types_casting' => true, 'multiline_comment_opening_closing' => true, 'multiline_string_to_heredoc' => false, From c520c35f06c9dd38ef01757bb3c7b5d20e36c6ec Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Mon, 6 May 2024 00:10:35 +0800 Subject: [PATCH 4/9] Remove restriction on cs-config --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 246cd86..dcdd3f6 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "php": "^8.1", "ext-tokenizer": "*", "friendsofphp/php-cs-fixer": "^3.50", - "nexusphp/cs-config": "<=3.18.0" + "nexusphp/cs-config": "^3.19.0" }, "require-dev": { "nexusphp/tachycardia": "^2.1", From ea2c9aa7414d5e7700ab65e39ce394084bfc432e Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Mon, 13 May 2024 20:09:48 +0800 Subject: [PATCH 5/9] Enable `ordered_attributes` --- src/CodeIgniter4.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CodeIgniter4.php b/src/CodeIgniter4.php index 42c7d31..9f21392 100644 --- a/src/CodeIgniter4.php +++ b/src/CodeIgniter4.php @@ -350,7 +350,7 @@ public function __construct() 'object_operator_without_whitespace' => true, 'octal_notation' => false, // requires 8.1+ 'operator_linebreak' => ['only_booleans' => true, 'position' => 'beginning'], - 'ordered_attributes' => false, // requires 8.0+ + 'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'], 'ordered_class_elements' => [ 'order' => [ 'use_trait', From ed109f64b62636b6a3c2408b833347f06b853c78 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sat, 18 May 2024 20:29:25 +0800 Subject: [PATCH 6/9] Enable `nullable_type_declaration` --- src/CodeIgniter4.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CodeIgniter4.php b/src/CodeIgniter4.php index 9f21392..b6c5c36 100644 --- a/src/CodeIgniter4.php +++ b/src/CodeIgniter4.php @@ -344,7 +344,7 @@ public function __construct() 'normalize_index_brace' => true, 'not_operator_with_space' => false, 'not_operator_with_successor_space' => true, - 'nullable_type_declaration' => false, // requires 8.0+ + 'nullable_type_declaration' => ['syntax' => 'question_mark'], 'nullable_type_declaration_for_default_null_value' => true, 'numeric_literal_separator' => false, 'object_operator_without_whitespace' => true, From 7b9a1c5c976d0f62bcfb3be374bf1730b48c9faf Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sat, 18 May 2024 20:30:43 +0800 Subject: [PATCH 7/9] Enable `php_unit_attributes` --- src/CodeIgniter4.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CodeIgniter4.php b/src/CodeIgniter4.php index b6c5c36..78da5c9 100644 --- a/src/CodeIgniter4.php +++ b/src/CodeIgniter4.php @@ -369,7 +369,7 @@ public function __construct() 'ordered_interfaces' => false, 'ordered_traits' => false, 'ordered_types' => false, // requires 8.0+ - 'php_unit_attributes' => false, // requires 8.1+ + 'php_unit_attributes' => true, 'php_unit_construct' => [ 'assertions' => [ 'assertSame', From 81f8083c4015fed7d759200e569fd7b51f0a6181 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sat, 18 May 2024 20:33:12 +0800 Subject: [PATCH 8/9] Enable `ordered_types` --- src/CodeIgniter4.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/CodeIgniter4.php b/src/CodeIgniter4.php index 78da5c9..a24f0b5 100644 --- a/src/CodeIgniter4.php +++ b/src/CodeIgniter4.php @@ -366,9 +366,13 @@ public function __construct() 'imports_order' => ['class', 'function', 'const'], 'case_sensitive' => false, ], - 'ordered_interfaces' => false, - 'ordered_traits' => false, - 'ordered_types' => false, // requires 8.0+ + 'ordered_interfaces' => false, + 'ordered_traits' => false, + 'ordered_types' => [ + 'null_adjustment' => 'always_last', + 'sort_algorithm' => 'alpha', + 'case_sensitive' => false, + ], 'php_unit_attributes' => true, 'php_unit_construct' => [ 'assertions' => [ From c0e5267e5ee0f2e96e1d6bc326cc87ac2b4ab43c Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sat, 18 May 2024 20:33:51 +0800 Subject: [PATCH 9/9] Require PHP 8.1 in ruleset --- src/CodeIgniter4.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CodeIgniter4.php b/src/CodeIgniter4.php index a24f0b5..0884117 100644 --- a/src/CodeIgniter4.php +++ b/src/CodeIgniter4.php @@ -693,7 +693,7 @@ public function __construct() ], ]; - $this->requiredPHPVersion = 70400; + $this->requiredPHPVersion = 80100; $this->autoActivateIsRiskyAllowed = true; }