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..dcdd3f6 100644 --- a/composer.json +++ b/composer.json @@ -19,15 +19,15 @@ "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" + "nexusphp/cs-config": "^3.19.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/src/CodeIgniter4.php b/src/CodeIgniter4.php index 16de03b..0884117 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, @@ -344,13 +344,13 @@ 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, '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', @@ -366,10 +366,14 @@ public function __construct() 'imports_order' => ['class', 'function', 'const'], 'case_sensitive' => false, ], - 'ordered_interfaces' => false, - 'ordered_traits' => false, - 'ordered_types' => false, // requires 8.0+ - 'php_unit_attributes' => false, // requires 8.1+ + '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' => [ 'assertSame', @@ -689,7 +693,7 @@ public function __construct() ], ]; - $this->requiredPHPVersion = 70400; + $this->requiredPHPVersion = 80100; $this->autoActivateIsRiskyAllowed = true; } 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();