diff --git a/system/Language/en/CLI.php b/system/Language/en/CLI.php index 8fe504b40283..b7c8bdaba422 100644 --- a/system/Language/en/CLI.php +++ b/system/Language/en/CLI.php @@ -37,7 +37,7 @@ 'parentClass' => 'Parent class', 'returnType' => 'Return type', 'tableName' => 'Table name', - 'usingCINamespace' => 'Warning: Using the "CodeIgniter" namespace will generate the file in the system directory.' + 'usingCINamespace' => 'Warning: Using the "CodeIgniter" namespace will generate the file in the system directory.', ], 'helpArguments' => 'Arguments:', 'helpDescription' => 'Description:', diff --git a/tests/_support/Models/ValidErrorsModel.php b/tests/_support/Models/ValidErrorsModel.php index 97ea3a359a4f..3be93bbf90df 100644 --- a/tests/_support/Models/ValidErrorsModel.php +++ b/tests/_support/Models/ValidErrorsModel.php @@ -25,7 +25,7 @@ class ValidErrorsModel extends Model 'min_length[10]', 'errors' => [ 'min_length' => 'Minimum Length Error', - ] + ], ], 'token' => 'in_list[{id}]', ]; diff --git a/tests/system/Commands/CommandTest.php b/tests/system/Commands/CommandTest.php index d02a4a8157ab..0c546e560919 100644 --- a/tests/system/Commands/CommandTest.php +++ b/tests/system/Commands/CommandTest.php @@ -195,7 +195,7 @@ public function commandArgsProvider(): array 'reveal as -df "using mixed \'quotes\'\" here\""', [ 'as', - 'df' => 'using mixed \'quotes\'" here"' + 'df' => 'using mixed \'quotes\'" here"', ], ], ]; diff --git a/tests/system/Config/fixtures/RegistrarConfig.php b/tests/system/Config/fixtures/RegistrarConfig.php index 406f84f280cb..7618ff557d9d 100644 --- a/tests/system/Config/fixtures/RegistrarConfig.php +++ b/tests/system/Config/fixtures/RegistrarConfig.php @@ -4,6 +4,6 @@ class RegistrarConfig extends \CodeIgniter\Config\BaseConfig { public $foo = 'bar'; public $bar = [ - 'baz' + 'baz', ]; } diff --git a/tests/system/Database/Builder/InsertTest.php b/tests/system/Database/Builder/InsertTest.php index f732fafda04e..1e5d6463b259 100644 --- a/tests/system/Database/Builder/InsertTest.php +++ b/tests/system/Database/Builder/InsertTest.php @@ -92,10 +92,10 @@ public function testInsertBatchWithFieldsEndingInNumbers() $builder = $this->db->table('ip_table'); $data = [ - [ 'ip' => '1.1.1.0', 'ip2' => '1.1.1.2' ], - [ 'ip' => '2.2.2.0', 'ip2' => '2.2.2.2' ], - [ 'ip' => '3.3.3.0', 'ip2' => '3.3.3.2' ], - [ 'ip' => '4.4.4.0', 'ip2' => '4.4.4.2' ], + ['ip' => '1.1.1.0', 'ip2' => '1.1.1.2'], + ['ip' => '2.2.2.0', 'ip2' => '2.2.2.2'], + ['ip' => '3.3.3.0', 'ip2' => '3.3.3.2'], + ['ip' => '4.4.4.0', 'ip2' => '4.4.4.2'], ]; $this->db->shouldReturn('execute', 1)->shouldReturn('affectedRows', 1); diff --git a/tests/system/Filters/FiltersTest.php b/tests/system/Filters/FiltersTest.php index b590cedad5c2..9b5c748e8c0c 100644 --- a/tests/system/Filters/FiltersTest.php +++ b/tests/system/Filters/FiltersTest.php @@ -140,10 +140,10 @@ public function testProcessMethodProcessGlobals() 'globals' => [ 'before' => [ 'foo' => ['bar'], // not excluded - 'bar' + 'bar', ], 'after' => [ - 'baz' + 'baz', ], ], ]; @@ -189,10 +189,10 @@ public function testProcessMethodProcessGlobalsWithExcept(array $except) 'globals' => [ 'before' => [ 'foo' => ['except' => $except], - 'bar' + 'bar', ], 'after' => [ - 'baz' + 'baz', ], ], ]; @@ -201,7 +201,7 @@ public function testProcessMethodProcessGlobalsWithExcept(array $except) $expected = [ 'before' => [ - 'bar' + 'bar', ], 'after' => ['baz'], ]; @@ -283,10 +283,10 @@ public function testProcessMethodProcessesCombined() 'globals' => [ 'before' => [ 'foog' => ['except' => ['admin/*']], - 'barg' + 'barg', ], 'after' => [ - 'bazg' + 'bazg', ], ], 'methods' => [ @@ -515,10 +515,10 @@ public function testBeforeExceptString() 'globals' => [ 'before' => [ 'foo' => ['except' => 'admin/*'], - 'bar' + 'bar', ], 'after' => [ - 'baz' + 'baz', ], ], ]; @@ -527,7 +527,7 @@ public function testBeforeExceptString() $expected = [ 'before' => [ - 'bar' + 'bar', ], 'after' => ['baz'], ]; @@ -548,10 +548,10 @@ public function testBeforeExceptInapplicable() 'globals' => [ 'before' => [ 'foo' => ['except' => 'george/*'], - 'bar' + 'bar', ], 'after' => [ - 'baz' + 'baz', ], ], ]; @@ -581,11 +581,11 @@ public function testAfterExceptString() ], 'globals' => [ 'before' => [ - 'bar' + 'bar', ], 'after' => [ 'foo' => ['except' => 'admin/*'], - 'baz' + 'baz', ], ], ]; @@ -594,7 +594,7 @@ public function testAfterExceptString() $expected = [ 'before' => [ - 'bar' + 'bar', ], 'after' => ['baz'], ]; @@ -614,11 +614,11 @@ public function testAfterExceptInapplicable() ], 'globals' => [ 'before' => [ - 'bar' + 'bar', ], 'after' => [ 'foo' => ['except' => 'george/*'], - 'baz' + 'baz', ], ], ]; @@ -627,7 +627,7 @@ public function testAfterExceptInapplicable() $expected = [ 'before' => [ - 'bar' + 'bar', ], 'after' => [ 'foo', @@ -814,11 +814,11 @@ public function testMatchesURICaseInsensitively() 'globals' => [ 'before' => [ 'foo' => ['except' => 'Admin/*'], - 'bar' + 'bar', ], 'after' => [ 'foo' => ['except' => 'Admin/*'], - 'baz' + 'baz', ], ], 'filters' => [ @@ -910,7 +910,7 @@ public function testGlobalFilterMatching() $expected = [ 'before' => [ - 'one' + 'one', ], 'after' => [ 'foo', diff --git a/tests/system/HTTP/ResponseTest.php b/tests/system/HTTP/ResponseTest.php index 3537dd7c4740..58cc443fbe30 100644 --- a/tests/system/HTTP/ResponseTest.php +++ b/tests/system/HTTP/ResponseTest.php @@ -231,7 +231,7 @@ public function testSetCache() 'etag' => '12345678', 'last-modified' => $date, 'max-age' => 300, - 'must-revalidate' + 'must-revalidate', ]; $response->setCache($options); diff --git a/tests/system/Helpers/FilesystemHelperTest.php b/tests/system/Helpers/FilesystemHelperTest.php index 84c020b309c9..9b6a6eba6f55 100644 --- a/tests/system/Helpers/FilesystemHelperTest.php +++ b/tests/system/Helpers/FilesystemHelperTest.php @@ -47,7 +47,7 @@ public function testDirectoryMapDefaults() 'faz', ], 'AnEmptyFolder' . DIRECTORY_SEPARATOR => [], - 'simpleFile' + 'simpleFile', ]; $root = vfsStream::setup('root', null, $this->structure); @@ -72,7 +72,7 @@ public function testDirectoryMapShowsHiddenFiles() ], 'AnEmptyFolder' . DIRECTORY_SEPARATOR => [], 'simpleFile', - '.hidden' + '.hidden', ]; $root = vfsStream::setup('root', null, $this->structure); diff --git a/tests/system/Language/LanguageTest.php b/tests/system/Language/LanguageTest.php index 39f9f46019a2..344f08acbf45 100644 --- a/tests/system/Language/LanguageTest.php +++ b/tests/system/Language/LanguageTest.php @@ -117,7 +117,7 @@ public function testGetLineArrayFormatsMessages() $this->lang->setData('books', [ 'bookList' => [ - '{0, number, integer} related books.' + '{0, number, integer} related books.', ], ]); @@ -146,7 +146,7 @@ public function testLangDoesntFormat() $this->lang->setData('books', [ 'bookList' => [ - '{0, number, integer} related books.' + '{0, number, integer} related books.', ], ]); diff --git a/tests/system/View/ParserTest.php b/tests/system/View/ParserTest.php index b37e558af7da..cd371c077535 100644 --- a/tests/system/View/ParserTest.php +++ b/tests/system/View/ParserTest.php @@ -286,9 +286,7 @@ public function toArray(bool $onlyChanged = false, bool $cast = true, bool $recu $data = [ 'title' => 'Super Heroes', - 'powers' => [ - $power - ], + 'powers' => [$power], ]; $template = "{title}\n{powers} {foo} {bar} {bobbles}{name} {/bobbles}{/powers}"; @@ -324,7 +322,7 @@ public function __construct() $data = [ 'title' => 'Super Heroes', 'powers' => [ - $power + $power, ], ]; diff --git a/utils/PhpCsFixer/CodeIgniter4.php b/utils/PhpCsFixer/CodeIgniter4.php index 28d1eaf066b2..0f9300820cda 100644 --- a/utils/PhpCsFixer/CodeIgniter4.php +++ b/utils/PhpCsFixer/CodeIgniter4.php @@ -61,13 +61,17 @@ public function __construct() 'position_after_control_structures' => 'same', 'position_after_functions_and_oop_constructs' => 'next', ], - 'cast_spaces' => ['space' => 'single'], - 'function_to_constant' => true, - 'indentation_type' => true, - 'line_ending' => true, - 'no_alias_functions' => ['sets' => ['@all']], - 'phpdoc_align' => true, - 'phpdoc_scalar' => [ + 'cast_spaces' => ['space' => 'single'], + 'function_to_constant' => true, + 'indentation_type' => true, + 'line_ending' => true, + 'list_syntax' => ['syntax' => 'short'], + 'no_alias_functions' => ['sets' => ['@all']], + 'no_trailing_comma_in_singleline_array' => true, + 'no_whitespace_before_comma_in_array' => ['after_heredoc' => true], + 'normalize_index_brace' => true, + 'phpdoc_align' => true, + 'phpdoc_scalar' => [ 'types' => [ 'boolean', 'callback', @@ -77,10 +81,16 @@ public function __construct() 'str', ], ], - 'phpdoc_separation' => true, - 'static_lambda' => true, - 'ternary_to_null_coalescing' => true, - 'yoda_style' => [ + 'phpdoc_separation' => true, + 'static_lambda' => true, + 'ternary_to_null_coalescing' => true, + 'trailing_comma_in_multiline' => [ + 'after_heredoc' => true, + 'elements' => ['arrays'], + ], + 'trim_array_spaces' => true, + 'whitespace_after_comma_in_array' => true, + 'yoda_style' => [ 'equal' => false, 'identical' => null, 'less_and_greater' => false,