diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 4ee490165864..c9c24c7a06f8 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -40,7 +40,17 @@ ]); $overrides = [ - 'get_class_to_class_keyword' => true, + 'get_class_to_class_keyword' => true, + 'trailing_comma_in_multiline' => [ + 'after_heredoc' => true, + 'elements' => [ + 'arguments', + 'array_destructuring', + 'arrays', + 'match', + 'parameters', + ], + ], ]; $options = [ @@ -55,5 +65,5 @@ return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary( 'CodeIgniter 4 framework', 'CodeIgniter Foundation', - 'admin@codeigniter.com' + 'admin@codeigniter.com', ); diff --git a/admin/create-new-changelog.php b/admin/create-new-changelog.php index ff333f42693f..cc7f8359a570 100644 --- a/admin/create-new-changelog.php +++ b/admin/create-new-changelog.php @@ -47,7 +47,7 @@ function replace_file_content(string $path, string $pattern, string $replace): v replace_file_content( $changelogIndex, '/\.\. toctree::\n :titlesonly:\n/u', - ".. toctree::\n :titlesonly:\n\n v{$version}" + ".. toctree::\n :titlesonly:\n\n v{$version}", ); // Replace {version} $length = mb_strlen("Version {$version}"); @@ -55,12 +55,12 @@ function replace_file_content(string $path, string $pattern, string $replace): v replace_file_content( $changelog, '/#################\nVersion {version}\n#################/u', - "{$underline}\nVersion {$version}\n{$underline}" + "{$underline}\nVersion {$version}\n{$underline}", ); replace_file_content( $changelog, '/{version}/u', - "{$version}" + "{$version}", ); // Copy upgrading @@ -72,7 +72,7 @@ function replace_file_content(string $path, string $pattern, string $replace): v replace_file_content( $upgradingIndex, '/ backward_compatibility_notes\n/u', - " backward_compatibility_notes\n\n upgrade_{$versionWithoutDots}" + " backward_compatibility_notes\n\n upgrade_{$versionWithoutDots}", ); // Replace {version} $length = mb_strlen("Upgrading from {$versionCurrent} to {$version}"); @@ -80,7 +80,7 @@ function replace_file_content(string $path, string $pattern, string $replace): v replace_file_content( $upgrading, '/##############################\nUpgrading from {version} to {version}\n##############################/u', - "{$underline}\nUpgrading from {$versionCurrent} to {$version}\n{$underline}" + "{$underline}\nUpgrading from {$versionCurrent} to {$version}\n{$underline}", ); // Commits diff --git a/admin/prepare-release.php b/admin/prepare-release.php index c0dcab6866ce..5d66a43b8c86 100644 --- a/admin/prepare-release.php +++ b/admin/prepare-release.php @@ -33,31 +33,31 @@ function replace_file_content(string $path, string $pattern, string $replace): v replace_file_content( './system/CodeIgniter.php', '/public const CI_VERSION = \'.*?\';/u', - "public const CI_VERSION = '{$version}';" + "public const CI_VERSION = '{$version}';", ); // Updates version number in "conf.py". replace_file_content( './user_guide_src/source/conf.py', '/^version = \'.*?\'/mu', - "version = '{$minor}'" + "version = '{$minor}'", ); replace_file_content( './user_guide_src/source/conf.py', '/^release = \'.*?\'/mu', - "release = '{$version}'" + "release = '{$version}'", ); // Updates version number in "phpdoc.dist.xml". replace_file_content( './phpdoc.dist.xml', '!CodeIgniter v.*? API!mu', - "CodeIgniter v{$minor} API" + "CodeIgniter v{$minor} API", ); replace_file_content( './phpdoc.dist.xml', '//mu', - "" + "", ); // Updates release date in changelogs. @@ -65,7 +65,7 @@ function replace_file_content(string $path, string $pattern, string $replace): v replace_file_content( "./user_guide_src/source/changelogs/v{$version}.rst", '/^Release Date: .*/mu', - "Release Date: {$date}" + "Release Date: {$date}", ); // Commits diff --git a/admin/starter/tests/unit/HealthTest.php b/admin/starter/tests/unit/HealthTest.php index f6a5a804802f..b3e480f4b0bf 100644 --- a/admin/starter/tests/unit/HealthTest.php +++ b/admin/starter/tests/unit/HealthTest.php @@ -32,7 +32,7 @@ public function testBaseUrlHasBeenSet(): void $config = new App(); $this->assertTrue( $validation->check($config->baseURL, 'valid_url'), - 'baseURL "' . $config->baseURL . '" in .env is not valid URL' + 'baseURL "' . $config->baseURL . '" in .env is not valid URL', ); } @@ -43,7 +43,7 @@ public function testBaseUrlHasBeenSet(): void // BaseURL in app/Config/App.php is a valid URL? $this->assertTrue( $validation->check($reader->baseURL, 'valid_url'), - 'baseURL "' . $reader->baseURL . '" in app/Config/App.php is not valid URL' + 'baseURL "' . $reader->baseURL . '" in app/Config/App.php is not valid URL', ); } } diff --git a/preload.php b/preload.php index 755df5e4a4ed..0b453122345e 100644 --- a/preload.php +++ b/preload.php @@ -86,7 +86,7 @@ public function load(): void $phpFiles = new RegexIterator( $fullTree, '/.+((? $file) { diff --git a/public/index.php b/public/index.php index 5ec58a7729c3..eb7f5c988838 100644 --- a/public/index.php +++ b/public/index.php @@ -11,7 +11,7 @@ $message = sprintf( 'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s', $minPhpVersion, - PHP_VERSION + PHP_VERSION, ); header('HTTP/1.1 503 Service Unavailable.', true, 503); diff --git a/rector.php b/rector.php index 486685959c70..e5c21c814ab2 100644 --- a/rector.php +++ b/rector.php @@ -62,7 +62,7 @@ ->withCache( // Github action cache or local is_dir('/tmp') ? '/tmp/rector' : null, - FileCacheStorage::class + FileCacheStorage::class, ) // paths to refactor; solid alternative to CLI arguments ->withPaths([ diff --git a/spark b/spark index 992d044c9ee2..856dc3f8a227 100755 --- a/spark +++ b/spark @@ -40,7 +40,7 @@ if (version_compare(PHP_VERSION, $minPhpVersion, '<')) { $message = sprintf( 'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s', $minPhpVersion, - PHP_VERSION + PHP_VERSION, ); exit($message); diff --git a/system/API/ResponseTrait.php b/system/API/ResponseTrait.php index 01ce42860b32..dbfa83dc88dc 100644 --- a/system/API/ResponseTrait.php +++ b/system/API/ResponseTrait.php @@ -319,7 +319,7 @@ protected function format($data = null) $mime = $this->request->negotiate( 'media', $format->getConfig()->supportedResponseFormats, - false + false, ); } diff --git a/system/Autoloader/Autoloader.php b/system/Autoloader/Autoloader.php index b338027c9c8a..50e6eaed2337 100644 --- a/system/Autoloader/Autoloader.php +++ b/system/Autoloader/Autoloader.php @@ -347,7 +347,7 @@ public function sanitizeFilename(string $filename): string throw new InvalidArgumentException( 'The file path contains special characters "' . $chars - . '" that are not allowed: "' . $filename . '"' + . '" that are not allowed: "' . $filename . '"', ); } if ($result === false) { @@ -386,7 +386,7 @@ private function loadComposerNamespaces(ClassLoader $composer, array $composerPa throw new RuntimeException( 'Your Composer version is too old.' . ' Please update Composer (run `composer self-update`) to v2.0.14 or later' - . ' and remove your vendor/ directory, and run `composer update`.' + . ' and remove your vendor/ directory, and run `composer update`.', ); } // This method requires Composer 2.0.14 or later. diff --git a/system/Autoloader/FileLocator.php b/system/Autoloader/FileLocator.php index 8e2564e00941..844ac7fc4cc9 100644 --- a/system/Autoloader/FileLocator.php +++ b/system/Autoloader/FileLocator.php @@ -295,9 +295,9 @@ public function findQualifiedNameFromPath(string $path) str_replace( '/', '\\', - mb_substr($path, mb_strlen($namespace['path'])) + mb_substr($path, mb_strlen($namespace['path'])), ), - '\\' + '\\', ); // Remove the file extension (.php) $className = mb_substr($className, 0, -4); diff --git a/system/BaseModel.php b/system/BaseModel.php index 05c5459d8c4b..a10acef72e2e 100644 --- a/system/BaseModel.php +++ b/system/BaseModel.php @@ -379,7 +379,7 @@ protected function createDataConverter(): void $this->converter = new DataConverter( $this->casts, $this->castHandlers, - $this->db + $this->db, ); } } @@ -1081,7 +1081,7 @@ public function updateBatch(?array $set = null, ?string $index = null, int $batc if ($updateIndex === null) { throw new InvalidArgumentException( 'The index ("' . $index . '") for updateBatch() is missing in the data: ' - . json_encode($row) + . json_encode($row), ); } diff --git a/system/Boot.php b/system/Boot.php index 4b2d20ca95b6..502692249b06 100644 --- a/system/Boot.php +++ b/system/Boot.php @@ -288,7 +288,7 @@ protected static function checkMissingExtensions(): void $message = sprintf( 'The framework needs the following extension(s) installed and loaded: %s.', - implode(', ', $missingExtensions) + implode(', ', $missingExtensions), ); header('HTTP/1.1 503 Service Unavailable.', true, 503); diff --git a/system/CLI/CLI.php b/system/CLI/CLI.php index 0f1fe5dbce2c..b8b90d77ba2d 100644 --- a/system/CLI/CLI.php +++ b/system/CLI/CLI.php @@ -610,11 +610,11 @@ public static function color(string $text, string $foreground, ?string $backgrou $nonColoredText = preg_replace( $pattern, '<<__colored_string__>>', - $text + $text, ); $nonColoredChunks = preg_split( '/<<__colored_string__>>/u', - $nonColoredText + $nonColoredText, ); foreach ($nonColoredChunks as $i => $chunk) { diff --git a/system/CLI/Console.php b/system/CLI/Console.php index 725193d424b5..5cb8b57a0ad3 100644 --- a/system/CLI/Console.php +++ b/system/CLI/Console.php @@ -63,7 +63,7 @@ public function showHeader(bool $suppress = false) 'CodeIgniter v%s Command Line Tool - Server Time: %s UTC%s', CodeIgniter::CI_VERSION, date('Y-m-d H:i:s'), - date('P') + date('P'), ), 'green'); CLI::newLine(); } diff --git a/system/CLI/GeneratorTrait.php b/system/CLI/GeneratorTrait.php index 6a061a36b8b3..1024fa695259 100644 --- a/system/CLI/GeneratorTrait.php +++ b/system/CLI/GeneratorTrait.php @@ -171,7 +171,7 @@ private function generateFile(string $target, string $content): void CLI::prompt( 'Are you sure you want to continue?', ['y', 'n'], - 'required' + 'required', ) === 'n' ) { CLI::newLine(); @@ -193,7 +193,7 @@ private function generateFile(string $target, string $content): void CLI::error( lang('CLI.generator.fileExist', [clean_path($target)]), 'light_gray', - 'red' + 'red', ); CLI::newLine(); @@ -216,7 +216,7 @@ private function generateFile(string $target, string $content): void CLI::error( lang('CLI.generator.fileError', [clean_path($target)]), 'light_gray', - 'red' + 'red', ); CLI::newLine(); @@ -227,7 +227,7 @@ private function generateFile(string $target, string $content): void if ($this->getOption('force') && $isFile) { CLI::write( lang('CLI.generator.fileOverwrite', [clean_path($target)]), - 'yellow' + 'yellow', ); CLI::newLine(); @@ -236,7 +236,7 @@ private function generateFile(string $target, string $content): void CLI::write( lang('CLI.generator.fileCreate', [clean_path($target)]), - 'green' + 'green', ); CLI::newLine(); } @@ -326,10 +326,10 @@ private function normalizeInputClassName(): string '\\', array_map( pascalize(...), - explode('\\', str_replace('/', '\\', trim($class))) - ) + explode('\\', str_replace('/', '\\', trim($class))), + ), ), - '\\/' + '\\/', ); } @@ -351,7 +351,7 @@ protected function renderTemplate(array $data = []): string return view( "CodeIgniter\\Commands\\Generators\\Views\\{$this->template}", $data, - ['debug' => false] + ['debug' => false], ); } } @@ -370,15 +370,15 @@ protected function parseTemplate( string $class, array $search = [], array $replace = [], - array $data = [] + array $data = [], ): string { // Retrieves the namespace part from the fully qualified class name. $namespace = trim( implode( '\\', - array_slice(explode('\\', $class), 0, -1) + array_slice(explode('\\', $class), 0, -1), ), - '\\' + '\\', ); $search[] = '<@php'; $search[] = '{namespace}'; @@ -404,7 +404,7 @@ protected function buildContent(string $class): string && preg_match( '/(?P(?:^use [^;]+;$\n?)+)/m', $template, - $match + $match, ) ) { $imports = explode("\n", trim($match['imports'])); @@ -432,7 +432,7 @@ protected function buildPath(string $class): string CLI::error( lang('CLI.namespaceNotDefined', [$namespace]), 'light_gray', - 'red' + 'red', ); CLI::newLine(); @@ -446,7 +446,7 @@ protected function buildPath(string $class): string . str_replace( '\\', DIRECTORY_SEPARATOR, - trim(str_replace($namespace . '\\', '', $class), '\\') + trim(str_replace($namespace . '\\', '', $class), '\\'), ) . '.php'; return implode( @@ -454,8 +454,8 @@ protected function buildPath(string $class): string array_slice( explode(DIRECTORY_SEPARATOR, $file), 0, - -1 - ) + -1, + ), ) . DIRECTORY_SEPARATOR . $this->basename($file); } @@ -470,9 +470,9 @@ protected function getNamespace(): string str_replace( '/', '\\', - $this->getOption('namespace') ?? APP_NAMESPACE + $this->getOption('namespace') ?? APP_NAMESPACE, ), - '\\' + '\\', ); } diff --git a/system/Cache/Handlers/MemcachedHandler.php b/system/Cache/Handlers/MemcachedHandler.php index e1048004077a..f3bc00f40ba1 100644 --- a/system/Cache/Handlers/MemcachedHandler.php +++ b/system/Cache/Handlers/MemcachedHandler.php @@ -85,7 +85,7 @@ public function initialize() $this->memcached->addServer( $this->config['host'], $this->config['port'], - $this->config['weight'] + $this->config['weight'], ); // attempt to get status of servers @@ -103,7 +103,7 @@ public function initialize() // Check if we can connect to the server $canConnect = $this->memcached->connect( $this->config['host'], - $this->config['port'] + $this->config['port'], ); // If we can't connect, throw a CriticalError exception @@ -116,7 +116,7 @@ public function initialize() $this->config['host'], $this->config['port'], true, - $this->config['weight'] + $this->config['weight'], ); } else { throw new CriticalError('Cache: Not support Memcache(d) extension.'); diff --git a/system/Cache/Handlers/PredisHandler.php b/system/Cache/Handlers/PredisHandler.php index fc0185033d64..bdf5afe0f22f 100644 --- a/system/Cache/Handlers/PredisHandler.php +++ b/system/Cache/Handlers/PredisHandler.php @@ -82,7 +82,7 @@ public function get(string $key) $data = array_combine( ['__ci_type', '__ci_value'], - $this->redis->hmget($key, ['__ci_type', '__ci_value']) + $this->redis->hmget($key, ['__ci_type', '__ci_value']), ); if (! isset($data['__ci_type'], $data['__ci_value']) || $data['__ci_value'] === false) { diff --git a/system/Cache/ResponseCache.php b/system/Cache/ResponseCache.php index 388931813c7c..448e7b83dfd4 100644 --- a/system/Cache/ResponseCache.php +++ b/system/Cache/ResponseCache.php @@ -112,7 +112,7 @@ public function make($request, ResponseInterface $response): bool return $this->cache->save( $this->generateCacheKey($request), serialize(['headers' => $headers, 'output' => $response->getBody()]), - $this->ttl + $this->ttl, ); } diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index e92a6a10ae8c..716d3701d1a4 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -325,7 +325,7 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon if ($this->context === null) { throw new LogicException( 'Context must be set before run() is called. If you are upgrading from 4.1.x, ' - . 'you need to merge `public/index.php` and `spark` file from `vendor/codeigniter4/framework`.' + . 'you need to merge `public/index.php` and `spark` file from `vendor/codeigniter4/framework`.', ); } @@ -799,7 +799,7 @@ public function displayPerformanceMetrics(string $output): string return str_replace( ['{elapsed_time}', '{memory_usage}'], [(string) $this->totalTime, number_format(memory_get_peak_usage() / 1024 / 1024, 3)], - $output + $output, ); } @@ -979,7 +979,7 @@ protected function display404errors(PageNotFoundException $e) // Throws new PageNotFoundException and remove exception message on production. throw PageNotFoundException::forPageNotFound( - (ENVIRONMENT !== 'production' || ! $this->isWeb()) ? $e->getMessage() : null + (ENVIRONMENT !== 'production' || ! $this->isWeb()) ? $e->getMessage() : null, ); } @@ -1064,7 +1064,7 @@ public function storePreviousURL($uri) $uri->getAuthority(), $uri->getPath(), $uri->getQuery(), - $uri->getFragment() + $uri->getFragment(), )); } } diff --git a/system/Commands/Database/ShowTableInfo.php b/system/Commands/Database/ShowTableInfo.php index 147b6eb61446..2367bbff4dff 100644 --- a/system/Commands/Database/ShowTableInfo.php +++ b/system/Commands/Database/ShowTableInfo.php @@ -144,7 +144,7 @@ public function run(array $params) $tableNameNo = CLI::promptByKey( ['Here is the list of your database tables:', 'Which table do you want to see?'], $tables, - 'required' + 'required', ); CLI::newLine(); @@ -174,7 +174,7 @@ private function showDBConfig(): void ]]; CLI::table( $data, - ['hostname', 'database', 'username', 'DBDriver', 'DBPrefix', 'port'] + ['hostname', 'database', 'username', 'DBDriver', 'DBPrefix', 'port'], ); } @@ -272,7 +272,7 @@ private function makeTableRows( string $tableName, int $limitRows, int $limitFieldValue, - ?string $sortField = null + ?string $sortField = null, ): array { $this->tbody = []; @@ -290,7 +290,7 @@ private function makeTableRows( static fn ($item): string => mb_strlen((string) $item) > $limitFieldValue ? mb_substr((string) $item, 0, $limitFieldValue) . '...' : (string) $item, - $row + $row, ); $this->tbody[] = $row; } diff --git a/system/Commands/Encryption/GenerateKey.php b/system/Commands/Encryption/GenerateKey.php index 21a582a06725..a3fdbd4393a9 100644 --- a/system/Commands/Encryption/GenerateKey.php +++ b/system/Commands/Encryption/GenerateKey.php @@ -182,7 +182,7 @@ protected function writeNewEncryptionKeyToFile(string $oldKey, string $newKey): $newFileContents = preg_replace( '/^[#\s]*encryption.key[=\s]*(?:hex2bin\:[a-f0-9]{64}|base64\:(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?)$/m', $replacementKey, - $oldFileContents + $oldFileContents, ); } diff --git a/system/Commands/Generators/CellGenerator.php b/system/Commands/Generators/CellGenerator.php index 57d79ac8902b..04c5bd8adf04 100644 --- a/system/Commands/Generators/CellGenerator.php +++ b/system/Commands/Generators/CellGenerator.php @@ -96,7 +96,7 @@ public function run(array $params) $viewName = preg_replace( '/([a-z][a-z0-9_\/\\\\]+)(_cell)$/i', '$1', - $viewName + $viewName, ) ?? $viewName; $namespace = substr($className, 0, strrpos($className, '\\') + 1); diff --git a/system/Commands/Generators/CommandGenerator.php b/system/Commands/Generators/CommandGenerator.php index 8c2ebcfb5d44..a0872f63c2ba 100644 --- a/system/Commands/Generators/CommandGenerator.php +++ b/system/Commands/Generators/CommandGenerator.php @@ -115,7 +115,7 @@ protected function prepare(string $class): string $class, ['{group}', '{command}'], [$group, $command], - ['type' => $type] + ['type' => $type], ); } } diff --git a/system/Commands/Generators/ControllerGenerator.php b/system/Commands/Generators/ControllerGenerator.php index c6f54cac2888..287f92f87c30 100644 --- a/system/Commands/Generators/ControllerGenerator.php +++ b/system/Commands/Generators/ControllerGenerator.php @@ -130,7 +130,7 @@ protected function prepare(string $class): string $class, ['{useStatement}', '{extends}'], [$useStatement, $extends], - ['type' => $rest] + ['type' => $rest], ); } } diff --git a/system/Commands/Generators/TestGenerator.php b/system/Commands/Generators/TestGenerator.php index 35019c72b826..7ab6859ed9a9 100644 --- a/system/Commands/Generators/TestGenerator.php +++ b/system/Commands/Generators/TestGenerator.php @@ -102,9 +102,9 @@ protected function getNamespace(): string str_replace( '/', '\\', - $this->getOption('namespace') + $this->getOption('namespace'), ), - '\\' + '\\', ); } @@ -143,7 +143,7 @@ protected function buildPath(string $class): string CLI::error( lang('CLI.namespaceNotDefined', [$namespace]), 'light_gray', - 'red' + 'red', ); CLI::newLine(); @@ -157,7 +157,7 @@ protected function buildPath(string $class): string . str_replace( '\\', DIRECTORY_SEPARATOR, - trim(str_replace($namespace . '\\', '', $class), '\\') + trim(str_replace($namespace . '\\', '', $class), '\\'), ) . '.php'; return implode( @@ -165,8 +165,8 @@ protected function buildPath(string $class): string array_slice( explode(DIRECTORY_SEPARATOR, $file), 0, - -1 - ) + -1, + ), ) . DIRECTORY_SEPARATOR . $this->basename($file); } diff --git a/system/Commands/Translation/LocalizationFinder.php b/system/Commands/Translation/LocalizationFinder.php index e7d4eff69663..3307dab8a4e4 100644 --- a/system/Commands/Translation/LocalizationFinder.php +++ b/system/Commands/Translation/LocalizationFinder.php @@ -70,7 +70,7 @@ public function run(array $params) if (! in_array($optionLocale, config(App::class)->supportedLocales, true)) { CLI::error( 'Error: "' . $optionLocale . '" is not supported. Supported locales: ' - . implode(', ', config(App::class)->supportedLocales) + . implode(', ', config(App::class)->supportedLocales), ); return EXIT_USER_INPUT; @@ -116,7 +116,7 @@ private function process(string $currentDir, string $currentLocale): void [ 'foundLanguageKeys' => $foundLanguageKeys, 'badLanguageKeys' => $badLanguageKeys, - 'countFiles' => $countFiles + 'countFiles' => $countFiles, ] = $this->findLanguageKeysInFiles($files); ksort($foundLanguageKeys); diff --git a/system/Commands/Utilities/ConfigCheck.php b/system/Commands/Utilities/ConfigCheck.php index 7d6dc332ca45..fa84cb287caa 100644 --- a/system/Commands/Utilities/ConfigCheck.php +++ b/system/Commands/Utilities/ConfigCheck.php @@ -109,7 +109,7 @@ public function run(array $params) CLI::write($this->getKintD($config)); } else { CLI::write( - CLI::color($this->getVarDump($config), 'cyan') + CLI::color($this->getVarDump($config), 'cyan'), ); } @@ -150,7 +150,7 @@ private function getVarDump(object $config): string return preg_replace( '!.*system/Commands/Utilities/ConfigCheck.php.*\n!u', '', - $output + $output, ); } } diff --git a/system/Commands/Utilities/Environment.php b/system/Commands/Utilities/Environment.php index 17a08d21d2ce..103591209d1e 100644 --- a/system/Commands/Utilities/Environment.php +++ b/system/Commands/Utilities/Environment.php @@ -151,7 +151,7 @@ private function writeNewEnvironmentToEnvFile(string $newEnv): bool return file_put_contents( $envFile, - preg_replace($pattern, "\nCI_ENVIRONMENT = {$newEnv}", file_get_contents($envFile), -1, $count) + preg_replace($pattern, "\nCI_ENVIRONMENT = {$newEnv}", file_get_contents($envFile), -1, $count), ) !== false && $count > 0; } } diff --git a/system/Commands/Utilities/FilterCheck.php b/system/Commands/Utilities/FilterCheck.php index 56fcdb00b971..a7a8803bd776 100644 --- a/system/Commands/Utilities/FilterCheck.php +++ b/system/Commands/Utilities/FilterCheck.php @@ -100,7 +100,7 @@ public function run(array $params) CLI::color( '"' . strtoupper($method) . ' ' . $route . '"', 'black', - 'light_gray' + 'light_gray', ), ); diff --git a/system/Commands/Utilities/Optimize.php b/system/Commands/Utilities/Optimize.php index fa7612d524a6..2c147de6c3f1 100644 --- a/system/Commands/Utilities/Optimize.php +++ b/system/Commands/Utilities/Optimize.php @@ -110,13 +110,13 @@ private function enableCaching(): void [ 'public bool $configCacheEnabled = false;' => 'public bool $configCacheEnabled = true;', 'public bool $locatorCacheEnabled = false;' => 'public bool $locatorCacheEnabled = true;', - ] + ], ); if ($result) { CLI::write( 'Config Caching and FileLocator Caching are enabled in "app/Config/Optimize.php".', - 'green' + 'green', ); return; diff --git a/system/Commands/Utilities/Routes.php b/system/Commands/Utilities/Routes.php index d7a6c0b55744..2a6122cab01c 100644 --- a/system/Commands/Utilities/Routes.php +++ b/system/Commands/Utilities/Routes.php @@ -133,7 +133,7 @@ public function run(array $params) $collection->getDefaultController(), $collection->getDefaultMethod(), $methods, - $collection->getRegisteredControllers('*') + $collection->getRegisteredControllers('*'), ); $autoRoutes = $autoRouteCollector->get(); @@ -149,7 +149,7 @@ public function run(array $params) $collection->getDefaultMethod(), $methods, $collection->getRegisteredControllers('*'), - $uri + $uri, ); $autoRoutes = [...$autoRoutes, ...$autoRouteCollector->get()]; @@ -159,7 +159,7 @@ public function run(array $params) $autoRouteCollector = new AutoRouteCollector( $collection->getDefaultNamespace(), $collection->getDefaultController(), - $collection->getDefaultMethod() + $collection->getDefaultMethod(), ); $autoRoutes = $autoRouteCollector->get(); diff --git a/system/Commands/Utilities/Routes/AutoRouteCollector.php b/system/Commands/Utilities/Routes/AutoRouteCollector.php index 73009b9c9eb8..3b91d365ac80 100644 --- a/system/Commands/Utilities/Routes/AutoRouteCollector.php +++ b/system/Commands/Utilities/Routes/AutoRouteCollector.php @@ -41,7 +41,7 @@ public function get(): array $output = $reader->read( $class, $this->defaultController, - $this->defaultMethod + $this->defaultMethod, ); foreach ($output as $item) { diff --git a/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php b/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php index f6a4f371858a..f4a5204fb49b 100644 --- a/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php +++ b/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php @@ -36,7 +36,7 @@ public function __construct( private readonly string $defaultMethod, private readonly array $httpMethods, private readonly array $protectedControllers, - private readonly string $prefix = '' + private readonly string $prefix = '', ) { } @@ -59,7 +59,7 @@ public function get(): array $routes = $reader->read( $class, $this->defaultController, - $this->defaultMethod + $this->defaultMethod, ); if ($routes === []) { diff --git a/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReader.php b/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReader.php index 2755a389ffc3..a0a98afc829a 100644 --- a/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReader.php +++ b/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReader.php @@ -33,7 +33,7 @@ final class ControllerMethodReader */ public function __construct( private readonly string $namespace, - private readonly array $httpMethods + private readonly array $httpMethods, ) { $config = config(Routing::class); $this->translateURIDashes = $config->translateURIDashes; @@ -78,7 +78,7 @@ public function read(string $class, string $defaultController = 'Home', string $ $classname, $methodName, $httpVerb, - $method + $method, ); if ($routeForDefaultController !== []) { @@ -193,7 +193,7 @@ private function translateToUri(string $string): string { if ($this->translateUriToCamelCase) { $string = strtolower( - preg_replace('/([a-z\d])([A-Z])/', '$1-$2', $string) + preg_replace('/([a-z\d])([A-Z])/', '$1-$2', $string), ); } elseif ($this->translateURIDashes) { $string = str_replace('_', '-', $string); @@ -214,7 +214,7 @@ private function getRouteForDefaultController( string $classname, string $methodName, string $httpVerb, - ReflectionMethod $method + ReflectionMethod $method, ): array { $output = []; diff --git a/system/Commands/Utilities/Routes/ControllerFinder.php b/system/Commands/Utilities/Routes/ControllerFinder.php index 71de1681b547..400e30e82d2e 100644 --- a/system/Commands/Utilities/Routes/ControllerFinder.php +++ b/system/Commands/Utilities/Routes/ControllerFinder.php @@ -28,7 +28,7 @@ final class ControllerFinder * @param string $namespace namespace to search */ public function __construct( - private readonly string $namespace + private readonly string $namespace, ) { $this->locator = service('locator'); } diff --git a/system/Commands/Utilities/Routes/ControllerMethodReader.php b/system/Commands/Utilities/Routes/ControllerMethodReader.php index b40a832b4f48..cd47085932bb 100644 --- a/system/Commands/Utilities/Routes/ControllerMethodReader.php +++ b/system/Commands/Utilities/Routes/ControllerMethodReader.php @@ -57,7 +57,7 @@ public function read(string $class, string $defaultController = 'Home', string $ $defaultController, $uriByClass, $classname, - $methodName + $methodName, ); $output = [...$output, ...$routeWithoutController]; @@ -89,7 +89,7 @@ public function read(string $class, string $defaultController = 'Home', string $ $defaultController, $uriByClass, $classname, - $methodName + $methodName, ); $output = [...$output, ...$routeWithoutController]; @@ -153,7 +153,7 @@ private function getRouteWithoutController( string $defaultController, string $uriByClass, string $classname, - string $methodName + string $methodName, ): array { if ($classShortname !== $defaultController) { return []; diff --git a/system/Commands/Utilities/Routes/FilterCollector.php b/system/Commands/Utilities/Routes/FilterCollector.php index b646dcb250a1..51b36662f490 100644 --- a/system/Commands/Utilities/Routes/FilterCollector.php +++ b/system/Commands/Utilities/Routes/FilterCollector.php @@ -32,7 +32,7 @@ public function __construct( * * If set to true, route filters are not found. */ - private readonly bool $resetRoutes = false + private readonly bool $resetRoutes = false, ) { } @@ -50,7 +50,7 @@ public function get(string $method, string $uri): array @trigger_error( 'Passing lowercase HTTP method "' . $method . '" is deprecated.' . ' Use uppercase HTTP method like "' . strtoupper($method) . '".', - E_USER_DEPRECATED + E_USER_DEPRECATED, ); } diff --git a/system/Commands/Utilities/Routes/SampleURIGenerator.php b/system/Commands/Utilities/Routes/SampleURIGenerator.php index 45eb2f93201b..a0e5f09bc2cb 100644 --- a/system/Commands/Utilities/Routes/SampleURIGenerator.php +++ b/system/Commands/Utilities/Routes/SampleURIGenerator.php @@ -57,7 +57,7 @@ public function get(string $routeKey): string $sampleUri = str_replace( '{locale}', config(App::class)->defaultLocale, - $routeKey + $routeKey, ); } diff --git a/system/Common.php b/system/Common.php index d5880acf0363..863ff3cdbabb 100644 --- a/system/Common.php +++ b/system/Common.php @@ -146,7 +146,7 @@ function command(string $command) // @codeCoverageIgnoreStart throw new InvalidArgumentException(sprintf( 'Unable to parse input near "... %s ...".', - substr($command, $cursor, 10) + substr($command, $cursor, 10), )); // @codeCoverageIgnoreEnd } @@ -470,7 +470,7 @@ function esc($data, string $context = 'html', ?string $encoding = null) function force_https( int $duration = 31_536_000, ?RequestInterface $request = null, - ?ResponseInterface $response = null + ?ResponseInterface $response = null, ): void { $request ??= service('request'); @@ -1065,7 +1065,7 @@ function slash_item(string $item): ?string 'Cannot convert "%s::$%s" of type "%s" to type "string".', App::class, $item, - gettype($configItem) + gettype($configItem), )); } diff --git a/system/ComposerScripts.php b/system/ComposerScripts.php index 661247dab532..993483c5775a 100644 --- a/system/ComposerScripts.php +++ b/system/ComposerScripts.php @@ -102,7 +102,7 @@ private static function recursiveDelete(string $directory): void /** @var SplFileInfo $file */ foreach (new RecursiveIteratorIterator( new RecursiveDirectoryIterator(rtrim($directory, '\\/'), FilesystemIterator::SKIP_DOTS), - RecursiveIteratorIterator::CHILD_FIRST + RecursiveIteratorIterator::CHILD_FIRST, ) as $file) { $path = $file->getPathname(); @@ -146,7 +146,7 @@ private static function recursiveMirror(string $originDir, string $targetDir): v /** @var SplFileInfo $file */ foreach (new RecursiveIteratorIterator( new RecursiveDirectoryIterator($originDir, FilesystemIterator::SKIP_DOTS), - RecursiveIteratorIterator::SELF_FIRST + RecursiveIteratorIterator::SELF_FIRST, ) as $file) { $origin = $file->getPathname(); $target = $targetDir . substr($origin, $dirLen); diff --git a/system/Config/DotEnv.php b/system/Config/DotEnv.php index d4a7d9e87389..7e95d1352f00 100644 --- a/system/Config/DotEnv.php +++ b/system/Config/DotEnv.php @@ -164,7 +164,7 @@ protected function sanitizeValue(string $value): string %1$s # and the closing quote .*$ # and discard any string after the closing quote /mx', - $quote + $quote, ); $value = preg_replace($regexPattern, '$1', $value); @@ -206,7 +206,7 @@ function ($matchedPatterns) { return $nestedVariable; }, - $value + $value, ); } diff --git a/system/Config/Factories.php b/system/Config/Factories.php index b845d5825f43..fd7d6a32397b 100644 --- a/system/Config/Factories.php +++ b/system/Config/Factories.php @@ -106,7 +106,7 @@ public static function define(string $component, string $alias, string $classnam } throw new InvalidArgumentException( - 'Already defined in Factories: ' . $component . ' ' . $alias . ' -> ' . self::$aliases[$component][$alias] + 'Already defined in Factories: ' . $component . ' ' . $alias . ' -> ' . self::$aliases[$component][$alias], ); } @@ -448,7 +448,7 @@ public static function reset(?string $component = null) self::$options[$component], self::$aliases[$component], self::$instances[$component], - self::$updated[$component] + self::$updated[$component], ); return; diff --git a/system/Config/Services.php b/system/Config/Services.php index 06e8daa9cec9..f5c5a2db4a99 100644 --- a/system/Config/Services.php +++ b/system/Config/Services.php @@ -213,7 +213,7 @@ public static function curlrequest(array $options = [], ?ResponseInterface $resp $config, new URI($options['baseURI'] ?? null), $response, - $options + $options, ); } @@ -267,7 +267,7 @@ public static function encrypter(?EncryptionConfig $config = null, $getShared = */ public static function exceptions( ?ExceptionsConfig $config = null, - bool $getShared = true + bool $getShared = true, ) { if ($getShared) { return static::getSharedInstance('exceptions', $config); @@ -569,7 +569,7 @@ public static function incomingrequest(?App $config = null, bool $getShared = tr $config, AppServices::get('uri'), 'php://input', - new UserAgent() + new UserAgent(), ); } @@ -689,7 +689,7 @@ public static function session(?SessionConfig $config = null, bool $getShared = if (! class_exists($driverName) || ! is_a($driverName, SessionBaseHandler::class, true)) { throw new InvalidArgumentException(sprintf( 'Invalid session handler "%s" provided.', - $driverName + $driverName, )); } @@ -721,7 +721,7 @@ public static function session(?SessionConfig $config = null, bool $getShared = public static function siteurifactory( ?App $config = null, ?Superglobals $superglobals = null, - bool $getShared = true + bool $getShared = true, ) { if ($getShared) { return static::getSharedInstance('siteurifactory', $config, $superglobals); @@ -741,7 +741,7 @@ public static function siteurifactory( public static function superglobals( ?array $server = null, ?array $get = null, - bool $getShared = true + bool $getShared = true, ) { if ($getShared) { return static::getSharedInstance('superglobals', $server, $get); diff --git a/system/DataCaster/Cast/ArrayCast.php b/system/DataCaster/Cast/ArrayCast.php index 4bb0f4c74093..1deddea6fc8e 100644 --- a/system/DataCaster/Cast/ArrayCast.php +++ b/system/DataCaster/Cast/ArrayCast.php @@ -24,7 +24,7 @@ class ArrayCast extends BaseCast implements CastInterface public static function get( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): array { if (! is_string($value)) { self::invalidTypeValueError($value); @@ -40,7 +40,7 @@ public static function get( public static function set( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): string { return serialize($value); } diff --git a/system/DataCaster/Cast/BaseCast.php b/system/DataCaster/Cast/BaseCast.php index c3df0efee103..afe80982e3ba 100644 --- a/system/DataCaster/Cast/BaseCast.php +++ b/system/DataCaster/Cast/BaseCast.php @@ -20,7 +20,7 @@ abstract class BaseCast implements CastInterface public static function get( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): mixed { return $value; } @@ -28,7 +28,7 @@ public static function get( public static function set( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): mixed { return $value; } diff --git a/system/DataCaster/Cast/BooleanCast.php b/system/DataCaster/Cast/BooleanCast.php index e4a3fde09345..6554081e155d 100644 --- a/system/DataCaster/Cast/BooleanCast.php +++ b/system/DataCaster/Cast/BooleanCast.php @@ -24,7 +24,7 @@ class BooleanCast extends BaseCast public static function get( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): bool { // For PostgreSQL if ($value === 't') { diff --git a/system/DataCaster/Cast/CSVCast.php b/system/DataCaster/Cast/CSVCast.php index 42dd3709a1db..d77c64c87b57 100644 --- a/system/DataCaster/Cast/CSVCast.php +++ b/system/DataCaster/Cast/CSVCast.php @@ -24,7 +24,7 @@ class CSVCast extends BaseCast public static function get( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): array { if (! is_string($value)) { self::invalidTypeValueError($value); @@ -36,7 +36,7 @@ public static function get( public static function set( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): string { if (! is_array($value)) { self::invalidTypeValueError($value); diff --git a/system/DataCaster/Cast/CastInterface.php b/system/DataCaster/Cast/CastInterface.php index ff93dc2860bc..f90f2b227e1d 100644 --- a/system/DataCaster/Cast/CastInterface.php +++ b/system/DataCaster/Cast/CastInterface.php @@ -27,7 +27,7 @@ interface CastInterface public static function get( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): mixed; /** @@ -42,6 +42,6 @@ public static function get( public static function set( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): mixed; } diff --git a/system/DataCaster/Cast/DatetimeCast.php b/system/DataCaster/Cast/DatetimeCast.php index 83e66d02217c..2953debfbf2e 100644 --- a/system/DataCaster/Cast/DatetimeCast.php +++ b/system/DataCaster/Cast/DatetimeCast.php @@ -28,7 +28,7 @@ class DatetimeCast extends BaseCast public static function get( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): Time { if (! is_string($value)) { self::invalidTypeValueError($value); @@ -56,7 +56,7 @@ public static function get( public static function set( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): string { if (! $value instanceof Time) { self::invalidTypeValueError($value); diff --git a/system/DataCaster/Cast/FloatCast.php b/system/DataCaster/Cast/FloatCast.php index 7ced2e2653a7..d2173826265a 100644 --- a/system/DataCaster/Cast/FloatCast.php +++ b/system/DataCaster/Cast/FloatCast.php @@ -24,7 +24,7 @@ class FloatCast extends BaseCast public static function get( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): float { if (! is_float($value) && ! is_string($value)) { self::invalidTypeValueError($value); diff --git a/system/DataCaster/Cast/IntBoolCast.php b/system/DataCaster/Cast/IntBoolCast.php index 56977c842f0e..5aa1f2b2eb93 100644 --- a/system/DataCaster/Cast/IntBoolCast.php +++ b/system/DataCaster/Cast/IntBoolCast.php @@ -24,7 +24,7 @@ final class IntBoolCast extends BaseCast public static function get( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): bool { if (! is_int($value) && ! is_string($value)) { self::invalidTypeValueError($value); @@ -36,7 +36,7 @@ public static function get( public static function set( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): int { if (! is_bool($value)) { self::invalidTypeValueError($value); diff --git a/system/DataCaster/Cast/IntegerCast.php b/system/DataCaster/Cast/IntegerCast.php index e16683b1fb8f..f65baf83150f 100644 --- a/system/DataCaster/Cast/IntegerCast.php +++ b/system/DataCaster/Cast/IntegerCast.php @@ -24,7 +24,7 @@ class IntegerCast extends BaseCast public static function get( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): int { if (! is_string($value) && ! is_int($value)) { self::invalidTypeValueError($value); diff --git a/system/DataCaster/Cast/JsonCast.php b/system/DataCaster/Cast/JsonCast.php index 316070aaedee..5ca10b385ba6 100644 --- a/system/DataCaster/Cast/JsonCast.php +++ b/system/DataCaster/Cast/JsonCast.php @@ -28,7 +28,7 @@ class JsonCast extends BaseCast public static function get( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): array|stdClass { if (! is_string($value)) { self::invalidTypeValueError($value); @@ -50,7 +50,7 @@ public static function get( public static function set( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): string { try { $output = json_encode($value, JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR); diff --git a/system/DataCaster/Cast/TimestampCast.php b/system/DataCaster/Cast/TimestampCast.php index 52a4d88f9e46..e33938d3e2ba 100644 --- a/system/DataCaster/Cast/TimestampCast.php +++ b/system/DataCaster/Cast/TimestampCast.php @@ -26,7 +26,7 @@ class TimestampCast extends BaseCast public static function get( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): Time { if (! is_int($value) && ! is_string($value)) { self::invalidTypeValueError($value); @@ -38,7 +38,7 @@ public static function get( public static function set( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): int { if (! $value instanceof Time) { self::invalidTypeValueError($value); diff --git a/system/DataCaster/Cast/URICast.php b/system/DataCaster/Cast/URICast.php index 63f4d2271a78..f9e2f561a2b2 100644 --- a/system/DataCaster/Cast/URICast.php +++ b/system/DataCaster/Cast/URICast.php @@ -26,7 +26,7 @@ class URICast extends BaseCast public static function get( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): URI { if (! is_string($value)) { self::invalidTypeValueError($value); @@ -38,7 +38,7 @@ public static function get( public static function set( mixed $value, array $params = [], - ?object $helper = null + ?object $helper = null, ): string { if (! $value instanceof URI) { self::invalidTypeValueError($value); diff --git a/system/DataCaster/DataCaster.php b/system/DataCaster/DataCaster.php index 5a6786a03331..47eac2ff7bde 100644 --- a/system/DataCaster/DataCaster.php +++ b/system/DataCaster/DataCaster.php @@ -68,7 +68,7 @@ public function __construct( ?array $castHandlers = null, ?array $types = null, private readonly ?object $helper = null, - private readonly bool $strict = true + private readonly bool $strict = true, ) { $this->castHandlers = array_merge($this->castHandlers, $castHandlers); @@ -83,7 +83,7 @@ public function __construct( && ! is_subclass_of($handler, EntityCastInterface::class) ) { throw new InvalidArgumentException( - 'Invalid class type. It must implement CastInterface. class: ' . $handler + 'Invalid class type. It must implement CastInterface. class: ' . $handler, ); } } @@ -169,7 +169,7 @@ public function castAs(mixed $value, string $field, string $method = 'get'): mix if (! isset($handlers[$type])) { throw new InvalidArgumentException( - 'No such handler for "' . $field . '". Invalid type: ' . $type + 'No such handler for "' . $field . '". Invalid type: ' . $type, ); } diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 36a5f23f7af7..010ac17b195f 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -807,7 +807,7 @@ protected function whereHaving(string $qbKey, $key, $value = null, string $type '/\s*(!?=|<>|IS(?:\s+NOT)?)\s*$/i', $k, $match, - PREG_OFFSET_CAPTURE + PREG_OFFSET_CAPTURE, ) ) { $k = substr($k, 0, $match[0][1]); @@ -2022,8 +2022,8 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri ' = ' . $value : ' = VALUES(' . $value . ')'), array_keys($updateFields), - $updateFields - ) + $updateFields, + ), ); $this->QBOptions['sql'] = $sql; @@ -2291,10 +2291,10 @@ public function getCompiledInsert(bool $reset = true) $this->removeAlias($this->QBFrom[0]), true, null, - false + false, ), array_keys($this->QBSet), - array_values($this->QBSet) + array_values($this->QBSet), ); if ($reset) { @@ -2328,10 +2328,10 @@ public function insert($set = null, ?bool $escape = null) $this->removeAlias($this->QBFrom[0]), true, $escape, - false + false, ), array_keys($this->QBSet), - array_values($this->QBSet) + array_values($this->QBSet), ); if (! $this->testMode) { @@ -2653,8 +2653,8 @@ protected function _updateBatch(string $table, array $keys, array $values): stri ' = ' . $value : ' = ' . $alias . '.' . $value), array_keys($updateFields), - $updateFields - ) + $updateFields, + ), ) . "\n"; $sql .= "FROM (\n{:_table_:}"; @@ -2678,8 +2678,8 @@ protected function _updateBatch(string $table, array $keys, array $values): stri ) ), array_keys($constraints), - $constraints - ) + $constraints, + ), ); $this->QBOptions['sql'] = $sql; @@ -2694,10 +2694,10 @@ protected function _updateBatch(string $table, array $keys, array $values): stri static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($key, $index): string => $index . ' ' . $key, $keys, - $value + $value, )), - $values - ) + $values, + ), ) . "\n"; } @@ -2924,8 +2924,8 @@ protected function _deleteBatch(string $table, array $keys, array $values): stri ) ), array_keys($constraints), - $constraints - ) + $constraints, + ), ); // convert binds in where @@ -2949,10 +2949,10 @@ protected function _deleteBatch(string $table, array $keys, array $values): stri static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($key, $index): string => $index . ' ' . $key, $keys, - $value + $value, )), - $values - ) + $values, + ), ) . "\n"; } @@ -3160,7 +3160,7 @@ protected function compileWhereHaving(string $qbKey): string '/((?:^|\s+)AND\s+|(?:^|\s+)OR\s+)/i', $qbkey['condition'], -1, - PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY, ); foreach ($conditions as &$condition) { @@ -3170,7 +3170,7 @@ protected function compileWhereHaving(string $qbKey): string || preg_match( '/^(\(?)(.*)(' . preg_quote($op, '/') . ')\s*(.*(?|!|=|\sIS NULL|\sIS NOT NULL|\sEXISTS|\sBETWEEN|\sLIKE|\sIN\s*\(|\s)/i', - trim($str) + trim($str), ) === 1; } @@ -3470,7 +3470,7 @@ protected function getOperator(string $str, bool $list = false) return preg_match_all( '/' . implode('|', $this->pregOperators) . '/i', $str, - $match + $match, ) >= 1 ? ($list ? $match[0] : $match[0][0]) : false; } @@ -3501,7 +3501,7 @@ private function getOperatorFromWhereKey(string $whereKey) return preg_match_all( '/' . implode('|', $pregOperators) . '/i', $whereKey, - $match + $match, ) >= 1 ? $match[0] : false; } diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index e38c682adb09..b7107d19a34d 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -424,7 +424,7 @@ public function initialize() $connectionErrors[] = sprintf( 'Main connection [%s]: %s', $this->DBDriver, - $e->getMessage() + $e->getMessage(), ); log_message('error', 'Error connecting to the database: ' . $e); } @@ -450,7 +450,7 @@ public function initialize() 'Failover #%d [%s]: %s', ++$index, $this->DBDriver, - $e->getMessage() + $e->getMessage(), ); log_message('error', 'Error connecting to the database: ' . $e); } @@ -467,7 +467,7 @@ public function initialize() throw new DatabaseException(sprintf( 'Unable to connect to the database.%s%s', PHP_EOL, - implode(PHP_EOL, $connectionErrors) + implode(PHP_EOL, $connectionErrors), )); } } @@ -688,7 +688,7 @@ public function query(string $sql, $binds = null, bool $setEscapeFlags = true, s throw new DatabaseException( $exception->getMessage(), $exception->getCode(), - $exception + $exception, ); } @@ -1220,7 +1220,7 @@ public function escapeIdentifier(string $item): string . str_replace( $this->escapeChar, $this->escapeChar . $this->escapeChar, - $item + $item, ) . $this->escapeChar; } @@ -1277,7 +1277,7 @@ public function escapeIdentifiers($item) return preg_replace( '/' . $this->pregEscapeChar[0] . '?([^' . $this->pregEscapeChar[1] . '\.]+)' . $this->pregEscapeChar[1] . '?\./i', $this->pregEscapeChar[2] . '$1' . $this->pregEscapeChar[3] . '.', - $item + $item, ); } } @@ -1286,7 +1286,7 @@ public function escapeIdentifiers($item) return preg_replace( '/' . $this->pregEscapeChar[0] . '?([^' . $this->pregEscapeChar[1] . '\.]+)' . $this->pregEscapeChar[1] . '?(\.)?/i', $this->pregEscapeChar[2] . '$1' . $this->pregEscapeChar[3] . '$2', - $item + $item, ); } @@ -1386,7 +1386,7 @@ public function escapeString($str, bool $like = false) $this->likeEscapeChar . '%', $this->likeEscapeChar . '_', ], - $str + $str, ); } @@ -1522,7 +1522,7 @@ public function tableExists(string $tableName, bool $cached = true): bool $key = array_search( strtolower($tableName), array_map(strtolower(...), $this->dataCache['table_names']), - true + true, ); // table doesn't exist but still in cache - lets reset cache, it can be rebuilt later diff --git a/system/Database/BaseUtils.php b/system/Database/BaseUtils.php index 27b369c5cb7e..26957ffe01f1 100644 --- a/system/Database/BaseUtils.php +++ b/system/Database/BaseUtils.php @@ -217,7 +217,7 @@ public function getCSVFromResult(ResultInterface $query, string $delim = ',', st $line[] = $enclosure . str_replace( $enclosure, $enclosure . $enclosure, - (string) $item + (string) $item, ) . $enclosure; } diff --git a/system/Database/Forge.php b/system/Database/Forge.php index 974c45848d1c..83cf1b88d9f4 100644 --- a/system/Database/Forge.php +++ b/system/Database/Forge.php @@ -234,8 +234,8 @@ public function createDatabase(string $dbName, bool $ifNotExists = false): bool $ifNotExists ? $this->createDatabaseIfStr : $this->createDatabaseStr, $this->db->escapeIdentifier($dbName), $this->db->charset, - $this->db->DBCollat - ) + $this->db->DBCollat, + ), )) { // @codeCoverageIgnoreStart if ($this->db->DBDebug) { @@ -294,7 +294,7 @@ public function dropDatabase(string $dbName): bool } if (! $this->db->query( - sprintf($this->dropDatabaseStr, $this->db->escapeIdentifier($dbName)) + sprintf($this->dropDatabaseStr, $this->db->escapeIdentifier($dbName)), )) { if ($this->db->DBDebug) { throw new DatabaseException('Unable to drop the specified database.'); @@ -307,7 +307,7 @@ public function dropDatabase(string $dbName): bool $key = array_search( strtolower($dbName), array_map(strtolower(...), $this->db->dataCache['db_names']), - true + true, ); if ($key !== false) { unset($this->db->dataCache['db_names'][$key]); @@ -425,7 +425,7 @@ public function addForeignKey( $tableField = '', string $onUpdate = '', string $onDelete = '', - string $fkName = '' + string $fkName = '', ): Forge { $fieldName = (array) $fieldName; $tableField = (array) $tableField; @@ -525,7 +525,7 @@ public function dropForeignKey(string $table, string $foreignName) $sql = sprintf( (string) $this->dropConstraintStr, $this->db->escapeIdentifiers($this->db->DBPrefix . $table), - $this->db->escapeIdentifiers($foreignName) + $this->db->escapeIdentifiers($foreignName), ); if ($sql === '') { @@ -618,7 +618,7 @@ protected function _createTable(string $table, bool $ifNotExists, array $attribu 'CREATE TABLE', $this->db->escapeIdentifiers($table), $processedFields, - $this->_createTableAttributes($attributes) + $this->_createTableAttributes($attributes), ); } @@ -668,7 +668,7 @@ public function dropTable(string $tableName, bool $ifExists = false, bool $casca $key = array_search( strtolower($this->db->DBPrefix . $tableName), array_map(strtolower(...), $this->db->dataCache['table_names']), - true + true, ); if ($key !== false) { @@ -723,14 +723,14 @@ public function renameTable(string $tableName, string $newTableName) $result = $this->db->query(sprintf( $this->renameTableStr, $this->db->escapeIdentifiers($this->db->DBPrefix . $tableName), - $this->db->escapeIdentifiers($this->db->DBPrefix . $newTableName) + $this->db->escapeIdentifiers($this->db->DBPrefix . $newTableName), )); if ($result && ! empty($this->db->dataCache['table_names'])) { $key = array_search( strtolower($this->db->DBPrefix . $tableName), array_map(strtolower(...), $this->db->dataCache['table_names']), - true + true, ); if ($key !== false) { @@ -1112,7 +1112,7 @@ public function processIndexes(string $table): bool $this->fields = array_combine( array_map(static fn ($columnName) => $columnName->name, $fieldData), - array_fill(0, count($fieldData), []) + array_fill(0, count($fieldData), []), ); } diff --git a/system/Database/MigrationRunner.php b/system/Database/MigrationRunner.php index 13919c785372..0411e1593a68 100644 --- a/system/Database/MigrationRunner.php +++ b/system/Database/MigrationRunner.php @@ -605,7 +605,7 @@ protected function addHistory($migration, int $batch) CLI::color(lang('Migrations.added'), 'yellow'), $migration->namespace, $migration->version, - $migration->class + $migration->class, ); } } @@ -625,7 +625,7 @@ protected function removeHistory($history) CLI::color(lang('Migrations.removed'), 'yellow'), $history->namespace, $history->version, - $history->class + $history->class, ); } } diff --git a/system/Database/MySQLi/Builder.php b/system/Database/MySQLi/Builder.php index 8c1de9d9f987..b8d0fa545d4f 100644 --- a/system/Database/MySQLi/Builder.php +++ b/system/Database/MySQLi/Builder.php @@ -106,8 +106,8 @@ protected function _updateBatch(string $table, array $keys, array $values): stri ) ), array_keys($constraints), - $constraints - ) + $constraints, + ), ) . "\n"; $sql .= "SET\n"; @@ -119,8 +119,8 @@ protected function _updateBatch(string $table, array $keys, array $values): stri ' = ' . $value : ' = ' . $alias . '.' . $value), array_keys($updateFields), - $updateFields - ) + $updateFields, + ), ); $this->QBOptions['sql'] = $sql; @@ -135,10 +135,10 @@ protected function _updateBatch(string $table, array $keys, array $values): stri static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($key, $index): string => $index . ' ' . $key, $keys, - $value + $value, )), - $values - ) + $values, + ), ) . "\n"; } diff --git a/system/Database/MySQLi/Connection.php b/system/Database/MySQLi/Connection.php index f98f51fb3e19..fa542e5708bb 100644 --- a/system/Database/MySQLi/Connection.php +++ b/system/Database/MySQLi/Connection.php @@ -116,7 +116,7 @@ public function connect(bool $persistent = false) if ($this->strictOn) { $this->mysqli->options( MYSQLI_INIT_COMMAND, - "SET SESSION sql_mode = CONCAT(@@sql_mode, ',', 'STRICT_ALL_TABLES')" + "SET SESSION sql_mode = CONCAT(@@sql_mode, ',', 'STRICT_ALL_TABLES')", ); } else { $this->mysqli->options( @@ -128,7 +128,7 @@ public function connect(bool $persistent = false) 'STRICT_ALL_TABLES', ''), 'STRICT_TRANS_TABLES,', ''), ',STRICT_TRANS_TABLES', ''), - 'STRICT_TRANS_TABLES', '')" + 'STRICT_TRANS_TABLES', '')", ); } } @@ -175,7 +175,7 @@ public function connect(bool $persistent = false) $ssl['cert'] ?? null, $ssl['ca'] ?? null, $ssl['capath'] ?? null, - $ssl['cipher'] ?? null + $ssl['cipher'] ?? null, ); } @@ -190,7 +190,7 @@ public function connect(bool $persistent = false) $this->database, $port, $socket, - $clientFlags + $clientFlags, )) { // Prior to version 5.7.3, MySQL silently downgrades to an unencrypted connection if SSL setup fails if (($clientFlags & MYSQLI_CLIENT_SSL) !== 0 && version_compare($this->mysqli->client_info, 'mysqlnd 5.7.3', '<=') @@ -381,7 +381,7 @@ public function escapeLikeStringDirect($str) return str_replace( [$this->likeEscapeChar, '%', '_'], ['\\' . $this->likeEscapeChar, '\\%', '\\_'], - $str + $str, ); } diff --git a/system/Database/MySQLi/Forge.php b/system/Database/MySQLi/Forge.php index c47ff4ded393..fe207f5267a5 100644 --- a/system/Database/MySQLi/Forge.php +++ b/system/Database/MySQLi/Forge.php @@ -258,7 +258,7 @@ public function dropPrimaryKey(string $table, string $keyName = ''): bool { $sql = sprintf( 'ALTER TABLE %s DROP PRIMARY KEY', - $this->db->escapeIdentifiers($this->db->DBPrefix . $table) + $this->db->escapeIdentifiers($this->db->DBPrefix . $table), ); return $this->db->query($sql); diff --git a/system/Database/OCI8/Builder.php b/system/Database/OCI8/Builder.php index 5a65ffe9b75d..5b586761e2c0 100644 --- a/system/Database/OCI8/Builder.php +++ b/system/Database/OCI8/Builder.php @@ -92,10 +92,10 @@ protected function _insertBatch(string $table, array $keys, array $values): stri static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($key, $index): string => $index . ' ' . $key, $keys, - $value + $value, )), - $values - ) + $values, + ), ) . " FROM DUAL\n"; } @@ -287,8 +287,8 @@ protected function _updateBatch(string $table, array $keys, array $values): stri ) ), array_keys($constraints), - $constraints - ) + $constraints, + ), ) . ")\n"; $sql .= "WHEN MATCHED THEN UPDATE\n"; @@ -302,8 +302,8 @@ protected function _updateBatch(string $table, array $keys, array $values): stri ' = ' . $value : ' = ' . $alias . '.' . $value), array_keys($updateFields), - $updateFields - ) + $updateFields, + ), ); $this->QBOptions['sql'] = $sql; @@ -318,10 +318,10 @@ protected function _updateBatch(string $table, array $keys, array $values): stri static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($key, $index): string => $index . ' ' . $key, $keys, - $value + $value, )) . ' FROM DUAL', - $values - ) + $values, + ), ) . "\n"; } @@ -392,8 +392,8 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri ) ), array_keys($constraints), - $constraints - ) + $constraints, + ), ) . ")\n"; $sql .= "WHEN MATCHED THEN UPDATE SET\n"; @@ -405,8 +405,8 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri " = {$value}" : " = {$alias}.{$value}"), array_keys($updateFields), - $updateFields - ) + $updateFields, + ), ); $sql .= "\nWHEN NOT MATCHED THEN INSERT (" . implode(', ', $keys) . ")\nVALUES "; @@ -427,10 +427,10 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($key, $index): string => $index . ' ' . $key, $keys, - $value + $value, )), - $values - ) + $values, + ), ) . " FROM DUAL\n"; } @@ -477,8 +477,8 @@ protected function _deleteBatch(string $table, array $keys, array $values): stri ) ), array_keys($constraints), - $constraints - ) + $constraints, + ), ); // convert binds in where @@ -491,7 +491,7 @@ protected function _deleteBatch(string $table, array $keys, array $values): stri $sql .= ' ' . str_replace( 'WHERE ', 'AND ', - $this->compileWhereHaving('QBWhere') + $this->compileWhereHaving('QBWhere'), ) . ')'; $this->QBOptions['sql'] = $sql; @@ -506,10 +506,10 @@ protected function _deleteBatch(string $table, array $keys, array $values): stri static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($key, $index): string => $index . ' ' . $key, $keys, - $value + $value, )), - $values - ) + $values, + ), ) . " FROM DUAL\n"; } diff --git a/system/Database/OCI8/Connection.php b/system/Database/OCI8/Connection.php index c59d588ccec1..0ad7b66815e7 100644 --- a/system/Database/OCI8/Connection.php +++ b/system/Database/OCI8/Connection.php @@ -523,7 +523,7 @@ public function storedProcedure(string $procedureName, array $params) $sql = sprintf( 'BEGIN %s (' . substr(str_repeat(',%s', count($params)), 1) . '); END;', $procedureName, - ...array_map(static fn ($row) => $row['name'], $params) + ...array_map(static fn ($row) => $row['name'], $params), ); $this->resetStmtId = false; @@ -554,7 +554,7 @@ protected function bindParams($params) $param['name'], $param['value'], $param['length'] ?? -1, - $param['type'] ?? SQLT_CHR + $param['type'] ?? SQLT_CHR, ); } } diff --git a/system/Database/OCI8/Forge.php b/system/Database/OCI8/Forge.php index 7d81cff8b506..4b09372d778e 100644 --- a/system/Database/OCI8/Forge.php +++ b/system/Database/OCI8/Forge.php @@ -112,7 +112,7 @@ protected function _alterTable(string $alterType, string $table, $processedField $fields = array_map( fn ($field) => $this->db->escapeIdentifiers(trim($field)), - is_string($columnNamesToDrop) ? explode(',', $columnNamesToDrop) : $columnNamesToDrop + is_string($columnNamesToDrop) ? explode(',', $columnNamesToDrop) : $columnNamesToDrop, ); return $sql . ' DROP (' . implode(',', $fields) . ') CASCADE CONSTRAINT INVALIDATE'; diff --git a/system/Database/Postgre/Builder.php b/system/Database/Postgre/Builder.php index 21fa222c7544..bf6e9416dc2c 100644 --- a/system/Database/Postgre/Builder.php +++ b/system/Database/Postgre/Builder.php @@ -357,8 +357,8 @@ protected function _updateBatch(string $table, array $keys, array $values): stri ' = ' . $value : ' = ' . $that->cast($alias . '.' . $value, $that->getFieldType($table, $key))), array_keys($updateFields), - $updateFields - ) + $updateFields, + ), ) . "\n"; $sql .= "FROM (\n{:_table_:}"; @@ -381,8 +381,8 @@ static function ($key, $value) use ($table, $alias, $that): string|RawSql { . $that->cast($alias . '.' . $value, $that->getFieldType($table, $value)); }, array_keys($constraints), - $constraints - ) + $constraints, + ), ); $this->QBOptions['sql'] = $sql; @@ -397,10 +397,10 @@ static function ($key, $value) use ($table, $alias, $that): string|RawSql { static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($key, $index): string => $index . ' ' . $key, $keys, - $value + $value, )), - $values - ) + $values, + ), ) . "\n"; } @@ -528,8 +528,8 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri " = {$value}" : " = {$alias}.{$value}"), array_keys($updateFields), - $updateFields - ) + $updateFields, + ), ); $this->QBOptions['sql'] = $sql; @@ -584,15 +584,15 @@ static function ($key, $value) use ($table, $alias, $that): RawSql|string { return $table . '.' . $key . ' = ' . $that->cast( $alias . '.' . $value, - $that->getFieldType($table, $key) + $that->getFieldType($table, $key), ); } return $table . '.' . $value . ' = ' . $alias . '.' . $value; }, array_keys($constraints), - $constraints - ) + $constraints, + ), ); // convert binds in where @@ -605,7 +605,7 @@ static function ($key, $value) use ($table, $alias, $that): RawSql|string { $sql .= ' ' . str_replace( 'WHERE ', 'AND ', - $this->compileWhereHaving('QBWhere') + $this->compileWhereHaving('QBWhere'), ); $this->QBOptions['sql'] = $sql; @@ -620,10 +620,10 @@ static function ($key, $value) use ($table, $alias, $that): RawSql|string { static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($key, $index): string => $index . ' ' . $key, $keys, - $value + $value, )), - $values - ) + $values, + ), ) . "\n"; } diff --git a/system/Database/SQLSRV/Builder.php b/system/Database/SQLSRV/Builder.php index 1aeaf0a4e6ee..ec4d41195626 100644 --- a/system/Database/SQLSRV/Builder.php +++ b/system/Database/SQLSRV/Builder.php @@ -764,8 +764,8 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri ) ), array_keys($constraints), - $constraints - ) + $constraints, + ), ) . ")\n"; $sql .= "WHEN MATCHED THEN UPDATE SET\n"; @@ -777,8 +777,8 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri ' = ' . $value : " = {$alias}.{$value}"), array_keys($updateFields), - $updateFields - ) + $updateFields, + ), ); $sql .= "\nWHEN NOT MATCHED THEN INSERT (" . implode(', ', $keys) . ")\nVALUES "; @@ -792,8 +792,8 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri . 'isnull(IDENT_CURRENT(\'' . $fullTableName . '\')+IDENT_INCR(\'' . $fullTableName . "'),1)) ELSE {$alias}.{$columnName} END" : "{$alias}.{$columnName}", - $keys - ) + $keys, + ), ) . ');' ); diff --git a/system/Database/SQLSRV/Forge.php b/system/Database/SQLSRV/Forge.php index 18d792a6eea8..f187b9981f88 100644 --- a/system/Database/SQLSRV/Forge.php +++ b/system/Database/SQLSRV/Forge.php @@ -134,12 +134,12 @@ public function createDatabase(string $dbName, bool $ifNotExists = false): bool $sql = sprintf( $this->createDatabaseIfStr, $dbName, - $this->db->escapeIdentifier($dbName) + $this->db->escapeIdentifier($dbName), ); } else { $sql = sprintf( $this->createDatabaseStr, - $this->db->escapeIdentifier($dbName) + $this->db->escapeIdentifier($dbName), ); } @@ -381,8 +381,8 @@ protected function _attributeType(array &$attributes) $maxLength = max( array_map( static fn ($value): int => strlen($value), - $attributes['CONSTRAINT'] - ) + $attributes['CONSTRAINT'], + ), ); $attributes['TYPE'] = 'VARCHAR'; diff --git a/system/Database/SQLite3/Builder.php b/system/Database/SQLite3/Builder.php index 744b64448fc6..64091cf8a2fb 100644 --- a/system/Database/SQLite3/Builder.php +++ b/system/Database/SQLite3/Builder.php @@ -196,8 +196,8 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri " = {$value}" : " = {$alias}.{$value}"), array_keys($updateFields), - $updateFields - ) + $updateFields, + ), ); $this->QBOptions['sql'] = $sql; @@ -268,10 +268,10 @@ protected function _deleteBatch(string $table, array $keys, array $values): stri static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($key, $index): string => $index . ' ' . $key, $keys, - $value + $value, )), - $values - ) + $values, + ), ) . "\n"; } diff --git a/system/Database/SQLite3/Table.php b/system/Database/SQLite3/Table.php index 61d4aee7535b..095d96a2d333 100644 --- a/system/Database/SQLite3/Table.php +++ b/system/Database/SQLite3/Table.php @@ -308,7 +308,7 @@ protected function createTable() $this->keys = array_filter( $this->keys, - static fn ($index): bool => count(array_intersect($index['fields'], $fieldNames)) === count($index['fields']) + static fn ($index): bool => count(array_intersect($index['fields'], $fieldNames)) === count($index['fields']), ); // Unique/Index keys @@ -334,7 +334,7 @@ protected function createTable() $this->forge->addForeignKey( $foreignKey->column_name, trim($foreignKey->foreign_table_name, $this->db->DBPrefix), - $foreignKey->foreign_column_name + $foreignKey->foreign_column_name, ); } @@ -358,15 +358,15 @@ protected function copyData() $exFields = implode( ', ', - array_map(fn ($item) => $this->db->protectIdentifiers($item), $exFields) + array_map(fn ($item) => $this->db->protectIdentifiers($item), $exFields), ); $newFields = implode( ', ', - array_map(fn ($item) => $this->db->protectIdentifiers($item), $newFields) + array_map(fn ($item) => $this->db->protectIdentifiers($item), $newFields), ); $this->db->query( - "INSERT INTO {$this->prefixedTableName}({$newFields}) SELECT {$exFields} FROM {$this->db->DBPrefix}temp_{$this->tableName}" + "INSERT INTO {$this->prefixedTableName}({$newFields}) SELECT {$exFields} FROM {$this->db->DBPrefix}temp_{$this->tableName}", ); } diff --git a/system/Debug/BaseExceptionHandler.php b/system/Debug/BaseExceptionHandler.php index 4305265d2d2c..3966b2ee1bae 100644 --- a/system/Debug/BaseExceptionHandler.php +++ b/system/Debug/BaseExceptionHandler.php @@ -61,7 +61,7 @@ abstract public function handle( RequestInterface $request, ResponseInterface $response, int $statusCode, - int $exitCode + int $exitCode, ); /** @@ -221,7 +221,7 @@ protected static function highlightFile(string $file, int $lineNumber, int $line "{$format} %s\n%s", $n + $start + 1, strip_tags($row), - implode('', $tags[0]) + implode('', $tags[0]), ); } else { $out .= sprintf('' . $format . ' %s', $n + $start + 1, $row) . "\n"; diff --git a/system/Debug/ExceptionHandler.php b/system/Debug/ExceptionHandler.php index d6f97b76a32b..8283e1ff5362 100644 --- a/system/Debug/ExceptionHandler.php +++ b/system/Debug/ExceptionHandler.php @@ -47,7 +47,7 @@ public function handle( RequestInterface $request, ResponseInterface $response, int $statusCode, - int $exitCode + int $exitCode, ): void { // ResponseTrait needs these properties. $this->request = $request; @@ -68,10 +68,10 @@ public function handle( 'HTTP/%s %s %s', $request->getProtocolVersion(), $response->getStatusCode(), - $response->getReasonPhrase() + $response->getReasonPhrase(), ), true, - $statusCode + $statusCode, ); } @@ -129,7 +129,7 @@ public function handle( protected function determineView( Throwable $exception, string $templatePath, - int $statusCode = 500 + int $statusCode = 500, ): string { // Production environments should have a custom exception file. $view = 'production.php'; @@ -138,7 +138,7 @@ protected function determineView( in_array( strtolower(ini_get('display_errors')), ['1', 'true', 'on', 'yes'], - true + true, ) ) { $view = 'error_exception.php'; diff --git a/system/Debug/ExceptionHandlerInterface.php b/system/Debug/ExceptionHandlerInterface.php index d0379e2abd63..05915c638f36 100644 --- a/system/Debug/ExceptionHandlerInterface.php +++ b/system/Debug/ExceptionHandlerInterface.php @@ -27,6 +27,6 @@ public function handle( RequestInterface $request, ResponseInterface $response, int $statusCode, - int $exitCode + int $exitCode, ): void; } diff --git a/system/Debug/Exceptions.php b/system/Debug/Exceptions.php index aa353732c197..3293d75929a3 100644 --- a/system/Debug/Exceptions.php +++ b/system/Debug/Exceptions.php @@ -164,7 +164,7 @@ public function exceptionHandler(Throwable $exception) $this->request, $this->response, $statusCode, - $exitCode + $exitCode, ); return; @@ -270,7 +270,7 @@ protected function determineView(Throwable $exception, string $templatePath): st in_array( strtolower(ini_get('display_errors')), ['1', 'true', 'on', 'yes'], - true + true, ) ) { $view = 'error_exception.php'; @@ -462,7 +462,7 @@ private function handleDeprecationError(string $message, ?string $file = null, ? 'errFile' => clean_path($file ?? ''), 'errLine' => $line ?? 0, 'trace' => self::renderBacktrace($trace), - ] + ], ); return true; @@ -567,7 +567,7 @@ public static function highlightFile(string $file, int $lineNumber, int $lines = "{$format} %s\n%s", $n + $start + 1, strip_tags($row), - implode('', $tags[0]) + implode('', $tags[0]), ); } else { $out .= sprintf('' . $format . ' %s', $n + $start + 1, $row) . "\n"; @@ -611,7 +611,7 @@ private static function renderBacktrace(array $backtrace): string $frame['class'], $frame['type'], $frame['function'], - $args + $args, ); } diff --git a/system/Debug/Toolbar.php b/system/Debug/Toolbar.php index b939e208fd21..9a884b60f5b3 100644 --- a/system/Debug/Toolbar.php +++ b/system/Debug/Toolbar.php @@ -58,7 +58,7 @@ public function __construct(ToolbarConfig $config) log_message( 'critical', 'Toolbar collector does not exist (' . $collector . ').' - . ' Please check $collectors in the app/Config/Toolbar.php file.' + . ' Please check $collectors in the app/Config/Toolbar.php file.', ); continue; @@ -391,7 +391,7 @@ public function prepare(?RequestInterface $request = null, ?ResponseInterface $r $stats['startTime'], $stats['totalTime'], $request, - $response + $response, ); helper('filesystem'); @@ -439,8 +439,8 @@ public function prepare(?RequestInterface $request = null, ?ResponseInterface $r '//', '' . $script, $response->getBody(), - 1 - ) + 1, + ), ); return; @@ -516,7 +516,7 @@ protected function format(string $data, string $format = 'html'): string $history = new History(); $history->setFiles( $debugbarTime[0], - $this->config->maxHistory + $this->config->maxHistory, ); $data['collectors'][] = $history->getAsArray(); diff --git a/system/Debug/Toolbar/Collectors/Database.php b/system/Debug/Toolbar/Collectors/Database.php index 32f7f07091b3..df876422aaf1 100644 --- a/system/Debug/Toolbar/Collectors/Database.php +++ b/system/Debug/Toolbar/Collectors/Database.php @@ -228,7 +228,7 @@ public function getTitleDetails(): string $uniqueCount, $uniqueCount > 1 ? 'of them' : '', $connectionCount, - $connectionCount > 1 ? 's' : '' + $connectionCount > 1 ? 's' : '', ); } diff --git a/system/Debug/Toolbar/Collectors/Routes.php b/system/Debug/Toolbar/Collectors/Routes.php index 561399fbf37f..47c808e7ac40 100644 --- a/system/Debug/Toolbar/Collectors/Routes.php +++ b/system/Debug/Toolbar/Collectors/Routes.php @@ -109,7 +109,7 @@ public function display(): array ' | default: ' . var_export( $param->isDefaultValueAvailable() ? $param->getDefaultValue() : null, - true + true, ), ]; } diff --git a/system/Email/Email.php b/system/Email/Email.php index c52c36230866..17b24c9de575 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -1659,7 +1659,7 @@ protected function unwrapSpecials() $this->finalBody = preg_replace_callback( '/\{unwrap\}(.*?)\{\/unwrap\}/si', $this->removeNLCallback(...), - $this->finalBody + $this->finalBody, ); } @@ -1900,7 +1900,7 @@ protected function SMTPConnect() $this->SMTPPort, $errno, $errstr, - $this->SMTPTimeout + $this->SMTPTimeout, ); if (! is_resource($this->SMTPConnect)) { @@ -1921,7 +1921,7 @@ protected function SMTPConnect() STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT - | STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT + | STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT, ); if ($crypto !== true) { diff --git a/system/Entity/Entity.php b/system/Entity/Entity.php index ff2fba1f7062..0e54c722e354 100644 --- a/system/Entity/Entity.php +++ b/system/Entity/Entity.php @@ -138,7 +138,7 @@ public function __construct(?array $data = null) array_merge($this->defaultCastHandlers, $this->castHandlers), null, null, - false + false, ); $this->syncOriginal(); @@ -185,7 +185,7 @@ public function toArray(bool $onlyChanged = false, bool $cast = true, bool $recu if (is_array($this->datamap)) { $keys = array_unique( - [...array_diff($keys, $this->datamap), ...array_keys($this->datamap)] + [...array_diff($keys, $this->datamap), ...array_keys($this->datamap)], ); } diff --git a/system/Events/Events.php b/system/Events/Events.php index 25149729a0d0..97f4e81d0369 100644 --- a/system/Events/Events.php +++ b/system/Events/Events.php @@ -212,7 +212,7 @@ public static function removeListener($eventName, callable $listener): bool if ($check === $listener) { unset( static::$listeners[$eventName][1][$index], - static::$listeners[$eventName][2][$index] + static::$listeners[$eventName][2][$index], ); return true; diff --git a/system/Exceptions/FrameworkException.php b/system/Exceptions/FrameworkException.php index 1fe47be49a6b..7ea9e6d7d51f 100644 --- a/system/Exceptions/FrameworkException.php +++ b/system/Exceptions/FrameworkException.php @@ -68,7 +68,7 @@ public static function forMissingExtension(string $extension) // @codeCoverageIgnoreStart $message = sprintf( 'The framework needs the following extension(s) installed and loaded: %s.', - $extension + $extension, ); // @codeCoverageIgnoreEnd } else { diff --git a/system/Files/FileCollection.php b/system/Files/FileCollection.php index 179bbc1d4997..369cea9ddd02 100644 --- a/system/Files/FileCollection.php +++ b/system/Files/FileCollection.php @@ -103,7 +103,7 @@ final protected static function matchFiles(array $files, string $pattern): array $pattern = str_replace( ['#', '.', '*', '?'], ['\#', '\.', '.*', '.'], - $pattern + $pattern, ); $pattern = "#\\A{$pattern}\\z#"; } diff --git a/system/Filters/Filters.php b/system/Filters/Filters.php index f6dbdf087821..28f712f66114 100644 --- a/system/Filters/Filters.php +++ b/system/Filters/Filters.php @@ -202,7 +202,7 @@ private function runBefore(array $filterClasses) $result = $class->before( $this->request, - $this->argumentsClass[$className] ?? null + $this->argumentsClass[$className] ?? null, ); if ($result instanceof RequestInterface) { @@ -241,7 +241,7 @@ private function runAfter(array $filterClasses): ResponseInterface $result = $class->after( $this->request, $this->response, - $this->argumentsClass[$className] ?? null + $this->argumentsClass[$className] ?? null, ); if ($result instanceof ResponseInterface) { @@ -648,7 +648,7 @@ protected function processMethods() @trigger_error( 'Setting lowercase HTTP method key "' . strtolower($method) . '" is deprecated.' . ' Use uppercase HTTP method like "' . strtoupper($method) . '".', - E_USER_DEPRECATED + E_USER_DEPRECATED, ); $found = true; @@ -744,7 +744,7 @@ private function registerArguments(string $name, array $arguments, bool $check = if ($check && array_key_exists($name, $this->arguments)) { throw new ConfigException( '"' . $name . '" already has arguments: ' - . (($this->arguments[$name] === null) ? 'null' : implode(',', $this->arguments[$name])) + . (($this->arguments[$name] === null) ? 'null' : implode(',', $this->arguments[$name])), ); } diff --git a/system/Filters/PerformanceMetrics.php b/system/Filters/PerformanceMetrics.php index f2371c7a8d6d..51b3fa9f57d5 100644 --- a/system/Filters/PerformanceMetrics.php +++ b/system/Filters/PerformanceMetrics.php @@ -53,7 +53,7 @@ public function after(RequestInterface $request, ResponseInterface $response, $a (string) $benchmark->getElapsedTime('total_execution'), number_format(memory_get_peak_usage() / 1024 / 1024, 3), ], - $body + $body, ); $response->setBody($output); diff --git a/system/HTTP/CURLRequest.php b/system/HTTP/CURLRequest.php index 90157e4e05d4..9ce664f80865 100644 --- a/system/HTTP/CURLRequest.php +++ b/system/HTTP/CURLRequest.php @@ -342,7 +342,7 @@ protected function prepareURL(string $url): string $uri->getAuthority(), $uri->getPath(), $uri->getQuery(), - $uri->getFragment() + $uri->getFragment(), ); } diff --git a/system/HTTP/Cors.php b/system/HTTP/Cors.php index f7619c9f83a4..2f151a738344 100644 --- a/system/HTTP/Cors.php +++ b/system/HTTP/Cors.php @@ -107,7 +107,7 @@ private function checkWildcard(string $name, int $count): void if (in_array('*', $this->config[$name], true) && $count > 1) { throw new ConfigException( "If wildcard is specified, you must set `'{$name}' => ['*']`." - . ' But using wildcard is not recommended.' + . ' But using wildcard is not recommended.', ); } } @@ -121,7 +121,7 @@ private function checkWildcardAndCredentials(string $name, string $header): void throw new ConfigException( 'When responding to a credentialed request, ' . 'the server must not specify the "*" wildcard for the ' - . $header . ' response-header value.' + . $header . ' response-header value.', ); } } @@ -176,7 +176,7 @@ private function setAllowHeaders(ResponseInterface $response): void $response->setHeader( 'Access-Control-Allow-Headers', - implode(', ', $this->config['allowedHeaders']) + implode(', ', $this->config['allowedHeaders']), ); } @@ -187,7 +187,7 @@ private function setAllowMethods(ResponseInterface $response): void $response->setHeader( 'Access-Control-Allow-Methods', - implode(', ', $this->config['allowedMethods']) + implode(', ', $this->config['allowedMethods']), ); } @@ -223,7 +223,7 @@ private function setExposeHeaders(ResponseInterface $response): void if ($this->config['exposedHeaders'] !== []) { $response->setHeader( 'Access-Control-Expose-Headers', - implode(', ', $this->config['exposedHeaders']) + implode(', ', $this->config['exposedHeaders']), ); } } diff --git a/system/HTTP/Exceptions/RedirectException.php b/system/HTTP/Exceptions/RedirectException.php index 3047bf9603eb..5ebec8e1f7a4 100644 --- a/system/HTTP/Exceptions/RedirectException.php +++ b/system/HTTP/Exceptions/RedirectException.php @@ -45,7 +45,7 @@ public function __construct($message = '', int $code = 0, ?Throwable $previous = throw new InvalidArgumentException( 'RedirectException::__construct() first argument must be a string or ResponseInterface', 0, - $this + $this, ); } @@ -55,7 +55,7 @@ public function __construct($message = '', int $code = 0, ?Throwable $previous = if ($this->response->getHeaderLine('Location') === '' && $this->response->getHeaderLine('Refresh') === '') { throw new LogicException( - 'The Response object passed to RedirectException does not contain a redirect address.' + 'The Response object passed to RedirectException does not contain a redirect address.', ); } @@ -76,7 +76,7 @@ public function getResponse(): ResponseInterface service('logger')->info( 'REDIRECTED ROUTE at ' - . ($this->response->getHeaderLine('Location') ?: substr($this->response->getHeaderLine('Refresh'), 6)) + . ($this->response->getHeaderLine('Location') ?: substr($this->response->getHeaderLine('Refresh'), 6)), ); return $this->response; diff --git a/system/HTTP/Files/FileCollection.php b/system/HTTP/Files/FileCollection.php index add2c3c03f9c..120652e8bd87 100644 --- a/system/HTTP/Files/FileCollection.php +++ b/system/HTTP/Files/FileCollection.php @@ -189,7 +189,7 @@ protected function createFileObject(array $array) $array['type'] ?? null, ($array['size'] ?? null) === null ? null : (int) $array['size'], $array['error'] ?? null, - $array['full_path'] ?? null + $array['full_path'] ?? null, ); } @@ -219,7 +219,7 @@ protected function fixFilesArray(array $data): array $stack = [&$pointer]; $iterator = new RecursiveIteratorIterator( new RecursiveArrayIterator($value), - RecursiveIteratorIterator::SELF_FIRST + RecursiveIteratorIterator::SELF_FIRST, ); foreach ($iterator as $key => $val) { diff --git a/system/HTTP/Message.php b/system/HTTP/Message.php index 71c4429f28ee..6b2a5e8ba2c4 100644 --- a/system/HTTP/Message.php +++ b/system/HTTP/Message.php @@ -119,7 +119,7 @@ public function getHeaderLine(string $name): string if ($this->hasMultipleHeaders($name)) { throw new InvalidArgumentException( 'The header "' . $name . '" already has multiple headers.' - . ' You cannot use getHeaderLine().' + . ' You cannot use getHeaderLine().', ); } diff --git a/system/HTTP/MessageTrait.php b/system/HTTP/MessageTrait.php index 2f6e57a90c57..9ae7737a8e8f 100644 --- a/system/HTTP/MessageTrait.php +++ b/system/HTTP/MessageTrait.php @@ -182,7 +182,7 @@ private function checkMultipleHeaders(string $name): void if ($this->hasMultipleHeaders($name)) { throw new InvalidArgumentException( 'The header "' . $name . '" already has multiple headers.' - . ' You cannot change them. If you really need to change, remove the header first.' + . ' You cannot change them. If you really need to change, remove the header first.', ); } } diff --git a/system/HTTP/Negotiate.php b/system/HTTP/Negotiate.php index 33938c8f0741..ff4d2998766b 100644 --- a/system/HTTP/Negotiate.php +++ b/system/HTTP/Negotiate.php @@ -90,7 +90,7 @@ public function charset(array $supported): string $supported, $this->request->getHeaderLine('accept-charset'), false, - true + true, ); // If no charset is shown as a match, ignore the directive @@ -154,7 +154,7 @@ protected function getBestMatch( ?string $header = null, bool $enforceTypes = false, bool $strictMatch = false, - bool $matchLocales = false + bool $matchLocales = false, ): string { if ($supported === []) { throw HTTPException::forEmptySupportedNegotiations(); @@ -212,7 +212,7 @@ public function parseHeader(string $header): array if (preg_match( '/^(?P.+?)=(?P"|\')?(?P.*?)(?:\k)?$/', $pair, - $param + $param, )) { $parameters[trim($param['name'])] = trim($param['value']); } diff --git a/system/HTTP/OutgoingRequest.php b/system/HTTP/OutgoingRequest.php index e62f07241558..eba5babdf6bb 100644 --- a/system/HTTP/OutgoingRequest.php +++ b/system/HTTP/OutgoingRequest.php @@ -43,7 +43,7 @@ public function __construct( ?URI $uri = null, array $headers = [], $body = null, - string $version = '1.1' + string $version = '1.1', ) { $this->method = $method; $this->uri = $uri; diff --git a/system/HTTP/RequestTrait.php b/system/HTTP/RequestTrait.php index dfa4b663dbaf..39f4269ef1df 100644 --- a/system/HTTP/RequestTrait.php +++ b/system/HTTP/RequestTrait.php @@ -72,7 +72,7 @@ public function getIPAddress(): string if (! empty($proxyIPs) && (! is_array($proxyIPs) || is_int(array_key_first($proxyIPs)))) { throw new ConfigException( - 'You must set an array with Proxy IP address key and HTTP header name value in Config\App::$proxyIPs.' + 'You must set an array with Proxy IP address key and HTTP header name value in Config\App::$proxyIPs.', ); } diff --git a/system/HTTP/ResponseInterface.php b/system/HTTP/ResponseInterface.php index 382a2847c503..58f11a0f9065 100644 --- a/system/HTTP/ResponseInterface.php +++ b/system/HTTP/ResponseInterface.php @@ -341,7 +341,7 @@ public function setCookie( $prefix = '', $secure = false, $httponly = false, - $samesite = null + $samesite = null, ); /** diff --git a/system/HTTP/ResponseTrait.php b/system/HTTP/ResponseTrait.php index eaf60f2b38b4..b23e40a9046b 100644 --- a/system/HTTP/ResponseTrait.php +++ b/system/HTTP/ResponseTrait.php @@ -407,14 +407,14 @@ public function sendHeaders() header( $name . ': ' . $value->getValueLine(), false, - $this->getStatusCode() + $this->getStatusCode(), ); } else { foreach ($value as $header) { header( $name . ': ' . $header->getValueLine(), false, - $this->getStatusCode() + $this->getStatusCode(), ); } } @@ -512,7 +512,7 @@ public function setCookie( $prefix = '', $secure = null, $httponly = null, - $samesite = null + $samesite = null, ) { if ($name instanceof Cookie) { $this->cookieStore = $this->cookieStore->put($name); diff --git a/system/HTTP/SiteURI.php b/system/HTTP/SiteURI.php index 2be70a7773ef..63181b89fead 100644 --- a/system/HTTP/SiteURI.php +++ b/system/HTTP/SiteURI.php @@ -95,7 +95,7 @@ public function __construct( App $configApp, string $relativePath = '', ?string $host = null, - ?string $scheme = null + ?string $scheme = null, ) { $this->indexPage = $configApp->indexPage; @@ -142,7 +142,7 @@ private function parseRelativePath(string $relativePath): array private function determineBaseURL( App $configApp, ?string $host, - ?string $scheme + ?string $scheme, ): URI { $baseURL = $this->normalizeBaseURL($configApp); @@ -199,7 +199,7 @@ private function normalizeBaseURL(App $configApp): string // Validate baseURL if (filter_var($baseURL, FILTER_VALIDATE_URL) === false) { throw new ConfigException( - 'Config\App::$baseURL "' . $baseURL . '" is not a valid URL.' + 'Config\App::$baseURL "' . $baseURL . '" is not a valid URL.', ); } @@ -266,7 +266,7 @@ public function __toString(): string $this->getAuthority(), $this->getPath(), $this->getQuery(), - $this->getFragment() + $this->getFragment(), ); } diff --git a/system/HTTP/URI.php b/system/HTTP/URI.php index 2b386797fecd..c9d634d3846d 100644 --- a/system/HTTP/URI.php +++ b/system/HTTP/URI.php @@ -163,7 +163,7 @@ public static function createURIString( ?string $authority = null, ?string $path = null, ?string $query = null, - ?string $fragment = null + ?string $fragment = null, ): string { $uri = ''; if ($scheme !== null && $scheme !== '') { @@ -638,7 +638,7 @@ public function __toString(): string $this->getAuthority(), $path, // Absolute URIs should use a "/" for an empty path $this->getQuery(), - $this->getFragment() + $this->getFragment(), ); } @@ -1022,7 +1022,7 @@ protected function filterPath(?string $path = null): string $path = preg_replace_callback( '/(?:[^' . static::CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/', static fn (array $matches): string => rawurlencode($matches[0]), - $path + $path, ); return $path; @@ -1170,7 +1170,7 @@ protected function parseStr(string $query): array $params = array_map(static fn (string $chunk): ?string => preg_replace_callback( '/^(?[^&=]+?)(?:\[[^&=]*\])?=(?[^&=]+)/', static fn (array $match): string => str_replace($match['key'], bin2hex($match['key']), $match[0]), - urldecode($chunk) + urldecode($chunk), ), $query); $params = implode('&', $params); diff --git a/system/Helpers/Array/ArrayHelper.php b/system/Helpers/Array/ArrayHelper.php index fc5bc462956e..1b812e6a5123 100644 --- a/system/Helpers/Array/ArrayHelper.php +++ b/system/Helpers/Array/ArrayHelper.php @@ -54,12 +54,12 @@ private static function convertToArray(string $index): array '/(? str_replace('\.', '.', $key), - $segments + $segments, ); } @@ -130,7 +130,7 @@ public static function dotKeyExists(string $index, array $array): bool { if (str_ends_with($index, '*') || str_contains($index, '*.*')) { throw new InvalidArgumentException( - 'You must set key right after "*". Invalid index: "' . $index . '"' + 'You must set key right after "*". Invalid index: "' . $index . '"', ); } @@ -210,7 +210,7 @@ private static function arrayAttachIndexedValue( array $result, array $row, array $indexes, - bool $includeEmpty + bool $includeEmpty, ): array { if (($index = array_shift($indexes)) === null) { $result[] = $row; diff --git a/system/Helpers/cookie_helper.php b/system/Helpers/cookie_helper.php index 27007104e68e..18239fe2ebff 100644 --- a/system/Helpers/cookie_helper.php +++ b/system/Helpers/cookie_helper.php @@ -46,7 +46,7 @@ function set_cookie( string $prefix = '', ?bool $secure = null, ?bool $httpOnly = null, - ?string $sameSite = null + ?string $sameSite = null, ): void { $response = service('response'); $response->setCookie($name, $value, $expire, $domain, $path, $prefix, $secure, $httpOnly, $sameSite); diff --git a/system/Helpers/date_helper.php b/system/Helpers/date_helper.php index c0b4d5ebe17a..c16da6592886 100644 --- a/system/Helpers/date_helper.php +++ b/system/Helpers/date_helper.php @@ -43,7 +43,7 @@ function now(?string $timezone = null): int $year, $hour, $minute, - $second + $second, ); return mktime($hour, $minute, $second, $month, $day, $year); diff --git a/system/Helpers/filesystem_helper.php b/system/Helpers/filesystem_helper.php index 6acf6f38f846..9c0196b4752f 100644 --- a/system/Helpers/filesystem_helper.php +++ b/system/Helpers/filesystem_helper.php @@ -87,7 +87,7 @@ function directory_mirror(string $originDir, string $targetDir, bool $overwrite */ foreach (new RecursiveIteratorIterator( new RecursiveDirectoryIterator($originDir, FilesystemIterator::SKIP_DOTS), - RecursiveIteratorIterator::SELF_FIRST + RecursiveIteratorIterator::SELF_FIRST, ) as $file) { $origin = $file->getPathname(); $target = $targetDir . substr($origin, $dirLen); @@ -159,7 +159,7 @@ function delete_files(string $path, bool $delDir = false, bool $htdocs = false, try { foreach (new RecursiveIteratorIterator( new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS), - RecursiveIteratorIterator::CHILD_FIRST + RecursiveIteratorIterator::CHILD_FIRST, ) as $object) { $filename = $object->getFilename(); if (! $hidden && $filename[0] === '.') { @@ -202,7 +202,7 @@ function get_filenames( string $sourceDir, ?bool $includePath = false, bool $hidden = false, - bool $includeDir = true + bool $includeDir = true, ): array { $files = []; @@ -212,7 +212,7 @@ function get_filenames( try { foreach (new RecursiveIteratorIterator( new RecursiveDirectoryIterator($sourceDir, RecursiveDirectoryIterator::SKIP_DOTS | FilesystemIterator::FOLLOW_SYMLINKS), - RecursiveIteratorIterator::SELF_FIRST + RecursiveIteratorIterator::SELF_FIRST, ) as $name => $object) { $basename = pathinfo($name, PATHINFO_BASENAME); if (! $hidden && $basename[0] === '.') { diff --git a/system/Helpers/form_helper.php b/system/Helpers/form_helper.php index 679008c9731a..ae4505c26597 100644 --- a/system/Helpers/form_helper.php +++ b/system/Helpers/form_helper.php @@ -741,7 +741,7 @@ function validation_show_error(string $field, string $template = 'single'): stri $errors = array_filter(validation_errors(), static fn ($key): bool => preg_match( '/^' . str_replace(['\.\*', '\*\.'], ['\..+', '.+\.'], preg_quote($field, '/')) . '$/', - $key + $key, ) === 1, ARRAY_FILTER_USE_KEY); if ($errors === []) { diff --git a/system/Helpers/html_helper.php b/system/Helpers/html_helper.php index 3eb55a6d5150..9dcf82536eeb 100644 --- a/system/Helpers/html_helper.php +++ b/system/Helpers/html_helper.php @@ -238,7 +238,7 @@ function link_tag( string $title = '', string $media = '', bool $indexPage = false, - string $hreflang = '' + string $hreflang = '', ): string { $attributes = []; // extract fields if needed diff --git a/system/Helpers/inflector_helper.php b/system/Helpers/inflector_helper.php index abc565652ecb..fb4ef6cb3924 100644 --- a/system/Helpers/inflector_helper.php +++ b/system/Helpers/inflector_helper.php @@ -278,7 +278,7 @@ function is_pluralizable(string $word): bool 'wisdom', 'work', ], - true + true, ); return ! $uncountables; diff --git a/system/Helpers/security_helper.php b/system/Helpers/security_helper.php index af6257e5e39c..d42ac0dda777 100644 --- a/system/Helpers/security_helper.php +++ b/system/Helpers/security_helper.php @@ -35,7 +35,7 @@ function strip_image_tags(string $str): string '#`]+)).*?\>#i', ], '\\2', - $str + $str, ); } } diff --git a/system/Helpers/text_helper.php b/system/Helpers/text_helper.php index 8733049c88a4..6e9db747305c 100644 --- a/system/Helpers/text_helper.php +++ b/system/Helpers/text_helper.php @@ -152,7 +152,7 @@ function entities_to_ascii(string $str, bool $all = true): string return str_replace( ['&', '<', '>', '"', ''', '-'], ['&', '<', '>', '"', "'", '-'], - $str + $str, ); } @@ -193,7 +193,7 @@ function word_censor(string $str, array $censored, string $replacement = ''): st $str = preg_replace( "/({$delim})(" . $badword . ")({$delim})/i", "\\1{$replacement}\\3", - $str + $str, ); } elseif (preg_match_all("/{$delim}(" . $badword . "){$delim}/i", $str, $matches, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE) >= 1) { $matches = $matches[1]; @@ -205,7 +205,7 @@ function word_censor(string $str, array $censored, string $replacement = ''): st $str, str_repeat('#', $length), $matches[$i][1], - $length + $length, ); } } @@ -235,7 +235,7 @@ function highlight_code(string $str): string $str = str_replace( ['<', '>', '', '<%', '%>', '\\', ''], ['<', '>', 'phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'], - $str + $str, ); // The highlight_string function requires that the text be surrounded @@ -254,7 +254,7 @@ function highlight_code(string $str): string "$1\n\n", '', ], - $str + $str, ); // Replace our markers back to PHP tags. @@ -275,7 +275,7 @@ function highlight_code(string $str): string '\\', '</script>', ], - $str + $str, ); } } @@ -581,7 +581,7 @@ function random_string(string $type = 'alnum', int $len = 8): string case 'crypto': if ($len % 2 !== 0) { throw new InvalidArgumentException( - 'You must set an even number to the second parameter when you use `crypto`.' + 'You must set an even number to the second parameter when you use `crypto`.', ); } @@ -611,7 +611,7 @@ function _from_random(int $length, string $pool): string { if ($length <= 0) { throw new InvalidArgumentException( - sprintf('A strictly positive length is expected, "%d" given.', $length) + sprintf('A strictly positive length is expected, "%d" given.', $length), ); } @@ -619,7 +619,7 @@ function _from_random(int $length, string $pool): string $bits = (int) ceil(log($poolSize, 2.0)); if ($bits <= 0 || $bits > 56) { throw new InvalidArgumentException( - 'The length of the alphabet must in the [2^1, 2^56] range.' + 'The length of the alphabet must in the [2^1, 2^56] range.', ); } diff --git a/system/Helpers/url_helper.php b/system/Helpers/url_helper.php index b6df3edc3c3d..4d49447bf33a 100644 --- a/system/Helpers/url_helper.php +++ b/system/Helpers/url_helper.php @@ -359,7 +359,7 @@ function auto_link(string $str, string $type = 'both', bool $popup = false): str '#([a-z][a-z0-9+\-.]*://|www\.)[a-z0-9]+(-+[a-z0-9]+)*(\.[a-z0-9]+(-+[a-z0-9]+)*)+(/([^\s()<>;]+\w)?/?)?#i', $str, $matches, - PREG_OFFSET_CAPTURE | PREG_SET_ORDER + PREG_OFFSET_CAPTURE | PREG_SET_ORDER, ) >= 1 ) { // Set our target HTML if using popup links. @@ -386,7 +386,7 @@ function auto_link(string $str, string $type = 'both', bool $popup = false): str '#([\w\.\-\+]+@[a-z0-9\-]+\.[a-z0-9\-\.]+[^[:punct:]\s])#i', $str, $matches, - PREG_OFFSET_CAPTURE + PREG_OFFSET_CAPTURE, ) >= 1 ) { foreach (array_reverse($matches[0]) as $match) { diff --git a/system/Honeypot/Honeypot.php b/system/Honeypot/Honeypot.php index 2e79daadb096..1b09da4d1a68 100644 --- a/system/Honeypot/Honeypot.php +++ b/system/Honeypot/Honeypot.php @@ -85,7 +85,7 @@ public function attachHoneypot(ResponseInterface $response) $this->config->container = str_ireplace( '>{template}', ' id="' . $this->config->containerId . '">{template}', - $this->config->container + $this->config->container, ); } diff --git a/system/I18n/TimeTrait.php b/system/I18n/TimeTrait.php index 354b7542e755..bcdc86314974 100644 --- a/system/I18n/TimeTrait.php +++ b/system/I18n/TimeTrait.php @@ -222,7 +222,7 @@ public static function create( ?int $minutes = null, ?int $seconds = null, $timezone = null, - ?string $locale = null + ?string $locale = null, ) { $year ??= date('Y'); $month ??= date('m'); @@ -665,7 +665,7 @@ protected function setValue(string $name, $value) (int) $minute, (int) $second, $this->getTimezoneName(), - $this->locale + $this->locale, ); } diff --git a/system/Images/Handlers/GDHandler.php b/system/Images/Handlers/GDHandler.php index 062a69d89212..12ea4e1a72e2 100644 --- a/system/Images/Handlers/GDHandler.php +++ b/system/Images/Handlers/GDHandler.php @@ -322,7 +322,7 @@ protected function ensureResource() // if valid image type, make corresponding image resource $this->resource = $this->getImageResource( $this->image()->getPathname(), - $this->image()->imageType + $this->image()->imageType, ); } } diff --git a/system/Language/Language.php b/system/Language/Language.php index cbea4a53324e..9847553127fe 100644 --- a/system/Language/Language.php +++ b/system/Language/Language.php @@ -206,11 +206,11 @@ protected function formatMessage($message, array $args = []) $argsString = implode( ', ', - array_map(static fn ($element): string => '"' . $element . '"', $args) + array_map(static fn ($element): string => '"' . $element . '"', $args), ); $argsUrlEncoded = implode( ', ', - array_map(static fn ($element): string => '"' . rawurlencode($element) . '"', $args) + array_map(static fn ($element): string => '"' . rawurlencode($element) . '"', $args), ); log_message( @@ -218,7 +218,7 @@ protected function formatMessage($message, array $args = []) 'Language.invalidMessageFormat: $message: "' . $message . '", $args: ' . $argsString . ' (urlencoded: ' . $argsUrlEncoded . '),' - . ' MessageFormatter Error: ' . $fmtError + . ' MessageFormatter Error: ' . $fmtError, ); return $message . "\n【Warning】Also, invalid string(s) was passed to the Language class. See log file for details."; diff --git a/system/Log/Handlers/ChromeLoggerHandler.php b/system/Log/Handlers/ChromeLoggerHandler.php index 37c7c0ffeddf..eedea60a1558 100644 --- a/system/Log/Handlers/ChromeLoggerHandler.php +++ b/system/Log/Handlers/ChromeLoggerHandler.php @@ -160,7 +160,7 @@ public function sendLogs(?ResponseInterface &$response = null) } $data = base64_encode( - mb_convert_encoding(json_encode($this->json), 'UTF-8', mb_list_encodings()) + mb_convert_encoding(json_encode($this->json), 'UTF-8', mb_list_encodings()), ); $response->setHeader($this->header, $data); diff --git a/system/Model.php b/system/Model.php index 98e3be0b1f68..8734ceec954a 100644 --- a/system/Model.php +++ b/system/Model.php @@ -373,17 +373,17 @@ protected function doInsert(array $row) $allFields = $this->db->protectIdentifiers( array_map( static fn ($row) => $row->name, - $this->db->getFieldData($this->table) + $this->db->getFieldData($this->table), ), false, - true + true, ); $sql = sprintf( 'INSERT INTO %s (%s) VALUES (%s)', $table, implode(',', $allFields), - substr(str_repeat(',DEFAULT', count($allFields)), 1) + substr(str_repeat(',DEFAULT', count($allFields)), 1), ); } else { $sql = 'INSERT INTO ' . $table . ' DEFAULT VALUES'; @@ -454,7 +454,7 @@ protected function doUpdate($id = null, $row = null): bool if ($builder->getCompiledQBWhere() === []) { throw new DatabaseException( - 'Updates are not allowed unless they contain a "where" or "like" clause.' + 'Updates are not allowed unless they contain a "where" or "like" clause.', ); } @@ -503,7 +503,7 @@ protected function doDelete($id = null, bool $purge = false) if ($this->useSoftDeletes && ! $purge) { if ($builder->getCompiledQBWhere() === []) { throw new DatabaseException( - 'Deletes are not allowed unless they contain a "where" or "like" clause.' + 'Deletes are not allowed unless they contain a "where" or "like" clause.', ); } diff --git a/system/Pager/Pager.php b/system/Pager/Pager.php index 3bdc85388c18..6d0f54d14a00 100644 --- a/system/Pager/Pager.php +++ b/system/Pager/Pager.php @@ -295,7 +295,7 @@ public function getPageURI(?int $page = null, string $group = 'default', bool $r $uri->getAuthority(), $uri->getPath(), $uri->getQuery(), - $uri->getFragment() + $uri->getFragment(), ); } diff --git a/system/Pager/PagerRenderer.php b/system/Pager/PagerRenderer.php index 64c4c40c531d..7257f2becf31 100644 --- a/system/Pager/PagerRenderer.php +++ b/system/Pager/PagerRenderer.php @@ -148,7 +148,7 @@ public function getPrevious() $uri->getAuthority(), $uri->getPath(), $uri->getQuery(), - $uri->getFragment() + $uri->getFragment(), ); } @@ -186,7 +186,7 @@ public function getNext() $uri->getAuthority(), $uri->getPath(), $uri->getQuery(), - $uri->getFragment() + $uri->getFragment(), ); } @@ -208,7 +208,7 @@ public function getFirst(): string $uri->getAuthority(), $uri->getPath(), $uri->getQuery(), - $uri->getFragment() + $uri->getFragment(), ); } @@ -230,7 +230,7 @@ public function getLast(): string $uri->getAuthority(), $uri->getPath(), $uri->getQuery(), - $uri->getFragment() + $uri->getFragment(), ); } @@ -252,7 +252,7 @@ public function getCurrent(): string $uri->getAuthority(), $uri->getPath(), $uri->getQuery(), - $uri->getFragment() + $uri->getFragment(), ); } @@ -278,7 +278,7 @@ public function links(): array $uri->getAuthority(), $uri->getPath(), $uri->getQuery(), - $uri->getFragment() + $uri->getFragment(), ), 'title' => $i, 'active' => ($i === $this->current), @@ -341,7 +341,7 @@ public function getPreviousPage() $uri->getAuthority(), $uri->getPath(), $uri->getQuery(), - $uri->getFragment() + $uri->getFragment(), ); } @@ -379,7 +379,7 @@ public function getNextPage() $uri->getAuthority(), $uri->getPath(), $uri->getQuery(), - $uri->getFragment() + $uri->getFragment(), ); } diff --git a/system/Router/AutoRouter.php b/system/Router/AutoRouter.php index cad9ecbc1746..3a81f3a7bc6b 100644 --- a/system/Router/AutoRouter.php +++ b/system/Router/AutoRouter.php @@ -51,7 +51,7 @@ public function __construct( * Whether dashes in URI's should be converted * to underscores when determining method names. */ - private bool $translateURIDashes + private bool $translateURIDashes, ) { } @@ -118,19 +118,19 @@ public function getRoute(string $uri, string $httpVerb): array // Like $routes->cli('hello/(:segment)', 'Home::$1') if (str_contains($handler, '::$')) { throw new PageNotFoundException( - 'Cannot access CLI Route: ' . $uri + 'Cannot access CLI Route: ' . $uri, ); } if (str_starts_with($handler, $controller . '::' . $methodName)) { throw new PageNotFoundException( - 'Cannot access CLI Route: ' . $uri + 'Cannot access CLI Route: ' . $uri, ); } if ($handler === $controller) { throw new PageNotFoundException( - 'Cannot access CLI Route: ' . $uri + 'Cannot access CLI Route: ' . $uri, ); } } @@ -153,9 +153,9 @@ public function getRoute(string $uri, string $httpVerb): array str_replace( '/', '\\', - $this->defaultNamespace . $this->directory . $controllerName + $this->defaultNamespace . $this->directory . $controllerName, ), - '\\' + '\\', ); } @@ -199,7 +199,7 @@ private function scanControllers(array $segments): array while ($c-- > 0) { $segmentConvert = ucfirst( - $this->translateURIDashes ? str_replace('-', '_', $segments[0]) : $segments[0] + $this->translateURIDashes ? str_replace('-', '_', $segments[0]) : $segments[0], ); // as soon as we encounter any segment that is not PSR-4 compliant, stop searching if (! $this->isValidSegment($segmentConvert)) { diff --git a/system/Router/AutoRouterImproved.php b/system/Router/AutoRouterImproved.php index 6160c0555dae..c14c8fe97ebe 100644 --- a/system/Router/AutoRouterImproved.php +++ b/system/Router/AutoRouterImproved.php @@ -121,7 +121,7 @@ public function __construct( * Whether dashes in URI's should be converted * to underscores when determining method names. */ - private readonly bool $translateURIDashes + private readonly bool $translateURIDashes, ) { $this->namespace = rtrim($namespace, '\\'); @@ -210,7 +210,7 @@ private function searchLastDefaultController(): bool $namespaces = array_map( fn ($segment): string => $this->translateURI($segment), - $segments + $segments, ); $controller = '\\' . $this->namespace @@ -288,7 +288,7 @@ public function getRoute(string $uri, string $httpVerb): array strtolower($baseControllerName) === strtolower($this->defaultController) ) { throw new PageNotFoundException( - 'Cannot access the default controller "' . $this->controller . '" with the controller name URI path.' + 'Cannot access the default controller "' . $this->controller . '" with the controller name URI path.', ); } } elseif ($this->searchLastDefaultController()) { @@ -329,14 +329,14 @@ public function getRoute(string $uri, string $httpVerb): array // Prevent access to default controller's method if (strtolower($baseControllerName) === strtolower($this->defaultController)) { throw new PageNotFoundException( - 'Cannot access the default controller "' . $this->controller . '::' . $this->method . '"' + 'Cannot access the default controller "' . $this->controller . '::' . $this->method . '"', ); } // Prevent access to default method path if (strtolower($this->method) === strtolower($defaultMethod)) { throw new PageNotFoundException( - 'Cannot access the default method "' . $this->method . '" with the method name URI path.' + 'Cannot access the default method "' . $this->method . '" with the method name URI path.', ); } } elseif (method_exists($this->controller, $defaultMethod)) { @@ -400,7 +400,7 @@ private function setDirectory() $dir = str_replace( '\\', '/', - ltrim(substr($namespaces, strlen($this->namespace)), '\\') + ltrim(substr($namespaces, strlen($this->namespace)), '\\'), ); if ($dir !== '') { @@ -417,7 +417,7 @@ private function protectDefinedRoutes(): void if ($routeLowerCase === $controller) { throw new PageNotFoundException( - 'Cannot access the controller in Defined Routes. Controller: ' . $controllerInRoutes + 'Cannot access the controller in Defined Routes. Controller: ' . $controllerInRoutes, ); } } @@ -446,7 +446,7 @@ private function checkParameters(): void throw new PageNotFoundException( 'The param count in the URI are greater than the controller method params.' . ' Handler:' . $this->controller . '::' . $this->method - . ', URI:' . $this->uri + . ', URI:' . $this->uri, ); } } @@ -459,7 +459,7 @@ private function checkRemap(): void throw new PageNotFoundException( 'AutoRouterImproved does not support `_remap()` method.' - . ' Controller:' . $this->controller + . ' Controller:' . $this->controller, ); } catch (ReflectionException) { // Do nothing. @@ -482,7 +482,7 @@ private function checkUnderscore(): void . ' when $translateURIDashes is enabled.' . ' Please use the dash.' . ' Handler:' . $this->controller . '::' . $this->method - . ', URI:' . $this->uri + . ', URI:' . $this->uri, ); } } @@ -502,7 +502,7 @@ private function checkUriForController(string $classname): void if (! in_array(ltrim($classname, '\\'), get_declared_classes(), true)) { throw new PageNotFoundException( - '"' . $classname . '" is not found.' + '"' . $classname . '" is not found.', ); } } @@ -531,7 +531,7 @@ private function checkUriForMethod(string $method): void && ! in_array($method, get_class_methods($this->controller), true) ) { throw new PageNotFoundException( - '"' . $this->controller . '::' . $method . '()" is not found.' + '"' . $this->controller . '::' . $method . '()" is not found.', ); } } @@ -558,7 +558,7 @@ private function translateURI(string $segment): string . ' containing uppercase letters ("' . $segment . '")' . ' when $translateUriToCamelCase is enabled.' . ' Please use the dash.' - . ' URI:' . $this->uri + . ' URI:' . $this->uri, ); } @@ -568,7 +568,7 @@ private function translateURI(string $segment): string . ' containing double dash ("' . $segment . '")' . ' when $translateUriToCamelCase is enabled.' . ' Please use the single dash.' - . ' URI:' . $this->uri + . ' URI:' . $this->uri, ); } @@ -576,8 +576,8 @@ private function translateURI(string $segment): string ' ', '', ucwords( - preg_replace('/[\-]+/', ' ', $segment) - ) + preg_replace('/[\-]+/', ' ', $segment), + ), ); } diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index faee291a8213..400ef6773b0d 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -634,7 +634,7 @@ public function setHTTPVerb(string $verb) @trigger_error( 'Passing lowercase HTTP method "' . $verb . '" is deprecated.' . ' Use uppercase HTTP method like "' . strtoupper($verb) . '".', - E_USER_DEPRECATED + E_USER_DEPRECATED, ); } @@ -791,7 +791,7 @@ public function group(string $name, ...$params) // Merge options other than filters. $this->currentOptions = array_merge( $this->currentOptions ?? [], - $options + $options, ); } @@ -1026,7 +1026,7 @@ public function match(array $verbs = [], string $from = '', $to = '', ?array $op @trigger_error( 'Passing lowercase HTTP method "' . $verb . '" is deprecated.' . ' Use uppercase HTTP method like "' . strtoupper($verb) . '".', - E_USER_DEPRECATED + E_USER_DEPRECATED, ); } @@ -1382,7 +1382,7 @@ protected function buildReverseRoute(string $from, array $params): string foreach ($placeholders as $index => $placeholder) { if (! isset($params[$index])) { throw new InvalidArgumentException( - 'Missing argument for "' . $placeholder . '" in route "' . $from . '".' + 'Missing argument for "' . $placeholder . '" in route "' . $from . '".', ); } @@ -1506,7 +1506,7 @@ protected function create(string $verb, string $from, $to, ?array $options = nul '/\$X/', static fn ($m): string => '$' . $i, $to, - 1 + 1, ); } } @@ -1773,7 +1773,7 @@ public function getRegisteredControllers(?string $verb = '*'): array @trigger_error( 'Passing lowercase HTTP method "' . $verb . '" is deprecated.' . ' Use uppercase HTTP method like "' . strtoupper($verb) . '".', - E_USER_DEPRECATED + E_USER_DEPRECATED, ); } diff --git a/system/Router/Router.php b/system/Router/Router.php index 1a2b1393cbd9..8de447d6cc3c 100644 --- a/system/Router/Router.php +++ b/system/Router/Router.php @@ -167,7 +167,7 @@ public function __construct(RouteCollectionInterface $routes, ?Request $request $this->collection->getDefaultNamespace(), $this->collection->getDefaultController(), $this->collection->getDefaultMethod(), - $this->translateURIDashes + $this->translateURIDashes, ); } else { $this->autoRouter = new AutoRouter( @@ -175,7 +175,7 @@ public function __construct(RouteCollectionInterface $routes, ?Request $request $this->collection->getDefaultNamespace(), $this->collection->getDefaultController(), $this->collection->getDefaultMethod(), - $this->translateURIDashes + $this->translateURIDashes, ); } } @@ -221,7 +221,7 @@ public function handle(?string $uri = null) // want this, like in the case of API's. if (! $this->collection->shouldAutoRoute()) { throw new PageNotFoundException( - "Can't find a route for '{$this->collection->getHTTPVerb()}: {$uri}'." + "Can't find a route for '{$this->collection->getHTTPVerb()}: {$uri}'.", ); } @@ -442,7 +442,7 @@ protected function checkRoutes(string $uri): bool throw new RedirectException( preg_replace('#\A' . $routeKey . '\z#u', $redirectTo, $uri), - $this->collection->getRedirectCode($routeKey) + $this->collection->getRedirectCode($routeKey), ); } // Store our locale so CodeIgniter object can @@ -451,7 +451,7 @@ protected function checkRoutes(string $uri): bool preg_match( '#^' . str_replace('{locale}', '(?[^/]+)', $matchedKey) . '$#u', $uri, - $matched + $matched, ); if ($this->collection->shouldUseSupportedLocalesOnly() @@ -546,7 +546,7 @@ static function ($match) use ($matches) { return $matches[$index] ?? ''; }, - $input + $input, ); } @@ -736,7 +736,7 @@ private function checkDisallowedChars(string $uri): void && preg_match('/\A[' . $this->permittedURIChars . ']+\z/iu', $segment) !== 1 ) { throw new BadRequestException( - 'The URI you submitted has disallowed characters: "' . $segment . '"' + 'The URI you submitted has disallowed characters: "' . $segment . '"', ); } } diff --git a/system/Security/Exceptions/SecurityException.php b/system/Security/Exceptions/SecurityException.php index ed1d76825036..09ecc26e6bc8 100644 --- a/system/Security/Exceptions/SecurityException.php +++ b/system/Security/Exceptions/SecurityException.php @@ -50,7 +50,7 @@ public static function forInvalidUTF8Chars(string $source, string $string) { return new static( 'Invalid UTF-8 characters in ' . $source . ': ' . $string, - 400 + 400, ); } @@ -66,7 +66,7 @@ public static function forInvalidControlChars(string $source, string $string) { return new static( 'Invalid Control characters in ' . $source . ': ' . $string, - 400 + 400, ); } diff --git a/system/Security/Security.php b/system/Security/Security.php index b6d2660295b9..5d86dbbe9984 100644 --- a/system/Security/Security.php +++ b/system/Security/Security.php @@ -530,7 +530,7 @@ private function saveHashInCookie(): void $this->hash, [ 'expires' => $this->config->expires === 0 ? 0 : Time::now()->getTimestamp() + $this->config->expires, - ] + ], ); $response = service('response'); diff --git a/system/Session/Handlers/BaseHandler.php b/system/Session/Handlers/BaseHandler.php index 6d7e09e4b6eb..bc2cdc17af11 100644 --- a/system/Session/Handlers/BaseHandler.php +++ b/system/Session/Handlers/BaseHandler.php @@ -132,7 +132,7 @@ protected function destroyCookie(): bool return setcookie( $this->cookieName, '', - ['expires' => 1, 'path' => $this->cookiePath, 'domain' => $this->cookieDomain, 'secure' => $this->cookieSecure, 'httponly' => true] + ['expires' => 1, 'path' => $this->cookiePath, 'domain' => $this->cookieDomain, 'secure' => $this->cookieSecure, 'httponly' => true], ); } diff --git a/system/Session/Handlers/DatabaseHandler.php b/system/Session/Handlers/DatabaseHandler.php index d36e9592cec0..aeafc48c39b9 100644 --- a/system/Session/Handlers/DatabaseHandler.php +++ b/system/Session/Handlers/DatabaseHandler.php @@ -285,7 +285,7 @@ public function gc($max_lifetime) return $this->db->table($this->table)->where( 'timestamp <', "now() - INTERVAL {$max_lifetime} second", - false + false, )->delete() ? 1 : $this->fail(); } diff --git a/system/Session/Handlers/FileHandler.php b/system/Session/Handlers/FileHandler.php index 6931ab1c581f..5a2e864453bf 100644 --- a/system/Session/Handlers/FileHandler.php +++ b/system/Session/Handlers/FileHandler.php @@ -283,7 +283,7 @@ public function gc($max_lifetime) $pattern = sprintf( '#\A%s' . $pattern . $this->sessionIDRegex . '\z#', - preg_quote($this->cookieName, '#') + preg_quote($this->cookieName, '#'), ); $collected = 0; diff --git a/system/Session/Handlers/MemcachedHandler.php b/system/Session/Handlers/MemcachedHandler.php index 73133e88d959..744d9556ee02 100644 --- a/system/Session/Handlers/MemcachedHandler.php +++ b/system/Session/Handlers/MemcachedHandler.php @@ -97,7 +97,7 @@ public function open($path, $name): bool '#,?([^,:]+)\:(\d{1,5})(?:\:(\d+))?#', $this->savePath, $matches, - PREG_SET_ORDER + PREG_SET_ORDER, ) < 1 ) { $this->memcached = null; @@ -110,7 +110,7 @@ public function open($path, $name): bool // If Memcached already has this server (or if the port is invalid), skip it if (in_array($match[1] . ':' . $match[2], $serverList, true)) { $this->logger->debug( - 'Session: Memcached server pool already has ' . $match[1] . ':' . $match[2] + 'Session: Memcached server pool already has ' . $match[1] . ':' . $match[2], ); continue; @@ -118,7 +118,7 @@ public function open($path, $name): bool if (! $this->memcached->addServer($match[1], (int) $match[2], $match[3] ?? 0)) { $this->logger->error( - 'Could not add ' . $match[1] . ':' . $match[2] . ' to Memcached server pool.' + 'Could not add ' . $match[1] . ':' . $match[2] . ' to Memcached server pool.', ); } else { $serverList[] = $match[1] . ':' . $match[2]; @@ -275,7 +275,7 @@ protected function lockSession(string $sessionID): bool if (! $this->memcached->set($lockKey, Time::now()->getTimestamp(), 300)) { $this->logger->error( - 'Session: Error while trying to obtain lock for ' . $this->keyPrefix . $sessionID + 'Session: Error while trying to obtain lock for ' . $this->keyPrefix . $sessionID, ); return false; @@ -287,7 +287,7 @@ protected function lockSession(string $sessionID): bool if ($attempt === 30) { $this->logger->error( - 'Session: Unable to obtain lock for ' . $this->keyPrefix . $sessionID . ' after 30 attempts, aborting.' + 'Session: Unable to obtain lock for ' . $this->keyPrefix . $sessionID . ' after 30 attempts, aborting.', ); return false; @@ -309,7 +309,7 @@ protected function releaseLock(): bool && $this->memcached->getResultCode() !== Memcached::RES_NOTFOUND ) { $this->logger->error( - 'Session: Error while trying to free lock for ' . $this->lockKey + 'Session: Error while trying to free lock for ' . $this->lockKey, ); return false; diff --git a/system/Session/Handlers/RedisHandler.php b/system/Session/Handlers/RedisHandler.php index 5e44a2a2bef8..eeb06043321b 100644 --- a/system/Session/Handlers/RedisHandler.php +++ b/system/Session/Handlers/RedisHandler.php @@ -180,7 +180,7 @@ public function open($path, $name): bool ! $redis->connect( $this->savePath['host'], $this->savePath['port'], - $this->savePath['timeout'] + $this->savePath['timeout'], ) ) { $this->logger->error('Session: Unable to connect to Redis with the configured settings.'); @@ -188,7 +188,7 @@ public function open($path, $name): bool $this->logger->error('Session: Unable to authenticate to Redis instance.'); } elseif (isset($this->savePath['database']) && ! $redis->select($this->savePath['database'])) { $this->logger->error( - 'Session: Unable to select Redis database with index ' . $this->savePath['database'] + 'Session: Unable to select Redis database with index ' . $this->savePath['database'], ); } else { $this->redis = $redis; @@ -318,7 +318,7 @@ public function destroy($id): bool if (isset($this->redis, $this->lockKey)) { if (($result = $this->redis->del($this->keyPrefix . $id)) !== 1) { $this->logger->debug( - 'Session: Redis::del() expected to return 1, got ' . var_export($result, true) . ' instead.' + 'Session: Redis::del() expected to return 1, got ' . var_export($result, true) . ' instead.', ); } @@ -369,7 +369,7 @@ protected function lockSession(string $sessionID): bool (string) Time::now()->getTimestamp(), // NX -- Only set the key if it does not already exist. // EX seconds -- Set the specified expire time, in seconds. - ['nx', 'ex' => 300] + ['nx', 'ex' => 300], ); if (! $result) { @@ -385,7 +385,7 @@ protected function lockSession(string $sessionID): bool if ($attempt === 300) { $this->logger->error( 'Session: Unable to obtain lock for ' . $this->keyPrefix . $sessionID - . ' after 300 attempts, aborting.' + . ' after 300 attempts, aborting.', ); return false; diff --git a/system/Test/CIUnitTestCase.php b/system/Test/CIUnitTestCase.php index 467e3a61bdf7..2797e63d8193 100644 --- a/system/Test/CIUnitTestCase.php +++ b/system/Test/CIUnitTestCase.php @@ -361,7 +361,7 @@ public function assertLogged(string $level, $expectedMessage = null) $this->assertTrue($result, sprintf( 'Failed asserting that expected message "%s" with level "%s" was logged.', $expectedMessage ?? '', - $level + $level, )); return $result; @@ -377,8 +377,8 @@ public function assertLogContains(string $level, string $logMessage, string $mes $message !== '' ? $message : sprintf( 'Failed asserting that logs have a record of message containing "%s" with level "%s".', $logMessage, - $level - ) + $level, + ), ); } @@ -417,7 +417,7 @@ public function assertHeaderEmitted(string $header, bool $ignoreCase = false): v { $this->assertNotNull( $this->getHeaderEmitted($header, $ignoreCase, __METHOD__), - "Didn't find header for {$header}" + "Didn't find header for {$header}", ); } @@ -431,7 +431,7 @@ public function assertHeaderNotEmitted(string $header, bool $ignoreCase = false) { $this->assertNull( $this->getHeaderEmitted($header, $ignoreCase, __METHOD__), - "Found header for {$header}" + "Found header for {$header}", ); } diff --git a/system/Test/ConfigFromArrayTrait.php b/system/Test/ConfigFromArrayTrait.php index 3652fa1074a1..c6beb6e63795 100644 --- a/system/Test/ConfigFromArrayTrait.php +++ b/system/Test/ConfigFromArrayTrait.php @@ -39,7 +39,7 @@ private function createConfigFromArray(string $classname, array $config) } throw new LogicException( - 'No such property: ' . $classname . '::$' . $key + 'No such property: ' . $classname . '::$' . $key, ); } diff --git a/system/Test/Constraints/SeeInDatabase.php b/system/Test/Constraints/SeeInDatabase.php index faf874be9ce8..d1025bc13d08 100644 --- a/system/Test/Constraints/SeeInDatabase.php +++ b/system/Test/Constraints/SeeInDatabase.php @@ -68,7 +68,7 @@ protected function failureDescription($table): string "a row in the table [%s] matches the attributes \n%s\n\n%s", $table, $this->toString(false, JSON_PRETTY_PRINT), - $this->getAdditionalInfo($table) + $this->getAdditionalInfo($table), ); } @@ -81,7 +81,7 @@ protected function getAdditionalInfo(string $table): string $similar = $builder->where( array_key_first($this->data), - $this->data[array_key_first($this->data)] + $this->data[array_key_first($this->data)], )->limit($this->show)->get()->getResultArray(); if ($similar !== []) { diff --git a/system/Test/Fabricator.php b/system/Test/Fabricator.php index 8da0c60fc089..f80ea201b9e9 100644 --- a/system/Test/Fabricator.php +++ b/system/Test/Fabricator.php @@ -437,21 +437,21 @@ public function makeArray() if (isset($this->modifiedFields['unique'][$field])) { $faker = $faker->unique( $this->modifiedFields['unique'][$field]['reset'], - $this->modifiedFields['unique'][$field]['maxRetries'] + $this->modifiedFields['unique'][$field]['maxRetries'], ); } if (isset($this->modifiedFields['optional'][$field])) { $faker = $faker->optional( $this->modifiedFields['optional'][$field]['weight'], - $this->modifiedFields['optional'][$field]['default'] + $this->modifiedFields['optional'][$field]['default'], ); } if (isset($this->modifiedFields['valid'][$field])) { $faker = $faker->valid( $this->modifiedFields['valid'][$field]['validator'], - $this->modifiedFields['valid'][$field]['maxRetries'] + $this->modifiedFields['valid'][$field]['maxRetries'], ); } diff --git a/system/Test/FeatureTestTrait.php b/system/Test/FeatureTestTrait.php index 13522d8758f3..eaf49a0a9147 100644 --- a/system/Test/FeatureTestTrait.php +++ b/system/Test/FeatureTestTrait.php @@ -58,7 +58,7 @@ protected function withRoutes(?array $routes = null) @trigger_error( 'Passing lowercase HTTP method "' . $route[0] . '" is deprecated.' . ' Use uppercase HTTP method like "' . strtoupper($route[0]) . '".', - E_USER_DEPRECATED + E_USER_DEPRECATED, ); } @@ -168,7 +168,7 @@ public function call(string $method, string $path, ?array $params = null) @trigger_error( 'Passing lowercase HTTP method "' . $method . '" is deprecated.' . ' Use uppercase HTTP method like "' . strtoupper($method) . '".', - E_USER_DEPRECATED + E_USER_DEPRECATED, ); } @@ -385,7 +385,7 @@ protected function populateGlobals(string $name, Request $request, ?array $param $request->setGlobal($name, $params); $request->setGlobal( 'request', - $request->fetchGlobal('post') + $request->fetchGlobal('get') + $request->fetchGlobal('post') + $request->fetchGlobal('get'), ); } diff --git a/system/Test/Mock/MockInputOutput.php b/system/Test/Mock/MockInputOutput.php index 750f142a00e7..87d09832df56 100644 --- a/system/Test/Mock/MockInputOutput.php +++ b/system/Test/Mock/MockInputOutput.php @@ -74,7 +74,7 @@ public function getOutput(?int $index = null): string throw new InvalidArgumentException( 'No such index in output: ' . $index . ', the last index is: ' - . (count($this->outputs) - 1) + . (count($this->outputs) - 1), ); } @@ -103,7 +103,7 @@ public function input(?string $prefix = null): string { if ($this->inputs === []) { throw new LogicException( - 'No input data. Specifiy input data with `MockInputOutput::setInputs()`.' + 'No input data. Specifiy input data with `MockInputOutput::setInputs()`.', ); } diff --git a/system/Test/TestResponse.php b/system/Test/TestResponse.php index f36a9f8ff5e5..13b1df3abaf0 100644 --- a/system/Test/TestResponse.php +++ b/system/Test/TestResponse.php @@ -153,7 +153,7 @@ public function assertOK(): void { Assert::assertTrue( $this->isOK(), - "{$this->response->getStatusCode()} is not a successful status code, or Response has an empty body." + "{$this->response->getStatusCode()} is not a successful status code, or Response has an empty body.", ); } @@ -164,7 +164,7 @@ public function assertNotOK(): void { Assert::assertFalse( $this->isOK(), - "{$this->response->getStatusCode()} is an unexpected successful status code, or Response body has content." + "{$this->response->getStatusCode()} is an unexpected successful status code, or Response body has content.", ); } @@ -287,7 +287,7 @@ public function assertHeader(string $key, $value = null): void Assert::assertSame( $value, $this->response->getHeaderLine($key), - "The value of '{$key}' header ({$this->response->getHeaderLine($key)}) does not match expected value." + "The value of '{$key}' header ({$this->response->getHeaderLine($key)}) does not match expected value.", ); } } @@ -331,7 +331,7 @@ public function assertCookieExpired(string $key, string $prefix = ''): void Assert::assertGreaterThan( Time::now()->getTimestamp(), - $this->response->getCookie($key, $prefix)->getExpiresTimestamp() + $this->response->getCookie($key, $prefix)->getExpiresTimestamp(), ); } @@ -420,7 +420,7 @@ public function assertSee(?string $search = null, ?string $element = null): void { Assert::assertTrue( $this->domParser->see($search, $element), - "Text '{$search}' is not seen in response." + "Text '{$search}' is not seen in response.", ); } @@ -431,7 +431,7 @@ public function assertDontSee(?string $search = null, ?string $element = null): { Assert::assertTrue( $this->domParser->dontSee($search, $element), - "Text '{$search}' is unexpectedly seen in response." + "Text '{$search}' is unexpectedly seen in response.", ); } @@ -442,7 +442,7 @@ public function assertSeeElement(string $search): void { Assert::assertTrue( $this->domParser->seeElement($search), - "Element with selector '{$search}' is not seen in response." + "Element with selector '{$search}' is not seen in response.", ); } @@ -453,7 +453,7 @@ public function assertDontSeeElement(string $search): void { Assert::assertTrue( $this->domParser->dontSeeElement($search), - "Element with selector '{$search}' is unexpectedly seen in response.'" + "Element with selector '{$search}' is unexpectedly seen in response.'", ); } @@ -464,7 +464,7 @@ public function assertSeeLink(string $text, ?string $details = null): void { Assert::assertTrue( $this->domParser->seeLink($text, $details), - "Anchor tag with text '{$text}' is not seen in response." + "Anchor tag with text '{$text}' is not seen in response.", ); } @@ -475,7 +475,7 @@ public function assertSeeInField(string $field, ?string $value = null): void { Assert::assertTrue( $this->domParser->seeInField($field, $value), - "Input named '{$field}' with value '{$value}' is not seen in response." + "Input named '{$field}' with value '{$value}' is not seen in response.", ); } diff --git a/system/Validation/FormatRules.php b/system/Validation/FormatRules.php index 7fe16d9d2772..502f3ae09c82 100644 --- a/system/Validation/FormatRules.php +++ b/system/Validation/FormatRules.php @@ -428,7 +428,7 @@ public function valid_url_strict($str = null, ?string $validSchemes = null): boo $scheme = strtolower((string) parse_url($str, PHP_URL_SCHEME)); $validSchemes = explode( ',', - strtolower($validSchemes ?? 'http,https') + strtolower($validSchemes ?? 'http,https'), ); return in_array($scheme, $validSchemes, true) diff --git a/system/Validation/Rules.php b/system/Validation/Rules.php index 7f2f0bd941ec..e12b8227df9e 100644 --- a/system/Validation/Rules.php +++ b/system/Validation/Rules.php @@ -125,7 +125,7 @@ public function is_not_unique($str, string $field, array $data): bool [$field, $whereField, $whereValue] = array_pad( explode(',', $field), 3, - null + null, ); // Break the table and field apart @@ -184,7 +184,7 @@ public function is_unique($str, string $field, array $data): bool [$field, $ignoreField, $ignoreValue] = array_pad( explode(',', $field), 3, - null + null, ); sscanf($field, '%[^.].%[^.]', $table, $field); @@ -386,7 +386,7 @@ public function required_without( ?string $otherFields = null, array $data = [], ?string $error = null, - ?string $field = null + ?string $field = null, ): bool { if ($otherFields === null || $data === []) { throw new InvalidArgumentException('You must supply the parameters: otherFields, data.'); @@ -447,7 +447,7 @@ public function field_exists( ?string $param = null, array $data = [], ?string $error = null, - ?string $field = null + ?string $field = null, ): bool { if (str_contains($field, '.')) { return ArrayHelper::dotKeyExists($field, $data); diff --git a/system/Validation/StrictRules/Rules.php b/system/Validation/StrictRules/Rules.php index c9b98c479875..2c2a861ca97c 100644 --- a/system/Validation/StrictRules/Rules.php +++ b/system/Validation/StrictRules/Rules.php @@ -42,7 +42,7 @@ public function differs( string $otherField, array $data, ?string $error = null, - ?string $field = null + ?string $field = null, ): bool { if (str_contains($otherField, '.')) { return $str !== dot_array_search($otherField, $data); @@ -149,7 +149,7 @@ public function is_not_unique($str, string $field, array $data): bool [$field, $whereField, $whereValue] = array_pad( explode(',', $field), 3, - null + null, ); // Break the table and field apart @@ -210,7 +210,7 @@ public function is_unique($str, string $field, array $data): bool [$field, $ignoreField, $ignoreValue] = array_pad( explode(',', $field), 3, - null + null, ); sscanf($field, '%[^.].%[^.]', $table, $field); @@ -279,7 +279,7 @@ public function matches( string $otherField, array $data, ?string $error = null, - ?string $field = null + ?string $field = null, ): bool { if (str_contains($otherField, '.')) { return $str === dot_array_search($otherField, $data); @@ -410,7 +410,7 @@ public function required_without( ?string $otherFields = null, array $data = [], ?string $error = null, - ?string $field = null + ?string $field = null, ): bool { return $this->nonStrictRules->required_without($str, $otherFields, $data, $error, $field); } @@ -428,7 +428,7 @@ public function field_exists( ?string $param = null, array $data = [], ?string $error = null, - ?string $field = null + ?string $field = null, ): bool { if (str_contains($field, '.')) { return ArrayHelper::dotKeyExists($field, $data); diff --git a/system/Validation/Validation.php b/system/Validation/Validation.php index 5b51b403fef9..880d3508bb45 100644 --- a/system/Validation/Validation.php +++ b/system/Validation/Validation.php @@ -177,7 +177,7 @@ public function run(?array $data = null, ?string $group = null, $dbGroup = null) $values = array_filter( $flattenedArray, static fn ($key): bool => preg_match(self::getRegex($field), $key) === 1, - ARRAY_FILTER_USE_KEY + ARRAY_FILTER_USE_KEY, ); // if keys not found @@ -208,7 +208,7 @@ public function run(?array $data = null, ?string $group = null, $dbGroup = null) // Store data that was actually validated. $this->validated = DotArrayFilter::run( array_keys($this->rules), - $this->data + $this->data, ); return true; @@ -226,7 +226,7 @@ private static function getRegex(string $field): string . str_replace( ['\.\*', '\*\.'], ['\.[^.]+', '[^.]+\.'], - preg_quote($field, '/') + preg_quote($field, '/'), ) . '\z/'; } @@ -248,11 +248,11 @@ public function check($value, $rules, array $errors = [], $dbGroup = null): bool 'check', null, $rules, - $errors + $errors, )->run( ['check' => $value], null, - $dbGroup + $dbGroup, ); } @@ -281,7 +281,7 @@ protected function processRules( $value, $rules = null, // @TODO remove `= null` ?array $data = null, // @TODO remove `= null` - ?string $originalField = null + ?string $originalField = null, ): bool { if ($data === null) { throw new InvalidArgumentException('You must supply the parameter: data.'); @@ -368,7 +368,7 @@ protected function processRules( $label, $param, (string) $value, - $originalField + $originalField, ); return false; @@ -805,7 +805,7 @@ protected function fillPlaceholders(array $rules, array $data): array throw new LogicException( 'No validation rules for the placeholder: "' . $field . '". You must set the validation rules for the field.' - . ' See .' + . ' See .', ); } @@ -813,7 +813,7 @@ protected function fillPlaceholders(array $rules, array $data): array foreach ($placeholderRules as $placeholderRule) { if ($this->retrievePlaceholders($placeholderRule, $data) !== []) { throw new LogicException( - 'The placeholder field cannot use placeholder: ' . $field + 'The placeholder field cannot use placeholder: ' . $field, ); } } @@ -868,7 +868,7 @@ public function getError(?string $field = null): string $errors = array_filter( $this->getErrors(), static fn ($key): bool => preg_match(self::getRegex($field), $key) === 1, - ARRAY_FILTER_USE_KEY + ARRAY_FILTER_USE_KEY, ); return $errors === [] ? '' : implode("\n", $errors); @@ -914,7 +914,7 @@ protected function getErrorMessage( ?string $label = null, ?string $param = null, ?string $value = null, - ?string $originalField = null + ?string $originalField = null, ): string { $param ??= ''; diff --git a/system/View/Cells/Cell.php b/system/View/Cells/Cell.php index ddf7ef4ccf63..26eb1d3220f0 100644 --- a/system/View/Cells/Cell.php +++ b/system/View/Cells/Cell.php @@ -97,13 +97,13 @@ final protected function view(?string $view, array $data = []): string $candidateViews = array_filter( [$view, $possibleView1 ?? '', $possibleView2 ?? ''], - static fn (string $path): bool => $path !== '' && is_file($path) + static fn (string $path): bool => $path !== '' && is_file($path), ); if ($candidateViews === []) { throw new LogicException(sprintf( 'Cannot locate the view file for the "%s" cell.', - static::class + static::class, )); } diff --git a/system/View/Parser.php b/system/View/Parser.php index 5990658addad..a2393bb4b7e5 100644 --- a/system/View/Parser.php +++ b/system/View/Parser.php @@ -86,7 +86,7 @@ public function __construct( ?string $viewPath = null, $loader = null, ?bool $debug = null, - ?LoggerInterface $logger = null + ?LoggerInterface $logger = null, ) { // Ensure user plugins override core plugins. $this->plugins = $config->plugins; @@ -329,7 +329,7 @@ protected function parsePair(string $variable, array $data, string $template): a $this->leftDelimiter . '\s*/' . preg_quote($variable, '#') . '\s*' . $this->rightDelimiter . '#us', $template, $matches, - PREG_SET_ORDER + PREG_SET_ORDER, ); /* @@ -484,12 +484,12 @@ protected function parseConditionals(string $template): string $template = preg_replace( '/' . $leftDelimiter . '\s*else\s*' . $rightDelimiter . '/ums', '', - $template + $template, ); $template = preg_replace( '/' . $leftDelimiter . '\s*endif\s*' . $rightDelimiter . '/ums', '', - $template + $template, ); // Parse the PHP itself, or insert an error so they can debug diff --git a/system/View/View.php b/system/View/View.php index 7b6bfea0bba5..5c5d0feff86e 100644 --- a/system/View/View.php +++ b/system/View/View.php @@ -147,7 +147,7 @@ public function __construct( ?string $viewPath = null, ?FileLocatorInterface $loader = null, ?bool $debug = null, - ?LoggerInterface $logger = null + ?LoggerInterface $logger = null, ) { $this->config = $config; $this->viewPath = rtrim($viewPath, '\\/ ') . DIRECTORY_SEPARATOR; @@ -200,7 +200,7 @@ public function render(string $view, ?array $options = null, ?bool $saveData = n $this->logPerformance( $this->renderVars['start'], microtime(true), - $this->renderVars['view'] + $this->renderVars['view'], ); return $output; @@ -213,7 +213,7 @@ public function render(string $view, ?array $options = null, ?bool $saveData = n $this->renderVars['file'] = $this->loader->locateFile( $this->renderVars['view'], 'Views', - ($fileExt === '') ? 'php' : $fileExt + ($fileExt === '') ? 'php' : $fileExt, ); } @@ -257,7 +257,7 @@ public function render(string $view, ?array $options = null, ?bool $saveData = n $this->logPerformance( $this->renderVars['start'], microtime(true), - $this->renderVars['view'] + $this->renderVars['view'], ); // Check if DebugToolbar is enabled. @@ -292,7 +292,7 @@ public function render(string $view, ?array $options = null, ?bool $saveData = n cache()->save( $this->renderVars['cacheName'], $output, - (int) $this->renderVars['options']['cache'] + (int) $this->renderVars['options']['cache'], ); } diff --git a/system/rewrite.php b/system/rewrite.php index aba4560446fc..4f9b79ade95c 100644 --- a/system/rewrite.php +++ b/system/rewrite.php @@ -22,7 +22,7 @@ // @codeCoverageIgnoreStart $uri = urldecode( - parse_url('https://codeigniter.com' . $_SERVER['REQUEST_URI'], PHP_URL_PATH) ?? '' + parse_url('https://codeigniter.com' . $_SERVER['REQUEST_URI'], PHP_URL_PATH) ?? '', ); // All request handle by index.php file. diff --git a/tests/_support/Database/Migrations/20160428212500_Create_test_tables.php b/tests/_support/Database/Migrations/20160428212500_Create_test_tables.php index 434644bef280..8a7cb5b7d11c 100644 --- a/tests/_support/Database/Migrations/20160428212500_Create_test_tables.php +++ b/tests/_support/Database/Migrations/20160428212500_Create_test_tables.php @@ -99,7 +99,7 @@ public function up(): void unset( $dataTypeFields['type_set'], $dataTypeFields['type_mediumtext'], - $dataTypeFields['type_double'] + $dataTypeFields['type_double'], ); } diff --git a/tests/_support/Database/Seeds/CITestSeeder.php b/tests/_support/Database/Seeds/CITestSeeder.php index 45b70a7fdd19..9ce0bce4f1c3 100644 --- a/tests/_support/Database/Seeds/CITestSeeder.php +++ b/tests/_support/Database/Seeds/CITestSeeder.php @@ -151,7 +151,7 @@ public function run(): void $data['type_test'][0]['type_real'], $data['type_test'][0]['type_double'], $data['type_test'][0]['type_decimal'], - $data['type_test'][0]['type_blob'] + $data['type_test'][0]['type_blob'], ); } @@ -166,7 +166,7 @@ public function run(): void $data['type_test'][0]['type_set'], $data['type_test'][0]['type_mediumtext'], $data['type_test'][0]['type_double'], - $data['type_test'][0]['type_blob'] + $data['type_test'][0]['type_blob'], ); } diff --git a/tests/system/API/ResponseTraitTest.php b/tests/system/API/ResponseTraitTest.php index dbdea6a6520d..9613e23fce8e 100644 --- a/tests/system/API/ResponseTraitTest.php +++ b/tests/system/API/ResponseTraitTest.php @@ -92,7 +92,7 @@ private function createRequestAndResponse(string $routePath = '', array $userHea $config, new SiteURI($config, $routePath), null, - new UserAgent() + new UserAgent(), ); $this->response = new MockResponse($config); } @@ -135,7 +135,7 @@ public function testNoFormatterJSON(): void $this->formatter = null; $controller = $this->makeController( '', - ['Accept' => 'application/json'] + ['Accept' => 'application/json'], ); $this->invoke($controller, 'respondCreated', [['id' => 3], 'A Custom Reason']); @@ -156,7 +156,7 @@ public function testNoFormatter(): void $this->formatter = null; $controller = $this->makeController( '', - ['Accept' => 'application/json'] + ['Accept' => 'application/json'], ); $this->invoke($controller, 'respondCreated', ['A Custom Reason']); @@ -187,7 +187,7 @@ public function __construct(protected $request, protected $response, $formatter) $this->assertSame('A Custom Reason', $this->response->getBody()); $this->assertStringStartsWith( 'text/html', - $this->response->getHeaderLine('Content-Type') + $this->response->getHeaderLine('Content-Type'), ); } @@ -279,7 +279,7 @@ public function testRespondSetsCorrectBodyAndStatus(): void $this->assertSame('"something"', $this->response->getBody()); $this->assertStringStartsWith( 'application/json', - $this->response->getHeaderLine('Content-Type') + $this->response->getHeaderLine('Content-Type'), ); $this->assertSame('Created', $this->response->getReasonPhrase()); } @@ -460,7 +460,7 @@ public function testValidationErrors(): void $this->invoke( $controller, 'failValidationErrors', - [['foo' => 'Nope', 'bar' => 'No way'], 'FAT CHANCE', 'A Custom Reason'] + [['foo' => 'Nope', 'bar' => 'No way'], 'FAT CHANCE', 'A Custom Reason'], ); $expected = [ @@ -571,14 +571,14 @@ private function tryValidContentType(string $mimeType, string $contentType): voi $this->assertSame( $mimeType, $this->request->getHeaderLine('Accept'), - 'Request header...' + 'Request header...', ); $this->response->setContentType($contentType); $this->assertSame( $contentType, $this->response->getHeaderLine('Content-Type'), - 'Response header pre-response...' + 'Response header pre-response...', ); $_SERVER = $original; @@ -637,7 +637,7 @@ public function __construct(protected $request, protected $response) $this->assertStringStartsWith( config('Format')->supportedResponseFormats[0], - $response->getHeaderLine('Content-Type') + $response->getHeaderLine('Content-Type'), ); } @@ -651,7 +651,7 @@ public function testResponseFormat(): void $this->assertStringStartsWith( 'application/json', - $this->response->getHeaderLine('Content-Type') + $this->response->getHeaderLine('Content-Type'), ); $this->assertSame($this->formatter->format($data), $this->response->getJSON()); @@ -660,7 +660,7 @@ public function testResponseFormat(): void $this->assertStringStartsWith( 'application/xml', - $this->response->getHeaderLine('Content-Type') + $this->response->getHeaderLine('Content-Type'), ); } diff --git a/tests/system/AutoReview/ComposerJsonTest.php b/tests/system/AutoReview/ComposerJsonTest.php index 995ef99f4f2b..8d4dfefab596 100644 --- a/tests/system/AutoReview/ComposerJsonTest.php +++ b/tests/system/AutoReview/ComposerJsonTest.php @@ -62,7 +62,7 @@ public function testFrameworkRequireDevIsTheSameWithDevRequireDev(): void $dependency, $expectedVersion, $fwRequireDev[$dependency], - clean_path(dirname(__DIR__, 3) . '/admin/framework/composer.json') + clean_path(dirname(__DIR__, 3) . '/admin/framework/composer.json'), )); } } @@ -77,7 +77,7 @@ public function testFrameworkConfigIsTheSameWithDevSuggest(): void $this->checkConfig( $this->devComposer['config'], $this->frameworkComposer['config'], - 'framework' + 'framework', ); } @@ -86,7 +86,7 @@ public function testStarterConfigIsTheSameWithDevSuggest(): void $this->checkConfig( $this->devComposer['config'], $this->starterComposer['config'], - 'starter' + 'starter', ); } @@ -101,7 +101,7 @@ private function checkSection(string $section, string $component): void $this->assertSame( $this->devComposer[$section], $sectionContent, - sprintf('The %s\'s "%s" section is not updated with the main composer.json', strtolower($component), $section) + sprintf('The %s\'s "%s" section is not updated with the main composer.json', strtolower($component), $section), ); } @@ -119,7 +119,7 @@ private function checkConfig(array $fromMain, array $fromComponent, string $comp $this->assertSame($expectedValue, $actualValue, sprintf( '%s\'s value for config property "%s" is not same with the main composer.json\'s config.', ucfirst($component), - $key + $key, )); } } @@ -132,7 +132,7 @@ private function getComposerJson(string $path): array $this->fail(sprintf( 'The composer.json at "%s" is not readable or does not exist. Error was "%s".', clean_path($path), - $e->getMessage() + $e->getMessage(), )); } } diff --git a/tests/system/AutoReview/FrameworkCodeTest.php b/tests/system/AutoReview/FrameworkCodeTest.php index 7473d26e5880..137839b024e5 100644 --- a/tests/system/AutoReview/FrameworkCodeTest.php +++ b/tests/system/AutoReview/FrameworkCodeTest.php @@ -66,7 +66,7 @@ public function testEachTestClassHasCorrectGroupAttributeName(string $class): vo return $groupAttribute->name(); }, $attributes), - self::$recognizedGroupAttributeNames + self::$recognizedGroupAttributeNames, ); $this->assertEmpty($unrecognizedGroups, sprintf( "[%s] Unexpected #[Group] attribute%s:\n%s\nExpected group names to be in \"%s\".", @@ -74,9 +74,9 @@ public function testEachTestClassHasCorrectGroupAttributeName(string $class): vo count($unrecognizedGroups) > 1 ? 's' : '', implode("\n", array_map( static fn (string $group): string => sprintf(' * #[Group(\'%s\')]', $group), - $unrecognizedGroups + $unrecognizedGroups, )), - implode(', ', self::$recognizedGroupAttributeNames) + implode(', ', self::$recognizedGroupAttributeNames), )); } @@ -100,9 +100,9 @@ private static function getTestClasses(): array $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $directory, - FilesystemIterator::SKIP_DOTS + FilesystemIterator::SKIP_DOTS, ), - RecursiveIteratorIterator::CHILD_FIRST + RecursiveIteratorIterator::CHILD_FIRST, ); $testClasses = array_map( @@ -111,32 +111,32 @@ static function (SplFileInfo $file) use ($directory): string { $file->getPathname(), '', 0, - strlen($directory) + strlen($directory), ); $relativePath = substr_replace( $relativePath, '', - strlen($relativePath) - strlen(DIRECTORY_SEPARATOR . $file->getBasename()) + strlen($relativePath) - strlen(DIRECTORY_SEPARATOR . $file->getBasename()), ); return sprintf( 'CodeIgniter\\%s%s%s', strtr($relativePath, DIRECTORY_SEPARATOR, '\\'), $relativePath === '' ? '' : '\\', - $file->getBasename('.' . $file->getExtension()) + $file->getBasename('.' . $file->getExtension()), ); }, array_filter( iterator_to_array($iterator, false), static fn (SplFileInfo $file): bool => $file->isFile() && ! str_contains($file->getPathname(), DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR) - && ! str_contains($file->getPathname(), DIRECTORY_SEPARATOR . 'Views' . DIRECTORY_SEPARATOR) - ) + && ! str_contains($file->getPathname(), DIRECTORY_SEPARATOR . 'Views' . DIRECTORY_SEPARATOR), + ), ); $testClasses = array_filter( $testClasses, - static fn (string $class): bool => is_subclass_of($class, TestCase::class) + static fn (string $class): bool => is_subclass_of($class, TestCase::class), ); sort($testClasses); diff --git a/tests/system/Autoloader/AutoloaderTest.php b/tests/system/Autoloader/AutoloaderTest.php index 19d482890b75..0715dd98b5f8 100644 --- a/tests/system/Autoloader/AutoloaderTest.php +++ b/tests/system/Autoloader/AutoloaderTest.php @@ -202,7 +202,7 @@ public function testAddNamespaceStringToArray(): void $this->assertSame( __FILE__, - ($this->classLoader)('App\Controllers\AutoloaderTest') + ($this->classLoader)('App\Controllers\AutoloaderTest'), ); } @@ -235,7 +235,7 @@ public function testSanitizationContailsSpecialChars(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( - 'The file path contains special characters "${}!#" that are not allowed: "${../path}!#/to/some/file.php_"' + 'The file path contains special characters "${}!#" that are not allowed: "${../path}!#/to/some/file.php_"', ); $test = '${../path}!#/to/some/file.php_'; @@ -247,7 +247,7 @@ public function testSanitizationFilenameEdges(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( - 'The characters ".-_" are not allowed in filename edges: "/path/to/some/file.php_"' + 'The characters ".-_" are not allowed in filename edges: "/path/to/some/file.php_"', ); $test = '/path/to/some/file.php_'; diff --git a/tests/system/Autoloader/FileLocatorTest.php b/tests/system/Autoloader/FileLocatorTest.php index 90580864fc47..fc7925724add 100644 --- a/tests/system/Autoloader/FileLocatorTest.php +++ b/tests/system/Autoloader/FileLocatorTest.php @@ -218,7 +218,7 @@ public function testSearchPrioritizeSystemOverApp(): void SYSTEMPATH . 'Language/en/Validation.php', APPPATH . 'Language/en/Validation.php', ], - $foundFiles + $foundFiles, ); } @@ -243,7 +243,7 @@ public function testListFilesDoesNotContainDirectories(): void $directory = str_replace( '/', DIRECTORY_SEPARATOR, - APPPATH . 'Config/Boot' + APPPATH . 'Config/Boot', ); $this->assertNotContains($directory, $files); } @@ -308,7 +308,7 @@ public function testGetClassNameFromClassFile(): void { $this->assertSame( self::class, - $this->locator->getClassname(__FILE__) + $this->locator->getClassname(__FILE__), ); } @@ -316,7 +316,7 @@ public function testGetClassNameFromNonClassFile(): void { $this->assertSame( '', - $this->locator->getClassname(SYSTEMPATH . 'bootstrap.php') + $this->locator->getClassname(SYSTEMPATH . 'bootstrap.php'), ); } @@ -324,7 +324,7 @@ public function testGetClassNameFromDirectory(): void { $this->assertSame( '', - $this->locator->getClassname(SYSTEMPATH) + $this->locator->getClassname(SYSTEMPATH), ); } } diff --git a/tests/system/CLI/CLITest.php b/tests/system/CLI/CLITest.php index 413fd71c85f4..7ee9279afe22 100644 --- a/tests/system/CLI/CLITest.php +++ b/tests/system/CLI/CLITest.php @@ -283,7 +283,7 @@ public function testColor(): void $this->assertSame( "\033[1;37m\033[42m\033[4mtest\033[0m", - CLI::color('test', 'white', 'green', 'underline') + CLI::color('test', 'white', 'green', 'underline'), ); } @@ -291,7 +291,7 @@ public function testColorEmtpyString(): void { $this->assertSame( '', - CLI::color('', 'white', 'green', 'underline') + CLI::color('', 'white', 'green', 'underline'), ); } @@ -358,7 +358,7 @@ public function testWriteForegroundWithColorTwice(): void { CLI::write( CLI::color('green', 'green') . ' red ' . CLI::color('green', 'green'), - 'red' + 'red', ); $expected = "\033[0;32mgreen\033[0m\033[0;31m red \033[0m\033[0;32mgreen\033[0m" . PHP_EOL; @@ -440,15 +440,15 @@ public function testWrap(): void $this->assertSame('', CLI::wrap('')); $this->assertSame( '1234' . PHP_EOL . ' 5678' . PHP_EOL . ' 90' . PHP_EOL . ' abc' . PHP_EOL . ' de' . PHP_EOL . ' fghij' . PHP_EOL . ' 0987654321', - CLI::wrap('1234 5678 90' . PHP_EOL . 'abc de fghij' . PHP_EOL . '0987654321', 5, 1) + CLI::wrap('1234 5678 90' . PHP_EOL . 'abc de fghij' . PHP_EOL . '0987654321', 5, 1), ); $this->assertSame( '1234 5678 90' . PHP_EOL . ' abc de fghij' . PHP_EOL . ' 0987654321', - CLI::wrap('1234 5678 90' . PHP_EOL . 'abc de fghij' . PHP_EOL . '0987654321', 999, 2) + CLI::wrap('1234 5678 90' . PHP_EOL . 'abc de fghij' . PHP_EOL . '0987654321', 999, 2), ); $this->assertSame( '1234 5678 90' . PHP_EOL . 'abc de fghij' . PHP_EOL . '0987654321', - CLI::wrap('1234 5678 90' . PHP_EOL . 'abc de fghij' . PHP_EOL . '0987654321') + CLI::wrap('1234 5678 90' . PHP_EOL . 'abc de fghij' . PHP_EOL . '0987654321'), ); } diff --git a/tests/system/CLI/ConsoleTest.php b/tests/system/CLI/ConsoleTest.php index c6773a07894f..5962f3a9b21e 100644 --- a/tests/system/CLI/ConsoleTest.php +++ b/tests/system/CLI/ConsoleTest.php @@ -54,8 +54,8 @@ public function testHeader(): void 0, strpos( $this->getStreamFilterBuffer(), - sprintf('CodeIgniter v%s Command Line Tool', CodeIgniter::CI_VERSION) - ) + sprintf('CodeIgniter v%s Command Line Tool', CodeIgniter::CI_VERSION), + ), ); } @@ -143,7 +143,7 @@ public function testHelpCommandUsingHelpOption(): void $this->assertStringContainsString('env []', $this->getStreamFilterBuffer()); $this->assertStringContainsString( 'Retrieves the current environment, or set a new one.', - $this->getStreamFilterBuffer() + $this->getStreamFilterBuffer(), ); } diff --git a/tests/system/Cache/ResponseCacheTest.php b/tests/system/Cache/ResponseCacheTest.php index b0b73855231a..734221114185 100644 --- a/tests/system/Cache/ResponseCacheTest.php +++ b/tests/system/Cache/ResponseCacheTest.php @@ -46,7 +46,7 @@ protected function setUp(): void private function createIncomingRequest( string $uri = '', array $query = [], - ?AppConfig $appConfig = null + ?AppConfig $appConfig = null, ): IncomingRequest { $_POST = $_GET = $_SERVER = $_REQUEST = $_ENV = $_COOKIE = $_SESSION = []; @@ -65,7 +65,7 @@ private function createIncomingRequest( $appConfig, $siteUri, null, - new UserAgent() + new UserAgent(), ); } diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php index afddc7dbb30e..2dec61da4be3 100644 --- a/tests/system/CodeIgniterTest.php +++ b/tests/system/CodeIgniterTest.php @@ -214,7 +214,7 @@ public function testControllersCanReturnString(): void $routes = service('routes'); $routes->add( 'pages/(:segment)', - static fn ($segment): string => 'You want to see "' . esc($segment) . '" page.' + static fn ($segment): string => 'You want to see "' . esc($segment) . '" page.', ); $router = service('router', $routes, service('incomingrequest')); Services::injectMock('router', $router); @@ -293,7 +293,7 @@ public function testRunExecuteFilterByClassName(): void $routes->add( 'pages/about', static fn () => service('incomingrequest')->getBody(), - ['filter' => Customfilter::class] + ['filter' => Customfilter::class], ); $router = service('router', $routes, service('incomingrequest')); @@ -324,7 +324,7 @@ public function testRegisterSameFilterTwiceWithDifferentArgument(): void 'pages/about', static fn () => service('incomingrequest')->getBody(), // Set filter with no argument. - ['filter' => 'test-customfilter'] + ['filter' => 'test-customfilter'], ); $router = service('router', $routes, service('incomingrequest')); @@ -358,7 +358,7 @@ public function testDisableControllerFilters(): void $routes->add( 'pages/about', static fn () => service('incomingrequest')->getBody(), - ['filter' => Customfilter::class] + ['filter' => Customfilter::class], ); $router = service('router', $routes, service('incomingrequest')); Services::injectMock('router', $router); @@ -843,7 +843,7 @@ public function testPageCacheSendSecureHeaders(): void public function testPageCacheWithCacheQueryString( $cacheQueryStringValue, int $expectedPagesInCache, - array $testingUrls + array $testingUrls, ): void { // Suppress command() output CITestStreamFilter::registration(); diff --git a/tests/system/Commands/Database/MigrateStatusTest.php b/tests/system/Commands/Database/MigrateStatusTest.php index 5e54b380fdee..b08557790de0 100644 --- a/tests/system/Commands/Database/MigrateStatusTest.php +++ b/tests/system/Commands/Database/MigrateStatusTest.php @@ -51,7 +51,7 @@ protected function setUp(): void $contents = str_replace( 'namespace Tests\Support\MigrationTestMigrations\Database\Migrations;', 'namespace App\Database\Migrations;', - $contents + $contents, ); file_put_contents($this->migrationFileTo, $contents); diff --git a/tests/system/Commands/EnvironmentCommandTest.php b/tests/system/Commands/EnvironmentCommandTest.php index 177becf34f9f..8bab8db12cc0 100644 --- a/tests/system/Commands/EnvironmentCommandTest.php +++ b/tests/system/Commands/EnvironmentCommandTest.php @@ -64,7 +64,7 @@ public function testProvidingTestingAsEnvGivesErrorMessage(): void command('env testing'); $this->assertStringContainsString( 'The "testing" environment is reserved for PHPUnit testing.', - $this->getStreamFilterBuffer() + $this->getStreamFilterBuffer(), ); } @@ -83,7 +83,7 @@ public function testDefaultShippedEnvIsMissing(): void $this->assertStringContainsString('Both default shipped', $this->getStreamFilterBuffer()); $this->assertStringContainsString( 'It is impossible to write the new environment type.', - $this->getStreamFilterBuffer() + $this->getStreamFilterBuffer(), ); } diff --git a/tests/system/Commands/FilterCheckTest.php b/tests/system/Commands/FilterCheckTest.php index 0c26dd9bf349..9062f99bd88c 100644 --- a/tests/system/Commands/FilterCheckTest.php +++ b/tests/system/Commands/FilterCheckTest.php @@ -48,7 +48,7 @@ public function testFilterCheckDefinedRoute(): void $this->assertStringContainsString( '| GET | / | forcehttps pagecache | pagecache performance toolbar |', - preg_replace('/\033\[.+?m/u', '', $this->getBuffer()) + preg_replace('/\033\[.+?m/u', '', $this->getBuffer()), ); } @@ -61,8 +61,8 @@ public function testFilterCheckInvalidRoute(): void str_replace( ["\033[0m", "\033[1;31m", "\033[0;30m", "\033[47m"], '', - $this->getBuffer() - ) + $this->getBuffer(), + ), ); } } diff --git a/tests/system/Commands/GenerateKeyTest.php b/tests/system/Commands/GenerateKeyTest.php index 40df8d1477c3..01e2b2c750df 100644 --- a/tests/system/Commands/GenerateKeyTest.php +++ b/tests/system/Commands/GenerateKeyTest.php @@ -137,7 +137,7 @@ public function testKeyGenerateWhenNewHexKeyIsSubsequentlyCommentedOut(): void 'encryption.key = ' . $key, '# encryption.key = ' . $key, file_get_contents($this->envPath), - $count + $count, )); $this->assertSame(1, $count, 'Failed commenting out the previously set application key.'); @@ -155,7 +155,7 @@ public function testKeyGenerateWhenNewBase64KeyIsSubsequentlyCommentedOut(): voi 'encryption.key = ' . $key, '# encryption.key = ' . $key, file_get_contents($this->envPath), - $count + $count, )); $this->assertSame(1, $count, 'Failed commenting out the previously set application key.'); diff --git a/tests/system/Commands/MigrationIntegrationTest.php b/tests/system/Commands/MigrationIntegrationTest.php index 14b66ccb920a..12869f9092c6 100644 --- a/tests/system/Commands/MigrationIntegrationTest.php +++ b/tests/system/Commands/MigrationIntegrationTest.php @@ -61,7 +61,7 @@ public function testMigrationWithRollbackHasSameNameFormat(): void command('migrate -n App'); $this->assertStringContainsString( '(App) 20160428212500_App\Database\Migrations\Migration_Create_test_tables', - $this->getStreamFilterBuffer() + $this->getStreamFilterBuffer(), ); $this->resetStreamFilterBuffer(); @@ -69,7 +69,7 @@ public function testMigrationWithRollbackHasSameNameFormat(): void command('migrate:rollback -n App'); $this->assertStringContainsString( '(App) 20160428212500_App\Database\Migrations\Migration_Create_test_tables', - $this->getStreamFilterBuffer() + $this->getStreamFilterBuffer(), ); } } diff --git a/tests/system/Commands/RoutesTest.php b/tests/system/Commands/RoutesTest.php index 7859156ccf93..a94ddbe2081c 100644 --- a/tests/system/Commands/RoutesTest.php +++ b/tests/system/Commands/RoutesTest.php @@ -85,7 +85,7 @@ public function testRoutesCommand(): void EOL; $this->assertStringContainsString( $expected, - preg_replace('/\033\[.+?m/u', '', $this->getBuffer()) + preg_replace('/\033\[.+?m/u', '', $this->getBuffer()), ); } diff --git a/tests/system/Commands/Utilities/ConfigCheckTest.php b/tests/system/Commands/Utilities/ConfigCheckTest.php index c69cfa948635..e49a8170ec08 100644 --- a/tests/system/Commands/Utilities/ConfigCheckTest.php +++ b/tests/system/Commands/Utilities/ConfigCheckTest.php @@ -73,7 +73,7 @@ public function testCommandConfigCheckWithNoArgumentPassed(): void config:check 'CodeIgniter\Shield\Config\Auth' EOF, - str_replace("\n\n", "\n", $this->getStreamFilterBuffer()) + str_replace("\n\n", "\n", $this->getStreamFilterBuffer()), ); } @@ -83,7 +83,7 @@ public function testCommandConfigCheckNonexistentClass(): void $this->assertSame( "No such Config class: Nonexistent\n", - $this->getStreamFilterBuffer() + $this->getStreamFilterBuffer(), ); } @@ -92,14 +92,14 @@ public function testConfigCheckWithKintEnabledUsesKintD(): void /** @var Closure(object): string $command */ $command = $this->getPrivateMethodInvoker( new ConfigCheck(service('logger'), service('commands')), - 'getKintD' + 'getKintD', ); command('config:check App'); $this->assertSame( $command(config('App')) . "\n", - preg_replace('/\s+Config Caching: \S+/', '', $this->getStreamFilterBuffer()) + preg_replace('/\s+Config Caching: \S+/', '', $this->getStreamFilterBuffer()), ); } @@ -108,12 +108,12 @@ public function testConfigCheckWithKintDisabledUsesVarDump(): void /** @var Closure(object): string $command */ $command = $this->getPrivateMethodInvoker( new ConfigCheck(service('logger'), service('commands')), - 'getVarDump' + 'getVarDump', ); $clean = static fn (string $input): string => trim(preg_replace( '/(\033\[[0-9;]+m)|(\035\[[0-9;]+m)/u', '', - $input + $input, )); try { @@ -122,7 +122,7 @@ public function testConfigCheckWithKintDisabledUsesVarDump(): void $this->assertSame( $clean($command(config('App'))), - $clean(preg_replace('/\s+Config Caching: \S+/', '', $this->getStreamFilterBuffer())) + $clean(preg_replace('/\s+Config Caching: \S+/', '', $this->getStreamFilterBuffer())), ); } finally { Kint::$enabled_mode = true; diff --git a/tests/system/Commands/Utilities/NamespacesTest.php b/tests/system/Commands/Utilities/NamespacesTest.php index ffdfa0ddcf8d..d2395fda891c 100644 --- a/tests/system/Commands/Utilities/NamespacesTest.php +++ b/tests/system/Commands/Utilities/NamespacesTest.php @@ -73,15 +73,15 @@ public function testNamespacesCommandAllNamespaces(): void $this->assertStringContainsString( '|CodeIgniter|ROOTPATH/system|Yes|', - str_replace(' ', '', $this->getBuffer()) + str_replace(' ', '', $this->getBuffer()), ); $this->assertStringContainsString( '|App|ROOTPATH/app|Yes|', - str_replace(' ', '', $this->getBuffer()) + str_replace(' ', '', $this->getBuffer()), ); $this->assertStringContainsString( '|Config|APPPATH/Config|Yes|', - str_replace(' ', '', $this->getBuffer()) + str_replace(' ', '', $this->getBuffer()), ); } } diff --git a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php index 936b2b8fe184..33df69e6531e 100644 --- a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php +++ b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php @@ -30,7 +30,7 @@ final class ControllerMethodReaderTest extends CIUnitTestCase { private function createControllerMethodReader( - string $namespace = 'Tests\Support\Controllers' + string $namespace = 'Tests\Support\Controllers', ): ControllerMethodReader { $methods = [ 'get', @@ -79,7 +79,7 @@ public function testReadTranslateURIDashes(): void Factories::injectMock('config', Routing::class, $config); $reader = $this->createControllerMethodReader( - 'CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved\Controllers' + 'CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved\Controllers', ); $routes = $reader->read(Dash_controller::class); @@ -116,7 +116,7 @@ public function testReadTranslateUriToCamelCase(): void Factories::injectMock('config', Routing::class, $config); $reader = $this->createControllerMethodReader( - 'CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved\Controllers' + 'CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved\Controllers', ); $routes = $reader->read(BlogController::class); @@ -147,7 +147,7 @@ public function testReadTranslateUriToCamelCase(): void public function testReadDefaultController(): void { $reader = $this->createControllerMethodReader( - 'CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved\Controllers' + 'CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved\Controllers', ); $routes = $reader->read(Home::class); diff --git a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php index 6b5c10e45ea0..1d67afae1ce4 100644 --- a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php +++ b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php @@ -51,7 +51,7 @@ public function testGetFromPlaceholderCustomPlaceholder(): void $routes = service('routes'); $routes->addPlaceholder( 'uuid', - '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' + '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}', ); $generator = new SampleURIGenerator(); diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php index deef63d79821..ab13ac06ddb0 100644 --- a/tests/system/CommonFunctionsTest.php +++ b/tests/system/CommonFunctionsTest.php @@ -338,7 +338,7 @@ public function testRouteToInCliWithLocaleInRoute(): void $this->assertSame( '/en/path/string/to/13', - route_to('path-to', 'string', 13, 'en') + route_to('path-to', 'string', 13, 'en'), ); } @@ -352,7 +352,7 @@ public function testRouteToWithUnsupportedLocale(): void $this->assertSame( '/en/path/string/to/13', - route_to('path-to', 'string', 13, 'invalid') + route_to('path-to', 'string', 13, 'invalid'), ); } @@ -642,7 +642,7 @@ public function testForceHttpsNullRequestAndResponse(): void $this->assertInstanceOf(RedirectException::class, $e); $this->assertSame( 'https://example.com/index.php/', - $e->getResponse()->header('Location')->getValue() + $e->getResponse()->header('Location')->getValue(), ); $this->assertFalse($e->getResponse()->hasCookie('force')); $this->assertSame('header', $e->getResponse()->getHeaderLine('Force')); @@ -668,7 +668,7 @@ public function testForceHttpsWithBaseUrlSubFolder(): void $this->assertInstanceOf(RedirectException::class, $e); $this->assertSame( 'https://example.jp/codeIgniter/index.php/en/home?foo=bar', - $e->getResponse()->header('Location')->getValue() + $e->getResponse()->header('Location')->getValue(), ); } } diff --git a/tests/system/CommonHelperTest.php b/tests/system/CommonHelperTest.php index 2b614b316572..83546e973be7 100644 --- a/tests/system/CommonHelperTest.php +++ b/tests/system/CommonHelperTest.php @@ -129,7 +129,7 @@ public function testHelperLoadsAppHelperFirst(): void foreach ($this->dummyHelpers as $helper) { $this->assertFileDoesNotExist($helper, sprintf( 'The dummy helper file "%s" should not be existing before it is tested.', - $helper + $helper, )); } diff --git a/tests/system/Config/FactoriesTest.php b/tests/system/Config/FactoriesTest.php index 11a5e77a433e..4a73c7805b93 100644 --- a/tests/system/Config/FactoriesTest.php +++ b/tests/system/Config/FactoriesTest.php @@ -338,18 +338,18 @@ public function testDefineSameAliasTwiceWithDifferentClasses(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( - 'Already defined in Factories: models CodeIgniter\Shield\Models\UserModel -> Tests\Support\Models\UserModel' + 'Already defined in Factories: models CodeIgniter\Shield\Models\UserModel -> Tests\Support\Models\UserModel', ); Factories::define( 'models', 'CodeIgniter\Shield\Models\UserModel', - UserModel::class + UserModel::class, ); Factories::define( 'models', 'CodeIgniter\Shield\Models\UserModel', - EntityModel::class + EntityModel::class, ); } @@ -358,12 +358,12 @@ public function testDefineSameAliasAndSameClassTwice(): void Factories::define( 'models', 'CodeIgniter\Shield\Models\UserModel', - UserModel::class + UserModel::class, ); Factories::define( 'models', 'CodeIgniter\Shield\Models\UserModel', - UserModel::class + UserModel::class, ); $model = model('CodeIgniter\Shield\Models\UserModel'); @@ -379,7 +379,7 @@ public function testDefineNonExistentClass(): void Factories::define( 'models', 'CodeIgniter\Shield\Models\UserModel', - 'App\Models\UserModel' + 'App\Models\UserModel', ); } @@ -387,7 +387,7 @@ public function testDefineAfterLoading(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( - 'Already defined in Factories: models Tests\Support\Models\UserModel -> Tests\Support\Models\UserModel' + 'Already defined in Factories: models Tests\Support\Models\UserModel -> Tests\Support\Models\UserModel', ); model(UserModel::class); @@ -395,7 +395,7 @@ public function testDefineAfterLoading(): void Factories::define( 'models', UserModel::class, - 'App\Models\UserModel' + 'App\Models\UserModel', ); } @@ -404,7 +404,7 @@ public function testDefineAndLoad(): void Factories::define( 'models', UserModel::class, - EntityModel::class + EntityModel::class, ); $model = model(UserModel::class); @@ -417,7 +417,7 @@ public function testDefineAndGet(): void Factories::define( 'models', UserModel::class, - EntityModel::class + EntityModel::class, ); $model = Factories::get('models', UserModel::class); diff --git a/tests/system/ControllerTest.php b/tests/system/ControllerTest.php index 55664c42c779..733705725258 100644 --- a/tests/system/ControllerTest.php +++ b/tests/system/ControllerTest.php @@ -195,7 +195,7 @@ public function testValidateData(): void $this->assertFalse($method($data, $rule)); $this->assertSame( 'The password field must be at least 10 characters in length.', - service('validation')->getError('password') + service('validation')->getError('password'), ); } @@ -224,11 +224,11 @@ public function testValidateDataWithCustomErrorMessage(): void $this->assertFalse($method($data, $rules, $errors)); $this->assertSame( '"username" must be 3 letters or longer.', - service('validation')->getError('username') + service('validation')->getError('username'), ); $this->assertSame( 'The password field must be at least 10 characters in length.', - service('validation')->getError('password') + service('validation')->getError('password'), ); } @@ -262,11 +262,11 @@ public function testValidateDataWithCustomErrorMessageLabeledStyle(): void $this->assertFalse($method($data, $rules)); $this->assertSame( '"Username" must be 3 letters or longer.', - service('validation')->getError('username') + service('validation')->getError('username'), ); $this->assertSame( 'The Password field must be at least 10 characters in length.', - service('validation')->getError('password') + service('validation')->getError('password'), ); } diff --git a/tests/system/Cookie/CookieTest.php b/tests/system/Cookie/CookieTest.php index f51ce668961f..e3907e8cefe7 100644 --- a/tests/system/Cookie/CookieTest.php +++ b/tests/system/Cookie/CookieTest.php @@ -93,7 +93,7 @@ public function testConfigPrefix(string $configPrefix, string $optionPrefix, str 'value', [ 'prefix' => $optionPrefix, - ] + ], ); $this->assertSame($expected, $cookie->getPrefixedName()); @@ -271,19 +271,19 @@ public function testStringCastingOfCookies(): void $this->assertSame( 'cookie=lover; Path=/; HttpOnly; SameSite=Lax', - $a->toHeaderString() + $a->toHeaderString(), ); $this->assertSame( "cookie=monster; Expires=Sun, 14-Feb-2021 00:00:00 GMT; Max-Age={$max}; Path=/web; Domain=localhost; HttpOnly; SameSite=Lax", - (string) $b + (string) $b, ); $this->assertSame( 'cookie=lover; Path=/; Secure; SameSite=Strict', - (string) $c + (string) $c, ); $this->assertSame( 'cookie=deleted; Expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/; HttpOnly; SameSite=Lax', - (string) $d + (string) $d, ); Cookie::setDefaults($old); diff --git a/tests/system/DataConverter/DataConverterTest.php b/tests/system/DataConverter/DataConverterTest.php index c57e8593af86..3bdfa2f51ea8 100644 --- a/tests/system/DataConverter/DataConverterTest.php +++ b/tests/system/DataConverter/DataConverterTest.php @@ -471,7 +471,7 @@ public function testInvalidValue(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( - '[CodeIgniter\DataCaster\Cast\JsonCast] Invalid value type: bool, and its value: true' + '[CodeIgniter\DataCaster\Cast\JsonCast] Invalid value type: bool, and its value: true', ); $types = [ @@ -491,7 +491,7 @@ public function testInvalidCastHandler(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( - 'Invalid class type. It must implement CastInterface. class: CodeIgniter\DataConverter\DataConverter' + 'Invalid class type. It must implement CastInterface. class: CodeIgniter\DataConverter\DataConverter', ); $types = [ @@ -530,7 +530,7 @@ private function createDataConverter( array $handlers = [], ?object $helper = null, Closure|string|null $reconstructor = 'reconstruct', - Closure|string|null $extractor = null + Closure|string|null $extractor = null, ): DataConverter { return new DataConverter($types, $handlers, $helper, $reconstructor, $extractor); } diff --git a/tests/system/Database/BaseConnectionTest.php b/tests/system/Database/BaseConnectionTest.php index b36ec7ea022a..ba55129cc723 100644 --- a/tests/system/Database/BaseConnectionTest.php +++ b/tests/system/Database/BaseConnectionTest.php @@ -188,7 +188,7 @@ public function testProtectIdentifiers( bool $protectIdentifiers, bool $fieldExists, string $item, - string $expected + string $expected, ): void { $db = new MockConnection($this->options); diff --git a/tests/system/Database/BaseQueryTest.php b/tests/system/Database/BaseQueryTest.php index a87bc64e727a..3c48e2526652 100644 --- a/tests/system/Database/BaseQueryTest.php +++ b/tests/system/Database/BaseQueryTest.php @@ -251,7 +251,7 @@ public function testBindingWithTwoColons(): void $query->setQuery( "SELECT mytable.id, DATE_FORMAT(mytable.created_at,'%d/%m/%Y %H:%i:%s') AS created_at_uk FROM mytable WHERE mytable.id = ?", - [1] + [1], ); $expected = "SELECT mytable.id, DATE_FORMAT(mytable.created_at,'%d/%m/%Y %H:%i:%s') AS created_at_uk FROM mytable WHERE mytable.id = 1"; @@ -326,7 +326,7 @@ public function testNamedBindsDontGetReplacedAgain(): void $query->setQuery( 'SELECT * FROM posts WHERE content = :content: OR foobar = :foobar:', - ['content' => 'a placeholder looks like :foobar:', 'foobar' => 'bazqux'] + ['content' => 'a placeholder looks like :foobar:', 'foobar' => 'bazqux'], ); $expected = "SELECT * FROM posts WHERE content = 'a placeholder looks like :foobar:' OR foobar = 'bazqux'"; @@ -381,7 +381,7 @@ public function testSetQueryBindsWithSetEscapeNegativeIntegers(): void $query->setQuery( 'SELECT * FROM product WHERE date_pickup < DateAdd(month, ?, Convert(date, GetDate())', [-6], - true + true, ); $expected = 'SELECT * FROM product WHERE date_pickup < DateAdd(month, -6, Convert(date, GetDate())'; @@ -395,7 +395,7 @@ public function testSetQueryNamedBindsWithNegativeIntegers(): void $query->setQuery( 'SELECT * FROM product WHERE date_pickup < DateAdd(month, :num:, Convert(date, GetDate())', - ['num' => -6] + ['num' => -6], ); $expected = 'SELECT * FROM product WHERE date_pickup < DateAdd(month, -6, Convert(date, GetDate())'; diff --git a/tests/system/Database/Builder/InsertTest.php b/tests/system/Database/Builder/InsertTest.php index e021472b72fc..a0a233440a2d 100644 --- a/tests/system/Database/Builder/InsertTest.php +++ b/tests/system/Database/Builder/InsertTest.php @@ -287,7 +287,7 @@ public function testSetIncorrectRawSqlUsage(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( - 'RawSql "expires = DATE_ADD(NOW(), INTERVAL 2 HOUR)" cannot be used here.' + 'RawSql "expires = DATE_ADD(NOW(), INTERVAL 2 HOUR)" cannot be used here.', ); $builder = $this->db->table('auth_bearer'); diff --git a/tests/system/Database/Builder/JoinTest.php b/tests/system/Database/Builder/JoinTest.php index 377df4816e57..04145671e7df 100644 --- a/tests/system/Database/Builder/JoinTest.php +++ b/tests/system/Database/Builder/JoinTest.php @@ -90,7 +90,7 @@ public function testJoinMultipleConditionsBetween(): void $builder->join( 'leases', 'units.unit_id = leases.unit_id AND CURDATE() BETWEEN lease_start_date AND lease_exp_date', - 'LEFT' + 'LEFT', ); // @TODO Should be `... CURDATE() BETWEEN "lease_start_date" AND "lease_exp_date"` diff --git a/tests/system/Database/Builder/SelectTest.php b/tests/system/Database/Builder/SelectTest.php index 7a1027bc62ce..57aa7eaf37ff 100644 --- a/tests/system/Database/Builder/SelectTest.php +++ b/tests/system/Database/Builder/SelectTest.php @@ -220,7 +220,7 @@ public function testSelectRegularExpressionWorksWithEscpaeFalse(): void $builder->select( 'REGEXP_SUBSTR(ral_anno,"[0-9]{1,2}([,.][0-9]{1,3})([,.][0-9]{1,3})") AS ral', - false + false, ); $expected = <<<'SQL' @@ -405,7 +405,7 @@ public function testSelectResetQuery(): void $sql = $builder->getCompiledSelect(); $this->assertSame( 'SELECT * FROM "users"', - str_replace("\n", ' ', $sql) + str_replace("\n", ' ', $sql), ); } } diff --git a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php index c3e744749909..d6cb6b503adb 100644 --- a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php +++ b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php @@ -69,7 +69,7 @@ protected function setUpAddNamespace(): void { service('autoloader')->addNamespace( 'Tests\Support\MigrationTestMigrations', - SUPPORTPATH . 'MigrationTestMigrations' + SUPPORTPATH . 'MigrationTestMigrations', ); } diff --git a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php index 7820b83c06c7..b485093438ce 100644 --- a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php +++ b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php @@ -69,7 +69,7 @@ protected function setUpAddNamespace(): void { service('autoloader')->addNamespace( 'Tests\Support\MigrationTestMigrations', - SUPPORTPATH . 'MigrationTestMigrations' + SUPPORTPATH . 'MigrationTestMigrations', ); } diff --git a/tests/system/Database/DatabaseTestCaseTest.php b/tests/system/Database/DatabaseTestCaseTest.php index 76867e852e23..b41aba3b76a7 100644 --- a/tests/system/Database/DatabaseTestCaseTest.php +++ b/tests/system/Database/DatabaseTestCaseTest.php @@ -74,7 +74,7 @@ protected function setUpAddNamespace(): void { service('autoloader')->addNamespace( 'Tests\Support\MigrationTestMigrations', - SUPPORTPATH . 'MigrationTestMigrations' + SUPPORTPATH . 'MigrationTestMigrations', ); } diff --git a/tests/system/Database/Live/AbstractGetFieldDataTestCase.php b/tests/system/Database/Live/AbstractGetFieldDataTestCase.php index 011564992922..4749fabd9de7 100644 --- a/tests/system/Database/Live/AbstractGetFieldDataTestCase.php +++ b/tests/system/Database/Live/AbstractGetFieldDataTestCase.php @@ -138,7 +138,7 @@ protected function createTableForType(): void $fields['type_enum'], $fields['type_set'], $fields['type_mediumtext'], - $fields['type_double'] + $fields['type_double'], ); } @@ -146,7 +146,7 @@ protected function createTableForType(): void unset( $fields['type_set'], $fields['type_mediumtext'], - $fields['type_double'] + $fields['type_double'], ); } diff --git a/tests/system/Database/Live/DbUtilsTest.php b/tests/system/Database/Live/DbUtilsTest.php index b7fd56923334..e20a32d8bed2 100644 --- a/tests/system/Database/Live/DbUtilsTest.php +++ b/tests/system/Database/Live/DbUtilsTest.php @@ -102,7 +102,7 @@ public function testUtilsOptimizeDatabase(): void if ($this->db->DBDriver === 'OCI8') { $this->markTestSkipped( - 'Unsupported feature of the oracle database platform.' + 'Unsupported feature of the oracle database platform.', ); } @@ -146,7 +146,7 @@ public function testUtilsOptimizeTable(): void if ($this->db->DBDriver === 'OCI8') { $this->markTestSkipped( - 'Unsupported feature of the oracle database platform.' + 'Unsupported feature of the oracle database platform.', ); } diff --git a/tests/system/Database/Live/DeleteTest.php b/tests/system/Database/Live/DeleteTest.php index 421f5c0f430f..896ab12c1d39 100644 --- a/tests/system/Database/Live/DeleteTest.php +++ b/tests/system/Database/Live/DeleteTest.php @@ -134,15 +134,15 @@ public function testDeleteBatchConstraintsDate(): void $this->dontSeeInDatabase( $table, - ['type_date' => '2023-12-01', 'type_varchar' => 'test1'] + ['type_date' => '2023-12-01', 'type_varchar' => 'test1'], ); $this->dontSeeInDatabase( $table, - ['type_date' => '2023-12-02', 'type_varchar' => 'test2'] + ['type_date' => '2023-12-02', 'type_varchar' => 'test2'], ); $this->seeInDatabase( $table, - ['type_date' => '2023-12-03', 'type_varchar' => 'test3'] + ['type_date' => '2023-12-03', 'type_varchar' => 'test3'], ); } diff --git a/tests/system/Database/Live/ForgeTest.php b/tests/system/Database/Live/ForgeTest.php index 0ab672e72067..d7352480aad3 100644 --- a/tests/system/Database/Live/ForgeTest.php +++ b/tests/system/Database/Live/ForgeTest.php @@ -1457,7 +1457,7 @@ private function getMetaData(string $column, string $table): stdClass $name = array_search( $column, array_column($fields, 'name'), - true + true, ); if ($name === false) { @@ -1707,7 +1707,7 @@ public function testProcessIndexes(): void $indexes = array_filter( $allIndexes, static fn ($index): bool => ($index->name === 'db_actions_name') - && ($index->fields === [0 => 'name']) + && ($index->fields === [0 => 'name']), ); $this->assertCount(1, $indexes); @@ -1715,14 +1715,14 @@ public function testProcessIndexes(): void $indexes = array_filter( $allIndexes, static fn ($index): bool => ($index->name === 'db_actions_category_name') - && ($index->fields === [0 => 'category', 1 => 'name']) + && ($index->fields === [0 => 'category', 1 => 'name']), ); $this->assertCount(1, $indexes); // check that the primary key exists $indexes = array_filter( $allIndexes, - static fn ($index): bool => $index->type === 'PRIMARY' + static fn ($index): bool => $index->type === 'PRIMARY', ); $this->assertCount(1, $indexes); @@ -1755,7 +1755,7 @@ public function testProcessIndexesWithKeyOnly(): void $indexes = array_filter( $allIndexes, static fn ($index): bool => ($index->name === 'db_actions_name') - && ($index->fields === [0 => 'name']) + && ($index->fields === [0 => 'name']), ); $this->assertCount(1, $indexes); @@ -1780,7 +1780,7 @@ public function testProcessIndexesWithPrimaryKeyOnly(): void // check that the primary key exists $indexes = array_filter( $allIndexes, - static fn ($index): bool => $index->type === 'PRIMARY' + static fn ($index): bool => $index->type === 'PRIMARY', ); $this->assertCount(1, $indexes); diff --git a/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php b/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php index 2ff1f103fb33..477bebe50113 100644 --- a/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php @@ -41,7 +41,7 @@ private function getFieldMetaData(string $column, string $table): stdClass $name = array_search( $column, array_column($fields, 'name'), - true + true, ); if ($name === false) { diff --git a/tests/system/Database/Live/Postgre/ConnectTest.php b/tests/system/Database/Live/Postgre/ConnectTest.php index 29de0976eb21..d616a60b968c 100644 --- a/tests/system/Database/Live/Postgre/ConnectTest.php +++ b/tests/system/Database/Live/Postgre/ConnectTest.php @@ -40,7 +40,7 @@ public function testShowErrorMessageWhenSettingInvalidCharset(): void $this->expectException(DatabaseException::class); $this->expectExceptionMessage( 'Unable to connect to the database. -Main connection [Postgre]: ERROR: invalid value for parameter "client_encoding": "utf8mb4"' +Main connection [Postgre]: ERROR: invalid value for parameter "client_encoding": "utf8mb4"', ); $config = config('Database'); diff --git a/tests/system/Database/Live/UpdateTest.php b/tests/system/Database/Live/UpdateTest.php index 565c8f83b909..64a84ad03242 100644 --- a/tests/system/Database/Live/UpdateTest.php +++ b/tests/system/Database/Live/UpdateTest.php @@ -443,7 +443,7 @@ public function testUpdateBatchConstraintsRawSqlAndAlias(): void null, ['id', new RawSql($this->db->protectIdentifiers('d') . '.' . $this->db->protectIdentifiers('country') - . " LIKE 'U%'")] + . " LIKE 'U%'")], ); $this->seeInDatabase('user', [ diff --git a/tests/system/Database/Migrations/MigrationRunnerTest.php b/tests/system/Database/Migrations/MigrationRunnerTest.php index 0ecd2ca0b051..61517d9f7521 100644 --- a/tests/system/Database/Migrations/MigrationRunnerTest.php +++ b/tests/system/Database/Migrations/MigrationRunnerTest.php @@ -61,7 +61,7 @@ protected function setUpAddNamespace(): void { service('autoloader')->addNamespace( 'Tests\Support\MigrationTestMigrations', - SUPPORTPATH . 'MigrationTestMigrations' + SUPPORTPATH . 'MigrationTestMigrations', ); } @@ -89,7 +89,7 @@ public function testLoadsDefaultDatabaseWhenNoneSpecified(): void ) . $dbConfig->tests['database']; $this->assertSame( $database, - $this->getPrivateProperty($db, 'database') + $this->getPrivateProperty($db, 'database'), ); $this->assertSame($dbConfig->tests['DBDriver'], $this->getPrivateProperty($db, 'DBDriver')); } @@ -297,7 +297,7 @@ public function testMigrationThrowsDisabledException(): void vfsStream::copyFromFileSystem( TESTPATH . '_support/MigrationTestMigrations/Database/Migrations', - $this->root + $this->root, ); $this->expectException(ConfigException::class); diff --git a/tests/system/Debug/ExceptionHandlerTest.php b/tests/system/Debug/ExceptionHandlerTest.php index ddb1304c3d7e..619522d3c155 100644 --- a/tests/system/Debug/ExceptionHandlerTest.php +++ b/tests/system/Debug/ExceptionHandlerTest.php @@ -151,11 +151,11 @@ public function testHandleCLIPageNotFoundException(): void $this->assertStringContainsString( 'ERROR: 404', - $this->getStreamFilterBuffer() + $this->getStreamFilterBuffer(), ); $this->assertStringContainsString( 'Controller or its method is not found: Foo::bar', - $this->getStreamFilterBuffer() + $this->getStreamFilterBuffer(), ); $this->resetStreamFilterBuffer(); diff --git a/tests/system/Debug/ExceptionsTest.php b/tests/system/Debug/ExceptionsTest.php index b8279fb8e190..25601e1f39d0 100644 --- a/tests/system/Debug/ExceptionsTest.php +++ b/tests/system/Debug/ExceptionsTest.php @@ -139,7 +139,7 @@ public function testRenderBacktrace(): void foreach ($renderedBacktrace as $trace) { $this->assertMatchesRegularExpression( '/^\s*\d* .+(?:\(\d+\))?: \S+(?:(?:\->|::)\S+)?\(.*\)$/', - $trace + $trace, ); } } diff --git a/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php b/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php index 9c091ee4e530..2033a6e78639 100644 --- a/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php +++ b/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php @@ -48,7 +48,7 @@ public function testDisplay(): void $this->assertArrayHasKey('index', $trace); $this->assertSame( sprintf('%s', $i + 1), - preg_replace(sprintf('/%s/', chr(0xC2) . chr(0xA0)), '', $trace['index']) + preg_replace(sprintf('/%s/', chr(0xC2) . chr(0xA0)), '', $trace['index']), ); // since we merged file & line together diff --git a/tests/system/Debug/Toolbar/Collectors/HistoryTest.php b/tests/system/Debug/Toolbar/Collectors/HistoryTest.php index 3a5411a96a0f..6e72f2726ef6 100644 --- a/tests/system/Debug/Toolbar/Collectors/HistoryTest.php +++ b/tests/system/Debug/Toolbar/Collectors/HistoryTest.php @@ -88,7 +88,7 @@ public function testSetFiles(): void $this->assertSame($request['time'], sprintf('%.6f', $time)); $this->assertSame( $request['datetime'], - DateTime::createFromFormat('U.u', $time)->format('Y-m-d H:i:s.u') + DateTime::createFromFormat('U.u', $time)->format('Y-m-d H:i:s.u'), ); $this->assertSame($request['active'], ($time === $activeRowTime)); diff --git a/tests/system/Email/EmailTest.php b/tests/system/Email/EmailTest.php index 389b657e573a..ca26743c3ddc 100644 --- a/tests/system/Email/EmailTest.php +++ b/tests/system/Email/EmailTest.php @@ -182,11 +182,11 @@ public function testSetAttachmentCIDFile(): void $this->assertStringStartsWith('ci-logo.png@', $cid); $this->assertStringStartsWith( 'ci-logo.png@', - $email->archive['attachments'][0]['cid'] + $email->archive['attachments'][0]['cid'], ); $this->assertMatchesRegularExpression( '/CI Logo/u', - $email->archive['body'] + $email->archive['body'], ); } @@ -208,11 +208,11 @@ public function testSetAttachmentCIDBufferString(): void $this->assertStringStartsWith('image001.png@', $cid); $this->assertStringStartsWith( 'image001.png@', - $email->archive['attachments'][0]['cid'] + $email->archive['attachments'][0]['cid'], ); $this->assertMatchesRegularExpression( '/CI Logo/u', - $email->archive['body'] + $email->archive['body'], ); } } diff --git a/tests/system/Filters/CorsTest.php b/tests/system/Filters/CorsTest.php index bbbbefc0b413..5e25af0572f2 100644 --- a/tests/system/Filters/CorsTest.php +++ b/tests/system/Filters/CorsTest.php @@ -89,7 +89,7 @@ private function createCors(array $options = []): Cors 'maxAge' => 0, 'supportsCredentials' => false, ], - $options + $options, ); return new Cors($passedOptions); @@ -119,7 +119,7 @@ public function testItDoesModifyOnARequestWithoutOrigin(): void $this->assertHeader( 'Access-Control-Allow-Origin', - 'http://localhost' + 'http://localhost', ); } @@ -208,7 +208,7 @@ public function testItDoesntPermitWildcardAllowedHeadersAndSupportsCredentials() { $this->expectException(ConfigException::class); $this->expectExceptionMessage( - 'When responding to a credentialed request, the server must not specify the "*" wildcard for the Access-Control-Allow-Headers response-header value.' + 'When responding to a credentialed request, the server must not specify the "*" wildcard for the Access-Control-Allow-Headers response-header value.', ); $this->cors = $this->createCors(['allowedHeaders' => ['*'], 'supportsCredentials' => true]); @@ -249,7 +249,7 @@ public function testItSetsExposedHeadersWhenConfiguredOnActualRequest(): void $this->assertTrue($response->hasHeader('Access-Control-Expose-Headers')); $this->assertHeader( 'Access-Control-Expose-Headers', - 'x-exposed-header, x-another-exposed-header' + 'x-exposed-header, x-another-exposed-header', ); } @@ -257,7 +257,7 @@ public function testItDoesNotPermitWildcardAllowedOriginsAndSupportsCredentials( { $this->expectException(ConfigException::class); $this->expectExceptionMessage( - 'When responding to a credentialed request, the server must not specify the "*" wildcard for the Access-Control-Allow-Origin response-header value.' + 'When responding to a credentialed request, the server must not specify the "*" wildcard for the Access-Control-Allow-Origin response-header value.', ); $this->cors = $this->createCors([ @@ -273,7 +273,7 @@ public function testItDoesNotPermitWildcardAllowedOriginsAllowedMethodAndSupport { $this->expectException(ConfigException::class); $this->expectExceptionMessage( - 'When responding to a credentialed request, the server must not specify the "*" wildcard for the Access-Control-Allow-Origin response-header value.' + 'When responding to a credentialed request, the server must not specify the "*" wildcard for the Access-Control-Allow-Origin response-header value.', ); $this->cors = $this->createCors([ @@ -303,7 +303,7 @@ public function testItDoesntPermitWildcardAndOrigin(): void { $this->expectException(ConfigException::class); $this->expectExceptionMessage( - "If wildcard is specified, you must set `'allowedOrigins' => ['*']`. But using wildcard is not recommended." + "If wildcard is specified, you must set `'allowedOrigins' => ['*']`. But using wildcard is not recommended.", ); $this->cors = $this->createCors([ diff --git a/tests/system/Filters/FiltersTest.php b/tests/system/Filters/FiltersTest.php index d4a390c113e0..3c44cc5c6787 100644 --- a/tests/system/Filters/FiltersTest.php +++ b/tests/system/Filters/FiltersTest.php @@ -97,7 +97,7 @@ public function testProcessMethodDetectsCLI(): void $filtersConfig = $this->createConfigFromArray(FiltersConfig::class, $config); $filters = $this->createFilters( $filtersConfig, - new CLIRequest(new MockAppConfig()) + new CLIRequest(new MockAppConfig()), ); $expected = [ diff --git a/tests/system/Format/FormatTest.php b/tests/system/Format/FormatTest.php index 74252c7b56d8..91fb618209d7 100644 --- a/tests/system/Format/FormatTest.php +++ b/tests/system/Format/FormatTest.php @@ -56,7 +56,7 @@ public function testGetFormatterExpectsExceptionOnUndefinedClass(): void { $this->format->getConfig()->formatters = array_merge( $this->format->getConfig()->formatters, - ['text/xml' => 'App\Foo'] + ['text/xml' => 'App\Foo'], ); $this->expectException(FormatException::class); @@ -68,7 +68,7 @@ public function testGetFormatterExpectsExceptionOnClassNotImplementingFormatterI { $this->format->getConfig()->formatters = array_merge( $this->format->getConfig()->formatters, - ['text/xml' => URI::class] + ['text/xml' => URI::class], ); $this->expectException(FormatException::class); diff --git a/tests/system/HTTP/CURLRequestTest.php b/tests/system/HTTP/CURLRequestTest.php index 7c2d7b17138a..3d1543c15ee5 100644 --- a/tests/system/HTTP/CURLRequestTest.php +++ b/tests/system/HTTP/CURLRequestTest.php @@ -914,12 +914,12 @@ public function testResponseHeadersWithMultipleSetCookies(): void $this->assertCount(3, $setCookieHeaders); $this->assertSame( 'logged_in=no; Path=/; Domain=github.com; Expires=Mon, 11 Nov 2024 02:27:05 GMT; HttpOnly; Secure; SameSite=Lax', - $setCookieHeaders[2]->getValue() + $setCookieHeaders[2]->getValue(), ); $this->assertSame( '_octo=GH1.1.599292127.1699669625; Path=/; Domain=github.com; Expires=Mon, 11 Nov 2024 02:27:05 GMT; Secure; SameSite=Lax', - $setCookieHeaders[1]->getValueLine() + $setCookieHeaders[1]->getValueLine(), ); } @@ -1067,7 +1067,7 @@ public function testSetForm(): void $this->assertSame( http_build_query($params), - $this->request->curl_options[CURLOPT_POSTFIELDS] + $this->request->curl_options[CURLOPT_POSTFIELDS], ); $params['afile'] = new CURLFile(__FILE__); @@ -1076,7 +1076,7 @@ public function testSetForm(): void $this->assertSame( $params, - $this->request->curl_options[CURLOPT_POSTFIELDS] + $this->request->curl_options[CURLOPT_POSTFIELDS], ); } @@ -1098,7 +1098,7 @@ public function testJSONData(): void $expected = json_encode($params); $this->assertSame( $expected, - $this->request->curl_options[CURLOPT_POSTFIELDS] + $this->request->curl_options[CURLOPT_POSTFIELDS], ); } @@ -1116,11 +1116,11 @@ public function testSetJSON(): void $expected = json_encode($params); $this->assertSame( $expected, - $this->request->curl_options[CURLOPT_POSTFIELDS] + $this->request->curl_options[CURLOPT_POSTFIELDS], ); $this->assertSame( 'Content-Type: application/json', - $this->request->curl_options[CURLOPT_HTTPHEADER][0] + $this->request->curl_options[CURLOPT_HTTPHEADER][0], ); } diff --git a/tests/system/HTTP/ContentSecurityPolicyTest.php b/tests/system/HTTP/ContentSecurityPolicyTest.php index c1d90554fc7c..c4e6688ef11f 100644 --- a/tests/system/HTTP/ContentSecurityPolicyTest.php +++ b/tests/system/HTTP/ContentSecurityPolicyTest.php @@ -441,7 +441,7 @@ public function testBodyScriptNonce(): void $result = $this->work($body); $nonceStyle = array_filter( $this->getPrivateProperty($this->csp, 'styleSrc'), - static fn ($value): bool => str_starts_with($value, 'nonce-') + static fn ($value): bool => str_starts_with($value, 'nonce-'), ); $this->assertStringContainsString('nonce=', $this->response->getBody()); @@ -516,7 +516,7 @@ public function testBodyStyleNonce(): void $result = $this->work($body); $nonceScript = array_filter( $this->getPrivateProperty($this->csp, 'scriptSrc'), - static fn ($value): bool => str_starts_with($value, 'nonce-') + static fn ($value): bool => str_starts_with($value, 'nonce-'), ); $this->assertStringContainsString('nonce=', $this->response->getBody()); diff --git a/tests/system/HTTP/CorsTest.php b/tests/system/HTTP/CorsTest.php index bdb29567df59..1002c557d313 100644 --- a/tests/system/HTTP/CorsTest.php +++ b/tests/system/HTTP/CorsTest.php @@ -109,20 +109,20 @@ public function testHandlePreflightRequestSingleAllowedOrigin(): void $this->assertHeader( $response, 'Access-Control-Allow-Origin', - 'http://localhost:8080' + 'http://localhost:8080', ); $this->assertHeader( $response, 'Access-Control-Allow-Headers', - 'X-API-KEY, X-Requested-With, Content-Type, Accept' + 'X-API-KEY, X-Requested-With, Content-Type, Accept', ); $this->assertHeader( $response, 'Access-Control-Allow-Methods', - 'PUT' + 'PUT', ); $this->assertFalse( - $response->hasHeader('Access-Control-Allow-Credentials') + $response->hasHeader('Access-Control-Allow-Credentials'), ); } @@ -144,22 +144,22 @@ public function testHandlePreflightRequestMultipleAllowedOriginsAllowed(): void $this->assertHeader( $response, 'Access-Control-Allow-Origin', - 'https://api.example.com' + 'https://api.example.com', ); $this->assertHeader( $response, 'Access-Control-Allow-Headers', - 'X-API-KEY, X-Requested-With, Content-Type, Accept' + 'X-API-KEY, X-Requested-With, Content-Type, Accept', ); $this->assertHeader( $response, 'Access-Control-Allow-Methods', - 'PUT' + 'PUT', ); $this->assertHeader( $response, 'Vary', - 'Origin' + 'Origin', ); } @@ -182,22 +182,22 @@ public function testHandlePreflightRequestMultipleAllowedOriginsAllowedAlreadyVa $this->assertHeader( $response, 'Access-Control-Allow-Origin', - 'https://api.example.com' + 'https://api.example.com', ); $this->assertHeader( $response, 'Access-Control-Allow-Headers', - 'X-API-KEY, X-Requested-With, Content-Type, Accept' + 'X-API-KEY, X-Requested-With, Content-Type, Accept', ); $this->assertHeader( $response, 'Access-Control-Allow-Methods', - 'PUT' + 'PUT', ); $this->assertHeader( $response, 'Vary', - 'Accept-Language, Origin' + 'Accept-Language, Origin', ); } @@ -217,13 +217,13 @@ public function testHandlePreflightRequestMultipleAllowedOriginsNotAllowed(): vo $response = $cors->handlePreflightRequest($request, $response); $this->assertFalse( - $response->hasHeader('Access-Control-Allow-Origin') + $response->hasHeader('Access-Control-Allow-Origin'), ); $this->assertFalse( - $response->hasHeader('Access-Control-Allow-Headers') + $response->hasHeader('Access-Control-Allow-Headers'), ); $this->assertFalse( - $response->hasHeader('Access-Control-Allow-Methods') + $response->hasHeader('Access-Control-Allow-Methods'), ); } @@ -245,22 +245,22 @@ public function testHandlePreflightRequestAllowedOriginsPatternsAllowed(): void $this->assertHeader( $response, 'Access-Control-Allow-Origin', - 'https://api.example.com' + 'https://api.example.com', ); $this->assertHeader( $response, 'Access-Control-Allow-Headers', - 'X-API-KEY, X-Requested-With, Content-Type, Accept' + 'X-API-KEY, X-Requested-With, Content-Type, Accept', ); $this->assertHeader( $response, 'Access-Control-Allow-Methods', - 'PUT' + 'PUT', ); $this->assertHeader( $response, 'Vary', - 'Origin' + 'Origin', ); } @@ -280,13 +280,13 @@ public function testHandlePreflightRequestAllowedOriginsPatternsNotAllowed(): vo $response = $cors->handlePreflightRequest($request, $response); $this->assertFalse( - $response->hasHeader('Access-Control-Allow-Origin') + $response->hasHeader('Access-Control-Allow-Origin'), ); $this->assertFalse( - $response->hasHeader('Access-Control-Allow-Headers') + $response->hasHeader('Access-Control-Allow-Headers'), ); $this->assertFalse( - $response->hasHeader('Access-Control-Allow-Methods') + $response->hasHeader('Access-Control-Allow-Methods'), ); } @@ -309,22 +309,22 @@ public function testHandlePreflightRequestSingleAllowedOriginWithCredentials(): $this->assertHeader( $response, 'Access-Control-Allow-Origin', - 'http://localhost:8080' + 'http://localhost:8080', ); $this->assertHeader( $response, 'Access-Control-Allow-Headers', - 'X-API-KEY, X-Requested-With, Content-Type, Accept' + 'X-API-KEY, X-Requested-With, Content-Type, Accept', ); $this->assertHeader( $response, 'Access-Control-Allow-Methods', - 'PUT' + 'PUT', ); $this->assertHeader( $response, 'Access-Control-Allow-Credentials', - 'true' + 'true', ); } @@ -346,16 +346,16 @@ public function testAddResponseHeadersSingleAllowedOriginSimpleRequest(): void $this->assertHeader( $response, 'Access-Control-Allow-Origin', - 'http://localhost:8080' + 'http://localhost:8080', ); $this->assertFalse( - $response->hasHeader('Access-Control-Allow-Headers') + $response->hasHeader('Access-Control-Allow-Headers'), ); $this->assertFalse( - $response->hasHeader('Access-Control-Allow-Methods') + $response->hasHeader('Access-Control-Allow-Methods'), ); $this->assertFalse( - $response->hasHeader('Access-Control-Allow-Credentials') + $response->hasHeader('Access-Control-Allow-Credentials'), ); } @@ -377,7 +377,7 @@ public function testAddResponseHeadersSingleAllowedOriginRealRequest(): void $this->assertHeader( $response, 'Access-Control-Allow-Origin', - 'http://localhost:8080' + 'http://localhost:8080', ); } @@ -401,12 +401,12 @@ public function testAddResponseHeadersSingleAllowedOriginWithCredentials(): void $this->assertHeader( $response, 'Access-Control-Allow-Origin', - 'http://localhost:8080' + 'http://localhost:8080', ); $this->assertHeader( $response, 'Access-Control-Allow-Credentials', - 'true' + 'true', ); } @@ -429,12 +429,12 @@ public function testAddResponseHeadersSingleAllowedOriginWithExposeHeaders(): vo $this->assertHeader( $response, 'Access-Control-Allow-Origin', - 'http://localhost:8080' + 'http://localhost:8080', ); $this->assertHeader( $response, 'Access-Control-Expose-Headers', - 'Content-Length, X-Kuma-Revision' + 'Content-Length, X-Kuma-Revision', ); } @@ -455,18 +455,18 @@ public function testAddResponseHeadersMultipleAllowedOriginsAllowed(): void $this->assertHeader( $response, 'Access-Control-Allow-Origin', - 'https://api.example.com' + 'https://api.example.com', ); $this->assertHeader( $response, 'Vary', - 'Origin' + 'Origin', ); $this->assertFalse( - $response->hasHeader('Access-Control-Allow-Headers') + $response->hasHeader('Access-Control-Allow-Headers'), ); $this->assertFalse( - $response->hasHeader('Access-Control-Allow-Methods') + $response->hasHeader('Access-Control-Allow-Methods'), ); } @@ -488,12 +488,12 @@ public function testAddResponseHeadersMultipleAllowedOriginsAllowedAlreadyVary() $this->assertHeader( $response, 'Access-Control-Allow-Origin', - 'https://api.example.com' + 'https://api.example.com', ); $this->assertHeader( $response, 'Vary', - 'Accept-Language, Origin' + 'Accept-Language, Origin', ); } @@ -512,13 +512,13 @@ public function testAddResponseHeadersMultipleAllowedOriginsNotAllowed(): void $response = $cors->addResponseHeaders($request, $response); $this->assertFalse( - $response->hasHeader('Access-Control-Allow-Origin') + $response->hasHeader('Access-Control-Allow-Origin'), ); $this->assertFalse( - $response->hasHeader('Access-Control-Allow-Headers') + $response->hasHeader('Access-Control-Allow-Headers'), ); $this->assertFalse( - $response->hasHeader('Access-Control-Allow-Methods') + $response->hasHeader('Access-Control-Allow-Methods'), ); } } diff --git a/tests/system/HTTP/IncomingRequestTest.php b/tests/system/HTTP/IncomingRequestTest.php index fa76e8289d46..d3e542b4accb 100644 --- a/tests/system/HTTP/IncomingRequestTest.php +++ b/tests/system/HTTP/IncomingRequestTest.php @@ -290,7 +290,7 @@ public function testNegotiatesCharset(): void $this->assertSame( 'utf-8', - $this->request->negotiate('charset', ['iso-8859', 'unicode-1-2']) + $this->request->negotiate('charset', ['iso-8859', 'unicode-1-2']), ); } @@ -299,7 +299,7 @@ public function testNegotiatesMedia(): void $this->request->setHeader('Accept', 'text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c'); $this->assertSame( 'text/html', - $this->request->negotiate('media', ['text/html', 'text/x-c', 'text/x-dvi', 'text/plain']) + $this->request->negotiate('media', ['text/html', 'text/x-c', 'text/x-dvi', 'text/plain']), ); } @@ -436,17 +436,17 @@ public function testGetJsonVarCanFilterArray(): void $this->assertSame( $expected, - $request->getJsonVar(null, true, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) + $request->getJsonVar(null, true, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION), ); $this->assertSame( $expected['array'], - $request->getJsonVar('array', true, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) + $request->getJsonVar('array', true, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION), ); $this->assertSame( ['array' => $expected['array'], 'float' => $expected['float']], - $request->getJsonVar(['array', 'float'], true, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) + $request->getJsonVar(['array', 'float'], true, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION), ); $result = $request->getJsonVar(['array', 'float'], false, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); @@ -1165,7 +1165,7 @@ public function testGetIPAddressThruProxyInvalidConfigArray(): void { $this->expectException(ConfigException::class); $this->expectExceptionMessage( - 'You must set an array with Proxy IP address key and HTTP header name value in Config\App::$proxyIPs.' + 'You must set an array with Proxy IP address key and HTTP header name value in Config\App::$proxyIPs.', ); $config = new App(); diff --git a/tests/system/HTTP/MessageTest.php b/tests/system/HTTP/MessageTest.php index d16224367a6f..ac33869396a1 100644 --- a/tests/system/HTTP/MessageTest.php +++ b/tests/system/HTTP/MessageTest.php @@ -311,7 +311,7 @@ public function testAddHeaderAddsFirstHeader(): void { $this->message->addHeader( 'Set-Cookie', - 'logged_in=no; Path=/' + 'logged_in=no; Path=/', ); $header = $this->message->header('Set-Cookie'); @@ -324,11 +324,11 @@ public function testAddHeaderAddsTwoHeaders(): void { $this->message->addHeader( 'Set-Cookie', - 'logged_in=no; Path=/' + 'logged_in=no; Path=/', ); $this->message->addHeader( 'Set-Cookie', - 'sessid=123456; Path=/' + 'sessid=123456; Path=/', ); $headers = $this->message->header('Set-Cookie'); @@ -342,16 +342,16 @@ public function testAppendHeaderWithMultipleHeaders(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( - 'The header "Set-Cookie" already has multiple headers. You cannot change them. If you really need to change, remove the header first.' + 'The header "Set-Cookie" already has multiple headers. You cannot change them. If you really need to change, remove the header first.', ); $this->message->addHeader( 'Set-Cookie', - 'logged_in=no; Path=/' + 'logged_in=no; Path=/', ); $this->message->addHeader( 'Set-Cookie', - 'sessid=123456; Path=/' + 'sessid=123456; Path=/', ); $this->message->appendHeader('Set-Cookie', 'HttpOnly'); @@ -361,16 +361,16 @@ public function testGetHeaderLineWithMultipleHeaders(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( - 'The header "Set-Cookie" already has multiple headers. You cannot use getHeaderLine().' + 'The header "Set-Cookie" already has multiple headers. You cannot use getHeaderLine().', ); $this->message->addHeader( 'Set-Cookie', - 'logged_in=no; Path=/' + 'logged_in=no; Path=/', ); $this->message->addHeader( 'Set-Cookie', - 'sessid=123456; Path=/' + 'sessid=123456; Path=/', ); $this->message->getHeaderLine('Set-Cookie'); diff --git a/tests/system/HTTP/RedirectExceptionTest.php b/tests/system/HTTP/RedirectExceptionTest.php index cd90a9aa148c..bde10ea8dfc1 100644 --- a/tests/system/HTTP/RedirectExceptionTest.php +++ b/tests/system/HTTP/RedirectExceptionTest.php @@ -49,7 +49,7 @@ public function testResponse(): void service('response') ->redirect('redirect') ->setCookie('cookie', 'value') - ->setHeader('Redirect-Header', 'value') + ->setHeader('Redirect-Header', 'value'), ))->getResponse(); $this->assertSame('redirect', $response->getHeaderLine('location')); @@ -62,7 +62,7 @@ public function testResponseWithoutLocation(): void { $this->expectException(LogicException::class); $this->expectExceptionMessage( - 'The Response object passed to RedirectException does not contain a redirect address.' + 'The Response object passed to RedirectException does not contain a redirect address.', ); new RedirectException(service('response')); diff --git a/tests/system/HTTP/RedirectResponseTest.php b/tests/system/HTTP/RedirectResponseTest.php index 1614244d762b..d6203aa935fd 100644 --- a/tests/system/HTTP/RedirectResponseTest.php +++ b/tests/system/HTTP/RedirectResponseTest.php @@ -61,7 +61,7 @@ protected function setUp(): void $this->config, new SiteURI($this->config), null, - new UserAgent() + new UserAgent(), ); Services::injectMock('request', $this->request); } diff --git a/tests/system/HTTP/ResponseSendTest.php b/tests/system/HTTP/ResponseSendTest.php index c7ad15195d97..db72de5d2f03 100644 --- a/tests/system/HTTP/ResponseSendTest.php +++ b/tests/system/HTTP/ResponseSendTest.php @@ -173,7 +173,7 @@ public function testDoNotSendUnSecureCookie(): void '', '/', '', - true + true, ); // send it diff --git a/tests/system/HTTP/ResponseTest.php b/tests/system/HTTP/ResponseTest.php index 3137620029bc..eeac917c7c64 100644 --- a/tests/system/HTTP/ResponseTest.php +++ b/tests/system/HTTP/ResponseTest.php @@ -175,7 +175,7 @@ public function testSetLink(): void $this->assertSame( '; rel="first",; rel="prev",; rel="next",; rel="last"', - $response->header('Link')->getValue() + $response->header('Link')->getValue(), ); $pager->store('default', 1, 10, 200); @@ -183,7 +183,7 @@ public function testSetLink(): void $this->assertSame( '; rel="next",; rel="last"', - $response->header('Link')->getValue() + $response->header('Link')->getValue(), ); $pager->store('default', 20, 10, 200); @@ -191,7 +191,7 @@ public function testSetLink(): void $this->assertSame( '; rel="first",; rel="prev"', - $response->header('Link')->getValue() + $response->header('Link')->getValue(), ); } @@ -276,7 +276,7 @@ public function testRedirect( string $protocol, string $method, ?int $code, - int $expectedCode + int $expectedCode, ): void { $_SERVER['SERVER_SOFTWARE'] = $server; $_SERVER['SERVER_PROTOCOL'] = $protocol; @@ -319,7 +319,7 @@ public function testRedirectWithIIS( string $protocol, string $method, ?int $code, - int $expectedCode + int $expectedCode, ): void { $_SERVER['SERVER_SOFTWARE'] = 'Microsoft-IIS'; $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1'; diff --git a/tests/system/HTTP/SiteURIFactoryTest.php b/tests/system/HTTP/SiteURIFactoryTest.php index 62e20639b5e0..b26fde04b245 100644 --- a/tests/system/HTTP/SiteURIFactoryTest.php +++ b/tests/system/HTTP/SiteURIFactoryTest.php @@ -93,7 +93,7 @@ public function testCreateFromStringWithIndexPage( string $uriString, string $expectUriString, string $expectedPath, - string $expectedRoutePath + string $expectedRoutePath, ): void { $factory = $this->createSiteURIFactory(); @@ -134,7 +134,7 @@ public function testCreateFromStringWithoutIndexPage( string $uriString, string $expectUriString, string $expectedPath, - string $expectedRoutePath + string $expectedRoutePath, ): void { $config = new App(); $config->indexPage = ''; diff --git a/tests/system/HTTP/SiteURITest.php b/tests/system/HTTP/SiteURITest.php index 644aaa795b6d..bd7e9ca3d338 100644 --- a/tests/system/HTTP/SiteURITest.php +++ b/tests/system/HTTP/SiteURITest.php @@ -40,7 +40,7 @@ public function testConstructor( string $expectedQuery, string $expectedFragment, array $expectedSegments, - int $expectedTotalSegments + int $expectedTotalSegments, ): void { $config = new App(); $config->indexPage = $indexPage; @@ -337,7 +337,7 @@ public function testSetPath( string $expectedQuery, string $expectedFragment, array $expectedSegments, - int $expectedTotalSegments + int $expectedTotalSegments, ): void { $config = new App(); $config->indexPage = $indexPage; diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index 517e2d888973..945b132876ef 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -953,15 +953,15 @@ public function testNoExtraSlashes(): void { $this->assertSame( 'http://entirely.different.com/subfolder', - (string) (new URI('entirely.different.com/subfolder')) + (string) (new URI('entirely.different.com/subfolder')), ); $this->assertSame( 'http://localhost/subfolder', - (string) (new URI('localhost/subfolder')) + (string) (new URI('localhost/subfolder')), ); $this->assertSame( 'http://localtest.me/subfolder', - (string) (new URI('localtest.me/subfolder')) + (string) (new URI('localtest.me/subfolder')), ); } @@ -1052,7 +1052,7 @@ public function testBasedNoIndex(): void // going through request $this->assertSame( 'http://example.com/ci/v4/controller/method', - (string) $request->getUri() + (string) $request->getUri(), ); $this->assertSame('/ci/v4/controller/method', $request->getUri()->getPath()); $this->assertSame('controller/method', $request->getUri()->getRoutePath()); @@ -1086,18 +1086,18 @@ public function testBasedWithIndex(): void // going through request $this->assertSame( 'http://example.com/ci/v4/index.php/controller/method', - (string) $request->getUri() + (string) $request->getUri(), ); $this->assertSame( '/ci/v4/index.php/controller/method', - $request->getUri()->getPath() + $request->getUri()->getPath(), ); // standalone $uri = new URI('http://example.com/ci/v4/index.php/controller/method'); $this->assertSame( 'http://example.com/ci/v4/index.php/controller/method', - (string) $uri + (string) $uri, ); $this->assertSame('/ci/v4/index.php/controller/method', $uri->getPath()); @@ -1126,7 +1126,7 @@ public function testForceGlobalSecureRequests(): void // Detected by request $this->assertSame( 'https://example.com/ci/v4/controller/method', - (string) $request->getUri() + (string) $request->getUri(), ); // Standalone @@ -1135,7 +1135,7 @@ public function testForceGlobalSecureRequests(): void $this->assertSame( trim($uri->getPath(), '/'), - trim($request->getUri()->getPath(), '/') + trim($request->getUri()->getPath(), '/'), ); } diff --git a/tests/system/Helpers/DateHelperTest.php b/tests/system/Helpers/DateHelperTest.php index 4e7acf649ae7..ec0d3ded0dc2 100644 --- a/tests/system/Helpers/DateHelperTest.php +++ b/tests/system/Helpers/DateHelperTest.php @@ -46,7 +46,7 @@ public function testNowSpecific(): void // Chicago should be two hours ahead of Vancouver $this->assertSame( 7200, - now('America/Chicago') - now('America/Vancouver') + now('America/Chicago') - now('America/Vancouver'), ); Time::setTestNow(); @@ -84,7 +84,7 @@ public function testTimezoneSelectSpecific(): void $this->assertSame( $expected, - timezone_select('custom-select', 'Asia/Jakarta', $spesificRegion) + timezone_select('custom-select', 'Asia/Jakarta', $spesificRegion), ); } @@ -105,7 +105,7 @@ public function testTimezoneSelectSingle(): void $this->assertSame( $expected, - timezone_select('custom-select', 'Asia/Jakarta', $spesificRegion, $country) + timezone_select('custom-select', 'Asia/Jakarta', $spesificRegion, $country), ); } } diff --git a/tests/system/Helpers/FormHelperTest.php b/tests/system/Helpers/FormHelperTest.php index 9023fd73ac6f..91d5aa2e8c7b 100644 --- a/tests/system/Helpers/FormHelperTest.php +++ b/tests/system/Helpers/FormHelperTest.php @@ -944,12 +944,12 @@ public function testSetCheckboxWithUnchecked(): void $this->assertSame( '', - set_checkbox('fruit', 'apple', true) + set_checkbox('fruit', 'apple', true), ); $this->assertSame( '', - set_checkbox('fruit', 'apple') + set_checkbox('fruit', 'apple'), ); } diff --git a/tests/system/Helpers/HTMLHelperTest.php b/tests/system/Helpers/HTMLHelperTest.php index b7159253706e..b6d061072375 100644 --- a/tests/system/Helpers/HTMLHelperTest.php +++ b/tests/system/Helpers/HTMLHelperTest.php @@ -338,7 +338,7 @@ public function testScriptTagWithCsp(): void $this->assertMatchesRegularExpression( '!