chore: add more trailing commas in more places (#9395)

* Apply to parameters

* Apply to array destructuring

* Apply to match

* Apply for arguments
This commit is contained in:
John Paul E. Balandan, CPA 2025-01-13 11:03:02 +08:00 committed by GitHub
parent 155f1c14de
commit c3ac0f9483
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
270 changed files with 960 additions and 950 deletions

View File

@ -40,7 +40,17 @@ $finder = Finder::create()
]); ]);
$overrides = [ $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 = [ $options = [
@ -55,5 +65,5 @@ $options = [
return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary( return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(
'CodeIgniter 4 framework', 'CodeIgniter 4 framework',
'CodeIgniter Foundation', 'CodeIgniter Foundation',
'admin@codeigniter.com' 'admin@codeigniter.com',
); );

View File

@ -47,7 +47,7 @@ if ($isMinorUpdate) {
replace_file_content( replace_file_content(
$changelogIndex, $changelogIndex,
'/\.\. toctree::\n :titlesonly:\n/u', '/\.\. toctree::\n :titlesonly:\n/u',
".. toctree::\n :titlesonly:\n\n v{$version}" ".. toctree::\n :titlesonly:\n\n v{$version}",
); );
// Replace {version} // Replace {version}
$length = mb_strlen("Version {$version}"); $length = mb_strlen("Version {$version}");
@ -55,12 +55,12 @@ $underline = str_repeat('#', $length);
replace_file_content( replace_file_content(
$changelog, $changelog,
'/#################\nVersion {version}\n#################/u', '/#################\nVersion {version}\n#################/u',
"{$underline}\nVersion {$version}\n{$underline}" "{$underline}\nVersion {$version}\n{$underline}",
); );
replace_file_content( replace_file_content(
$changelog, $changelog,
'/{version}/u', '/{version}/u',
"{$version}" "{$version}",
); );
// Copy upgrading // Copy upgrading
@ -72,7 +72,7 @@ copy('./admin/next-upgrading-guide.rst', $upgrading);
replace_file_content( replace_file_content(
$upgradingIndex, $upgradingIndex,
'/ backward_compatibility_notes\n/u', '/ backward_compatibility_notes\n/u',
" backward_compatibility_notes\n\n upgrade_{$versionWithoutDots}" " backward_compatibility_notes\n\n upgrade_{$versionWithoutDots}",
); );
// Replace {version} // Replace {version}
$length = mb_strlen("Upgrading from {$versionCurrent} to {$version}"); $length = mb_strlen("Upgrading from {$versionCurrent} to {$version}");
@ -80,7 +80,7 @@ $underline = str_repeat('#', $length);
replace_file_content( replace_file_content(
$upgrading, $upgrading,
'/##############################\nUpgrading from {version} to {version}\n##############################/u', '/##############################\nUpgrading from {version} to {version}\n##############################/u',
"{$underline}\nUpgrading from {$versionCurrent} to {$version}\n{$underline}" "{$underline}\nUpgrading from {$versionCurrent} to {$version}\n{$underline}",
); );
// Commits // Commits

View File

@ -33,31 +33,31 @@ system('git switch -c release-' . $version);
replace_file_content( replace_file_content(
'./system/CodeIgniter.php', './system/CodeIgniter.php',
'/public const CI_VERSION = \'.*?\';/u', '/public const CI_VERSION = \'.*?\';/u',
"public const CI_VERSION = '{$version}';" "public const CI_VERSION = '{$version}';",
); );
// Updates version number in "conf.py". // Updates version number in "conf.py".
replace_file_content( replace_file_content(
'./user_guide_src/source/conf.py', './user_guide_src/source/conf.py',
'/^version = \'.*?\'/mu', '/^version = \'.*?\'/mu',
"version = '{$minor}'" "version = '{$minor}'",
); );
replace_file_content( replace_file_content(
'./user_guide_src/source/conf.py', './user_guide_src/source/conf.py',
'/^release = \'.*?\'/mu', '/^release = \'.*?\'/mu',
"release = '{$version}'" "release = '{$version}'",
); );
// Updates version number in "phpdoc.dist.xml". // Updates version number in "phpdoc.dist.xml".
replace_file_content( replace_file_content(
'./phpdoc.dist.xml', './phpdoc.dist.xml',
'!<title>CodeIgniter v.*? API</title>!mu', '!<title>CodeIgniter v.*? API</title>!mu',
"<title>CodeIgniter v{$minor} API</title>" "<title>CodeIgniter v{$minor} API</title>",
); );
replace_file_content( replace_file_content(
'./phpdoc.dist.xml', './phpdoc.dist.xml',
'/<version number=".*?">/mu', '/<version number=".*?">/mu',
"<version number=\"{$version}\">" "<version number=\"{$version}\">",
); );
// Updates release date in changelogs. // Updates release date in changelogs.
@ -65,7 +65,7 @@ $date = date('F j, Y');
replace_file_content( replace_file_content(
"./user_guide_src/source/changelogs/v{$version}.rst", "./user_guide_src/source/changelogs/v{$version}.rst",
'/^Release Date: .*/mu', '/^Release Date: .*/mu',
"Release Date: {$date}" "Release Date: {$date}",
); );
// Commits // Commits

View File

@ -32,7 +32,7 @@ final class HealthTest extends CIUnitTestCase
$config = new App(); $config = new App();
$this->assertTrue( $this->assertTrue(
$validation->check($config->baseURL, 'valid_url'), $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 @@ final class HealthTest extends CIUnitTestCase
// BaseURL in app/Config/App.php is a valid URL? // BaseURL in app/Config/App.php is a valid URL?
$this->assertTrue( $this->assertTrue(
$validation->check($reader->baseURL, 'valid_url'), $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',
); );
} }
} }

View File

@ -86,7 +86,7 @@ class preload
$phpFiles = new RegexIterator( $phpFiles = new RegexIterator(
$fullTree, $fullTree,
'/.+((?<!Test)+\.php$)/i', '/.+((?<!Test)+\.php$)/i',
RecursiveRegexIterator::GET_MATCH RecursiveRegexIterator::GET_MATCH,
); );
foreach ($phpFiles as $key => $file) { foreach ($phpFiles as $key => $file) {

View File

@ -11,7 +11,7 @@ if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
$message = sprintf( $message = sprintf(
'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s', 'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
$minPhpVersion, $minPhpVersion,
PHP_VERSION PHP_VERSION,
); );
header('HTTP/1.1 503 Service Unavailable.', true, 503); header('HTTP/1.1 503 Service Unavailable.', true, 503);

View File

@ -62,7 +62,7 @@ return RectorConfig::configure()
->withCache( ->withCache(
// Github action cache or local // Github action cache or local
is_dir('/tmp') ? '/tmp/rector' : null, is_dir('/tmp') ? '/tmp/rector' : null,
FileCacheStorage::class FileCacheStorage::class,
) )
// paths to refactor; solid alternative to CLI arguments // paths to refactor; solid alternative to CLI arguments
->withPaths([ ->withPaths([

2
spark
View File

@ -40,7 +40,7 @@ if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
$message = sprintf( $message = sprintf(
'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s', 'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
$minPhpVersion, $minPhpVersion,
PHP_VERSION PHP_VERSION,
); );
exit($message); exit($message);

View File

@ -319,7 +319,7 @@ trait ResponseTrait
$mime = $this->request->negotiate( $mime = $this->request->negotiate(
'media', 'media',
$format->getConfig()->supportedResponseFormats, $format->getConfig()->supportedResponseFormats,
false false,
); );
} }

View File

@ -347,7 +347,7 @@ class Autoloader
throw new InvalidArgumentException( throw new InvalidArgumentException(
'The file path contains special characters "' . $chars 'The file path contains special characters "' . $chars
. '" that are not allowed: "' . $filename . '"' . '" that are not allowed: "' . $filename . '"',
); );
} }
if ($result === false) { if ($result === false) {
@ -386,7 +386,7 @@ class Autoloader
throw new RuntimeException( throw new RuntimeException(
'Your Composer version is too old.' 'Your Composer version is too old.'
. ' Please update Composer (run `composer self-update`) to v2.0.14 or later' . ' 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. // This method requires Composer 2.0.14 or later.

View File

@ -295,9 +295,9 @@ class FileLocator implements FileLocatorInterface
str_replace( str_replace(
'/', '/',
'\\', '\\',
mb_substr($path, mb_strlen($namespace['path'])) mb_substr($path, mb_strlen($namespace['path'])),
), ),
'\\' '\\',
); );
// Remove the file extension (.php) // Remove the file extension (.php)
$className = mb_substr($className, 0, -4); $className = mb_substr($className, 0, -4);

View File

@ -379,7 +379,7 @@ abstract class BaseModel
$this->converter = new DataConverter( $this->converter = new DataConverter(
$this->casts, $this->casts,
$this->castHandlers, $this->castHandlers,
$this->db $this->db,
); );
} }
} }
@ -1081,7 +1081,7 @@ abstract class BaseModel
if ($updateIndex === null) { if ($updateIndex === null) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
'The index ("' . $index . '") for updateBatch() is missing in the data: ' 'The index ("' . $index . '") for updateBatch() is missing in the data: '
. json_encode($row) . json_encode($row),
); );
} }

View File

@ -288,7 +288,7 @@ class Boot
$message = sprintf( $message = sprintf(
'The framework needs the following extension(s) installed and loaded: %s.', 'The framework needs the following extension(s) installed and loaded: %s.',
implode(', ', $missingExtensions) implode(', ', $missingExtensions),
); );
header('HTTP/1.1 503 Service Unavailable.', true, 503); header('HTTP/1.1 503 Service Unavailable.', true, 503);

View File

@ -610,11 +610,11 @@ class CLI
$nonColoredText = preg_replace( $nonColoredText = preg_replace(
$pattern, $pattern,
'<<__colored_string__>>', '<<__colored_string__>>',
$text $text,
); );
$nonColoredChunks = preg_split( $nonColoredChunks = preg_split(
'/<<__colored_string__>>/u', '/<<__colored_string__>>/u',
$nonColoredText $nonColoredText,
); );
foreach ($nonColoredChunks as $i => $chunk) { foreach ($nonColoredChunks as $i => $chunk) {

View File

@ -63,7 +63,7 @@ class Console
'CodeIgniter v%s Command Line Tool - Server Time: %s UTC%s', 'CodeIgniter v%s Command Line Tool - Server Time: %s UTC%s',
CodeIgniter::CI_VERSION, CodeIgniter::CI_VERSION,
date('Y-m-d H:i:s'), date('Y-m-d H:i:s'),
date('P') date('P'),
), 'green'); ), 'green');
CLI::newLine(); CLI::newLine();
} }

View File

@ -171,7 +171,7 @@ trait GeneratorTrait
CLI::prompt( CLI::prompt(
'Are you sure you want to continue?', 'Are you sure you want to continue?',
['y', 'n'], ['y', 'n'],
'required' 'required',
) === 'n' ) === 'n'
) { ) {
CLI::newLine(); CLI::newLine();
@ -193,7 +193,7 @@ trait GeneratorTrait
CLI::error( CLI::error(
lang('CLI.generator.fileExist', [clean_path($target)]), lang('CLI.generator.fileExist', [clean_path($target)]),
'light_gray', 'light_gray',
'red' 'red',
); );
CLI::newLine(); CLI::newLine();
@ -216,7 +216,7 @@ trait GeneratorTrait
CLI::error( CLI::error(
lang('CLI.generator.fileError', [clean_path($target)]), lang('CLI.generator.fileError', [clean_path($target)]),
'light_gray', 'light_gray',
'red' 'red',
); );
CLI::newLine(); CLI::newLine();
@ -227,7 +227,7 @@ trait GeneratorTrait
if ($this->getOption('force') && $isFile) { if ($this->getOption('force') && $isFile) {
CLI::write( CLI::write(
lang('CLI.generator.fileOverwrite', [clean_path($target)]), lang('CLI.generator.fileOverwrite', [clean_path($target)]),
'yellow' 'yellow',
); );
CLI::newLine(); CLI::newLine();
@ -236,7 +236,7 @@ trait GeneratorTrait
CLI::write( CLI::write(
lang('CLI.generator.fileCreate', [clean_path($target)]), lang('CLI.generator.fileCreate', [clean_path($target)]),
'green' 'green',
); );
CLI::newLine(); CLI::newLine();
} }
@ -326,10 +326,10 @@ trait GeneratorTrait
'\\', '\\',
array_map( array_map(
pascalize(...), pascalize(...),
explode('\\', str_replace('/', '\\', trim($class))) explode('\\', str_replace('/', '\\', trim($class))),
) ),
), ),
'\\/' '\\/',
); );
} }
@ -351,7 +351,7 @@ trait GeneratorTrait
return view( return view(
"CodeIgniter\\Commands\\Generators\\Views\\{$this->template}", "CodeIgniter\\Commands\\Generators\\Views\\{$this->template}",
$data, $data,
['debug' => false] ['debug' => false],
); );
} }
} }
@ -370,15 +370,15 @@ trait GeneratorTrait
string $class, string $class,
array $search = [], array $search = [],
array $replace = [], array $replace = [],
array $data = [] array $data = [],
): string { ): string {
// Retrieves the namespace part from the fully qualified class name. // Retrieves the namespace part from the fully qualified class name.
$namespace = trim( $namespace = trim(
implode( implode(
'\\', '\\',
array_slice(explode('\\', $class), 0, -1) array_slice(explode('\\', $class), 0, -1),
), ),
'\\' '\\',
); );
$search[] = '<@php'; $search[] = '<@php';
$search[] = '{namespace}'; $search[] = '{namespace}';
@ -404,7 +404,7 @@ trait GeneratorTrait
&& preg_match( && preg_match(
'/(?P<imports>(?:^use [^;]+;$\n?)+)/m', '/(?P<imports>(?:^use [^;]+;$\n?)+)/m',
$template, $template,
$match $match,
) )
) { ) {
$imports = explode("\n", trim($match['imports'])); $imports = explode("\n", trim($match['imports']));
@ -432,7 +432,7 @@ trait GeneratorTrait
CLI::error( CLI::error(
lang('CLI.namespaceNotDefined', [$namespace]), lang('CLI.namespaceNotDefined', [$namespace]),
'light_gray', 'light_gray',
'red' 'red',
); );
CLI::newLine(); CLI::newLine();
@ -446,7 +446,7 @@ trait GeneratorTrait
. str_replace( . str_replace(
'\\', '\\',
DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR,
trim(str_replace($namespace . '\\', '', $class), '\\') trim(str_replace($namespace . '\\', '', $class), '\\'),
) . '.php'; ) . '.php';
return implode( return implode(
@ -454,8 +454,8 @@ trait GeneratorTrait
array_slice( array_slice(
explode(DIRECTORY_SEPARATOR, $file), explode(DIRECTORY_SEPARATOR, $file),
0, 0,
-1 -1,
) ),
) . DIRECTORY_SEPARATOR . $this->basename($file); ) . DIRECTORY_SEPARATOR . $this->basename($file);
} }
@ -470,9 +470,9 @@ trait GeneratorTrait
str_replace( str_replace(
'/', '/',
'\\', '\\',
$this->getOption('namespace') ?? APP_NAMESPACE $this->getOption('namespace') ?? APP_NAMESPACE,
), ),
'\\' '\\',
); );
} }

View File

@ -85,7 +85,7 @@ class MemcachedHandler extends BaseHandler
$this->memcached->addServer( $this->memcached->addServer(
$this->config['host'], $this->config['host'],
$this->config['port'], $this->config['port'],
$this->config['weight'] $this->config['weight'],
); );
// attempt to get status of servers // attempt to get status of servers
@ -103,7 +103,7 @@ class MemcachedHandler extends BaseHandler
// Check if we can connect to the server // Check if we can connect to the server
$canConnect = $this->memcached->connect( $canConnect = $this->memcached->connect(
$this->config['host'], $this->config['host'],
$this->config['port'] $this->config['port'],
); );
// If we can't connect, throw a CriticalError exception // If we can't connect, throw a CriticalError exception
@ -116,7 +116,7 @@ class MemcachedHandler extends BaseHandler
$this->config['host'], $this->config['host'],
$this->config['port'], $this->config['port'],
true, true,
$this->config['weight'] $this->config['weight'],
); );
} else { } else {
throw new CriticalError('Cache: Not support Memcache(d) extension.'); throw new CriticalError('Cache: Not support Memcache(d) extension.');

View File

@ -82,7 +82,7 @@ class PredisHandler extends BaseHandler
$data = array_combine( $data = array_combine(
['__ci_type', '__ci_value'], ['__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) { if (! isset($data['__ci_type'], $data['__ci_value']) || $data['__ci_value'] === false) {

View File

@ -112,7 +112,7 @@ final class ResponseCache
return $this->cache->save( return $this->cache->save(
$this->generateCacheKey($request), $this->generateCacheKey($request),
serialize(['headers' => $headers, 'output' => $response->getBody()]), serialize(['headers' => $headers, 'output' => $response->getBody()]),
$this->ttl $this->ttl,
); );
} }

View File

@ -325,7 +325,7 @@ class CodeIgniter
if ($this->context === null) { if ($this->context === null) {
throw new LogicException( throw new LogicException(
'Context must be set before run() is called. If you are upgrading from 4.1.x, ' '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 @@ class CodeIgniter
return str_replace( return str_replace(
['{elapsed_time}', '{memory_usage}'], ['{elapsed_time}', '{memory_usage}'],
[(string) $this->totalTime, number_format(memory_get_peak_usage() / 1024 / 1024, 3)], [(string) $this->totalTime, number_format(memory_get_peak_usage() / 1024 / 1024, 3)],
$output $output,
); );
} }
@ -979,7 +979,7 @@ class CodeIgniter
// Throws new PageNotFoundException and remove exception message on production. // Throws new PageNotFoundException and remove exception message on production.
throw PageNotFoundException::forPageNotFound( throw PageNotFoundException::forPageNotFound(
(ENVIRONMENT !== 'production' || ! $this->isWeb()) ? $e->getMessage() : null (ENVIRONMENT !== 'production' || ! $this->isWeb()) ? $e->getMessage() : null,
); );
} }
@ -1064,7 +1064,7 @@ class CodeIgniter
$uri->getAuthority(), $uri->getAuthority(),
$uri->getPath(), $uri->getPath(),
$uri->getQuery(), $uri->getQuery(),
$uri->getFragment() $uri->getFragment(),
)); ));
} }
} }

View File

@ -144,7 +144,7 @@ class ShowTableInfo extends BaseCommand
$tableNameNo = CLI::promptByKey( $tableNameNo = CLI::promptByKey(
['Here is the list of your database tables:', 'Which table do you want to see?'], ['Here is the list of your database tables:', 'Which table do you want to see?'],
$tables, $tables,
'required' 'required',
); );
CLI::newLine(); CLI::newLine();
@ -174,7 +174,7 @@ class ShowTableInfo extends BaseCommand
]]; ]];
CLI::table( CLI::table(
$data, $data,
['hostname', 'database', 'username', 'DBDriver', 'DBPrefix', 'port'] ['hostname', 'database', 'username', 'DBDriver', 'DBPrefix', 'port'],
); );
} }
@ -272,7 +272,7 @@ class ShowTableInfo extends BaseCommand
string $tableName, string $tableName,
int $limitRows, int $limitRows,
int $limitFieldValue, int $limitFieldValue,
?string $sortField = null ?string $sortField = null,
): array { ): array {
$this->tbody = []; $this->tbody = [];
@ -290,7 +290,7 @@ class ShowTableInfo extends BaseCommand
static fn ($item): string => mb_strlen((string) $item) > $limitFieldValue static fn ($item): string => mb_strlen((string) $item) > $limitFieldValue
? mb_substr((string) $item, 0, $limitFieldValue) . '...' ? mb_substr((string) $item, 0, $limitFieldValue) . '...'
: (string) $item, : (string) $item,
$row $row,
); );
$this->tbody[] = $row; $this->tbody[] = $row;
} }

View File

@ -182,7 +182,7 @@ class GenerateKey extends BaseCommand
$newFileContents = preg_replace( $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', '/^[#\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, $replacementKey,
$oldFileContents $oldFileContents,
); );
} }

View File

@ -96,7 +96,7 @@ class CellGenerator extends BaseCommand
$viewName = preg_replace( $viewName = preg_replace(
'/([a-z][a-z0-9_\/\\\\]+)(_cell)$/i', '/([a-z][a-z0-9_\/\\\\]+)(_cell)$/i',
'$1', '$1',
$viewName $viewName,
) ?? $viewName; ) ?? $viewName;
$namespace = substr($className, 0, strrpos($className, '\\') + 1); $namespace = substr($className, 0, strrpos($className, '\\') + 1);

View File

@ -115,7 +115,7 @@ class CommandGenerator extends BaseCommand
$class, $class,
['{group}', '{command}'], ['{group}', '{command}'],
[$group, $command], [$group, $command],
['type' => $type] ['type' => $type],
); );
} }
} }

View File

@ -130,7 +130,7 @@ class ControllerGenerator extends BaseCommand
$class, $class,
['{useStatement}', '{extends}'], ['{useStatement}', '{extends}'],
[$useStatement, $extends], [$useStatement, $extends],
['type' => $rest] ['type' => $rest],
); );
} }
} }

View File

@ -102,9 +102,9 @@ class TestGenerator extends BaseCommand
str_replace( str_replace(
'/', '/',
'\\', '\\',
$this->getOption('namespace') $this->getOption('namespace'),
), ),
'\\' '\\',
); );
} }
@ -143,7 +143,7 @@ class TestGenerator extends BaseCommand
CLI::error( CLI::error(
lang('CLI.namespaceNotDefined', [$namespace]), lang('CLI.namespaceNotDefined', [$namespace]),
'light_gray', 'light_gray',
'red' 'red',
); );
CLI::newLine(); CLI::newLine();
@ -157,7 +157,7 @@ class TestGenerator extends BaseCommand
. str_replace( . str_replace(
'\\', '\\',
DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR,
trim(str_replace($namespace . '\\', '', $class), '\\') trim(str_replace($namespace . '\\', '', $class), '\\'),
) . '.php'; ) . '.php';
return implode( return implode(
@ -165,8 +165,8 @@ class TestGenerator extends BaseCommand
array_slice( array_slice(
explode(DIRECTORY_SEPARATOR, $file), explode(DIRECTORY_SEPARATOR, $file),
0, 0,
-1 -1,
) ),
) . DIRECTORY_SEPARATOR . $this->basename($file); ) . DIRECTORY_SEPARATOR . $this->basename($file);
} }

View File

@ -70,7 +70,7 @@ class LocalizationFinder extends BaseCommand
if (! in_array($optionLocale, config(App::class)->supportedLocales, true)) { if (! in_array($optionLocale, config(App::class)->supportedLocales, true)) {
CLI::error( CLI::error(
'Error: "' . $optionLocale . '" is not supported. Supported locales: ' 'Error: "' . $optionLocale . '" is not supported. Supported locales: '
. implode(', ', config(App::class)->supportedLocales) . implode(', ', config(App::class)->supportedLocales),
); );
return EXIT_USER_INPUT; return EXIT_USER_INPUT;
@ -116,7 +116,7 @@ class LocalizationFinder extends BaseCommand
[ [
'foundLanguageKeys' => $foundLanguageKeys, 'foundLanguageKeys' => $foundLanguageKeys,
'badLanguageKeys' => $badLanguageKeys, 'badLanguageKeys' => $badLanguageKeys,
'countFiles' => $countFiles 'countFiles' => $countFiles,
] = $this->findLanguageKeysInFiles($files); ] = $this->findLanguageKeysInFiles($files);
ksort($foundLanguageKeys); ksort($foundLanguageKeys);

View File

@ -109,7 +109,7 @@ final class ConfigCheck extends BaseCommand
CLI::write($this->getKintD($config)); CLI::write($this->getKintD($config));
} else { } else {
CLI::write( CLI::write(
CLI::color($this->getVarDump($config), 'cyan') CLI::color($this->getVarDump($config), 'cyan'),
); );
} }
@ -150,7 +150,7 @@ final class ConfigCheck extends BaseCommand
return preg_replace( return preg_replace(
'!.*system/Commands/Utilities/ConfigCheck.php.*\n!u', '!.*system/Commands/Utilities/ConfigCheck.php.*\n!u',
'', '',
$output $output,
); );
} }
} }

View File

@ -151,7 +151,7 @@ final class Environment extends BaseCommand
return file_put_contents( return file_put_contents(
$envFile, $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; ) !== false && $count > 0;
} }
} }

View File

@ -100,7 +100,7 @@ class FilterCheck extends BaseCommand
CLI::color( CLI::color(
'"' . strtoupper($method) . ' ' . $route . '"', '"' . strtoupper($method) . ' ' . $route . '"',
'black', 'black',
'light_gray' 'light_gray',
), ),
); );

View File

@ -110,13 +110,13 @@ final class Optimize extends BaseCommand
[ [
'public bool $configCacheEnabled = false;' => 'public bool $configCacheEnabled = true;', 'public bool $configCacheEnabled = false;' => 'public bool $configCacheEnabled = true;',
'public bool $locatorCacheEnabled = false;' => 'public bool $locatorCacheEnabled = true;', 'public bool $locatorCacheEnabled = false;' => 'public bool $locatorCacheEnabled = true;',
] ],
); );
if ($result) { if ($result) {
CLI::write( CLI::write(
'Config Caching and FileLocator Caching are enabled in "app/Config/Optimize.php".', 'Config Caching and FileLocator Caching are enabled in "app/Config/Optimize.php".',
'green' 'green',
); );
return; return;

View File

@ -133,7 +133,7 @@ class Routes extends BaseCommand
$collection->getDefaultController(), $collection->getDefaultController(),
$collection->getDefaultMethod(), $collection->getDefaultMethod(),
$methods, $methods,
$collection->getRegisteredControllers('*') $collection->getRegisteredControllers('*'),
); );
$autoRoutes = $autoRouteCollector->get(); $autoRoutes = $autoRouteCollector->get();
@ -149,7 +149,7 @@ class Routes extends BaseCommand
$collection->getDefaultMethod(), $collection->getDefaultMethod(),
$methods, $methods,
$collection->getRegisteredControllers('*'), $collection->getRegisteredControllers('*'),
$uri $uri,
); );
$autoRoutes = [...$autoRoutes, ...$autoRouteCollector->get()]; $autoRoutes = [...$autoRoutes, ...$autoRouteCollector->get()];
@ -159,7 +159,7 @@ class Routes extends BaseCommand
$autoRouteCollector = new AutoRouteCollector( $autoRouteCollector = new AutoRouteCollector(
$collection->getDefaultNamespace(), $collection->getDefaultNamespace(),
$collection->getDefaultController(), $collection->getDefaultController(),
$collection->getDefaultMethod() $collection->getDefaultMethod(),
); );
$autoRoutes = $autoRouteCollector->get(); $autoRoutes = $autoRouteCollector->get();

View File

@ -41,7 +41,7 @@ final class AutoRouteCollector
$output = $reader->read( $output = $reader->read(
$class, $class,
$this->defaultController, $this->defaultController,
$this->defaultMethod $this->defaultMethod,
); );
foreach ($output as $item) { foreach ($output as $item) {

View File

@ -36,7 +36,7 @@ final class AutoRouteCollector
private readonly string $defaultMethod, private readonly string $defaultMethod,
private readonly array $httpMethods, private readonly array $httpMethods,
private readonly array $protectedControllers, private readonly array $protectedControllers,
private readonly string $prefix = '' private readonly string $prefix = '',
) { ) {
} }
@ -59,7 +59,7 @@ final class AutoRouteCollector
$routes = $reader->read( $routes = $reader->read(
$class, $class,
$this->defaultController, $this->defaultController,
$this->defaultMethod $this->defaultMethod,
); );
if ($routes === []) { if ($routes === []) {

View File

@ -33,7 +33,7 @@ final class ControllerMethodReader
*/ */
public function __construct( public function __construct(
private readonly string $namespace, private readonly string $namespace,
private readonly array $httpMethods private readonly array $httpMethods,
) { ) {
$config = config(Routing::class); $config = config(Routing::class);
$this->translateURIDashes = $config->translateURIDashes; $this->translateURIDashes = $config->translateURIDashes;
@ -78,7 +78,7 @@ final class ControllerMethodReader
$classname, $classname,
$methodName, $methodName,
$httpVerb, $httpVerb,
$method $method,
); );
if ($routeForDefaultController !== []) { if ($routeForDefaultController !== []) {
@ -193,7 +193,7 @@ final class ControllerMethodReader
{ {
if ($this->translateUriToCamelCase) { if ($this->translateUriToCamelCase) {
$string = strtolower( $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) { } elseif ($this->translateURIDashes) {
$string = str_replace('_', '-', $string); $string = str_replace('_', '-', $string);
@ -214,7 +214,7 @@ final class ControllerMethodReader
string $classname, string $classname,
string $methodName, string $methodName,
string $httpVerb, string $httpVerb,
ReflectionMethod $method ReflectionMethod $method,
): array { ): array {
$output = []; $output = [];

View File

@ -28,7 +28,7 @@ final class ControllerFinder
* @param string $namespace namespace to search * @param string $namespace namespace to search
*/ */
public function __construct( public function __construct(
private readonly string $namespace private readonly string $namespace,
) { ) {
$this->locator = service('locator'); $this->locator = service('locator');
} }

View File

@ -57,7 +57,7 @@ final class ControllerMethodReader
$defaultController, $defaultController,
$uriByClass, $uriByClass,
$classname, $classname,
$methodName $methodName,
); );
$output = [...$output, ...$routeWithoutController]; $output = [...$output, ...$routeWithoutController];
@ -89,7 +89,7 @@ final class ControllerMethodReader
$defaultController, $defaultController,
$uriByClass, $uriByClass,
$classname, $classname,
$methodName $methodName,
); );
$output = [...$output, ...$routeWithoutController]; $output = [...$output, ...$routeWithoutController];
@ -153,7 +153,7 @@ final class ControllerMethodReader
string $defaultController, string $defaultController,
string $uriByClass, string $uriByClass,
string $classname, string $classname,
string $methodName string $methodName,
): array { ): array {
if ($classShortname !== $defaultController) { if ($classShortname !== $defaultController) {
return []; return [];

View File

@ -32,7 +32,7 @@ final class FilterCollector
* *
* If set to true, route filters are not found. * If set to true, route filters are not found.
*/ */
private readonly bool $resetRoutes = false private readonly bool $resetRoutes = false,
) { ) {
} }
@ -50,7 +50,7 @@ final class FilterCollector
@trigger_error( @trigger_error(
'Passing lowercase HTTP method "' . $method . '" is deprecated.' 'Passing lowercase HTTP method "' . $method . '" is deprecated.'
. ' Use uppercase HTTP method like "' . strtoupper($method) . '".', . ' Use uppercase HTTP method like "' . strtoupper($method) . '".',
E_USER_DEPRECATED E_USER_DEPRECATED,
); );
} }

View File

@ -57,7 +57,7 @@ final class SampleURIGenerator
$sampleUri = str_replace( $sampleUri = str_replace(
'{locale}', '{locale}',
config(App::class)->defaultLocale, config(App::class)->defaultLocale,
$routeKey $routeKey,
); );
} }

View File

@ -146,7 +146,7 @@ if (! function_exists('command')) {
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
throw new InvalidArgumentException(sprintf( throw new InvalidArgumentException(sprintf(
'Unable to parse input near "... %s ...".', 'Unable to parse input near "... %s ...".',
substr($command, $cursor, 10) substr($command, $cursor, 10),
)); ));
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
} }
@ -470,7 +470,7 @@ if (! function_exists('force_https')) {
function force_https( function force_https(
int $duration = 31_536_000, int $duration = 31_536_000,
?RequestInterface $request = null, ?RequestInterface $request = null,
?ResponseInterface $response = null ?ResponseInterface $response = null,
): void { ): void {
$request ??= service('request'); $request ??= service('request');
@ -1065,7 +1065,7 @@ if (! function_exists('slash_item')) {
'Cannot convert "%s::$%s" of type "%s" to type "string".', 'Cannot convert "%s::$%s" of type "%s" to type "string".',
App::class, App::class,
$item, $item,
gettype($configItem) gettype($configItem),
)); ));
} }

View File

@ -102,7 +102,7 @@ final class ComposerScripts
/** @var SplFileInfo $file */ /** @var SplFileInfo $file */
foreach (new RecursiveIteratorIterator( foreach (new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(rtrim($directory, '\\/'), FilesystemIterator::SKIP_DOTS), new RecursiveDirectoryIterator(rtrim($directory, '\\/'), FilesystemIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST RecursiveIteratorIterator::CHILD_FIRST,
) as $file) { ) as $file) {
$path = $file->getPathname(); $path = $file->getPathname();
@ -146,7 +146,7 @@ final class ComposerScripts
/** @var SplFileInfo $file */ /** @var SplFileInfo $file */
foreach (new RecursiveIteratorIterator( foreach (new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($originDir, FilesystemIterator::SKIP_DOTS), new RecursiveDirectoryIterator($originDir, FilesystemIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST RecursiveIteratorIterator::SELF_FIRST,
) as $file) { ) as $file) {
$origin = $file->getPathname(); $origin = $file->getPathname();
$target = $targetDir . substr($origin, $dirLen); $target = $targetDir . substr($origin, $dirLen);

View File

@ -164,7 +164,7 @@ class DotEnv
%1$s # and the closing quote %1$s # and the closing quote
.*$ # and discard any string after the closing quote .*$ # and discard any string after the closing quote
/mx', /mx',
$quote $quote,
); );
$value = preg_replace($regexPattern, '$1', $value); $value = preg_replace($regexPattern, '$1', $value);
@ -206,7 +206,7 @@ class DotEnv
return $nestedVariable; return $nestedVariable;
}, },
$value $value,
); );
} }

View File

@ -106,7 +106,7 @@ final class Factories
} }
throw new InvalidArgumentException( 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 @@ final class Factories
self::$options[$component], self::$options[$component],
self::$aliases[$component], self::$aliases[$component],
self::$instances[$component], self::$instances[$component],
self::$updated[$component] self::$updated[$component],
); );
return; return;

View File

@ -213,7 +213,7 @@ class Services extends BaseService
$config, $config,
new URI($options['baseURI'] ?? null), new URI($options['baseURI'] ?? null),
$response, $response,
$options $options,
); );
} }
@ -267,7 +267,7 @@ class Services extends BaseService
*/ */
public static function exceptions( public static function exceptions(
?ExceptionsConfig $config = null, ?ExceptionsConfig $config = null,
bool $getShared = true bool $getShared = true,
) { ) {
if ($getShared) { if ($getShared) {
return static::getSharedInstance('exceptions', $config); return static::getSharedInstance('exceptions', $config);
@ -569,7 +569,7 @@ class Services extends BaseService
$config, $config,
AppServices::get('uri'), AppServices::get('uri'),
'php://input', 'php://input',
new UserAgent() new UserAgent(),
); );
} }
@ -689,7 +689,7 @@ class Services extends BaseService
if (! class_exists($driverName) || ! is_a($driverName, SessionBaseHandler::class, true)) { if (! class_exists($driverName) || ! is_a($driverName, SessionBaseHandler::class, true)) {
throw new InvalidArgumentException(sprintf( throw new InvalidArgumentException(sprintf(
'Invalid session handler "%s" provided.', 'Invalid session handler "%s" provided.',
$driverName $driverName,
)); ));
} }
@ -721,7 +721,7 @@ class Services extends BaseService
public static function siteurifactory( public static function siteurifactory(
?App $config = null, ?App $config = null,
?Superglobals $superglobals = null, ?Superglobals $superglobals = null,
bool $getShared = true bool $getShared = true,
) { ) {
if ($getShared) { if ($getShared) {
return static::getSharedInstance('siteurifactory', $config, $superglobals); return static::getSharedInstance('siteurifactory', $config, $superglobals);
@ -741,7 +741,7 @@ class Services extends BaseService
public static function superglobals( public static function superglobals(
?array $server = null, ?array $server = null,
?array $get = null, ?array $get = null,
bool $getShared = true bool $getShared = true,
) { ) {
if ($getShared) { if ($getShared) {
return static::getSharedInstance('superglobals', $server, $get); return static::getSharedInstance('superglobals', $server, $get);

View File

@ -24,7 +24,7 @@ class ArrayCast extends BaseCast implements CastInterface
public static function get( public static function get(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): array { ): array {
if (! is_string($value)) { if (! is_string($value)) {
self::invalidTypeValueError($value); self::invalidTypeValueError($value);
@ -40,7 +40,7 @@ class ArrayCast extends BaseCast implements CastInterface
public static function set( public static function set(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): string { ): string {
return serialize($value); return serialize($value);
} }

View File

@ -20,7 +20,7 @@ abstract class BaseCast implements CastInterface
public static function get( public static function get(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): mixed { ): mixed {
return $value; return $value;
} }
@ -28,7 +28,7 @@ abstract class BaseCast implements CastInterface
public static function set( public static function set(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): mixed { ): mixed {
return $value; return $value;
} }

View File

@ -24,7 +24,7 @@ class BooleanCast extends BaseCast
public static function get( public static function get(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): bool { ): bool {
// For PostgreSQL // For PostgreSQL
if ($value === 't') { if ($value === 't') {

View File

@ -24,7 +24,7 @@ class CSVCast extends BaseCast
public static function get( public static function get(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): array { ): array {
if (! is_string($value)) { if (! is_string($value)) {
self::invalidTypeValueError($value); self::invalidTypeValueError($value);
@ -36,7 +36,7 @@ class CSVCast extends BaseCast
public static function set( public static function set(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): string { ): string {
if (! is_array($value)) { if (! is_array($value)) {
self::invalidTypeValueError($value); self::invalidTypeValueError($value);

View File

@ -27,7 +27,7 @@ interface CastInterface
public static function get( public static function get(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): mixed; ): mixed;
/** /**
@ -42,6 +42,6 @@ interface CastInterface
public static function set( public static function set(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): mixed; ): mixed;
} }

View File

@ -28,7 +28,7 @@ class DatetimeCast extends BaseCast
public static function get( public static function get(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): Time { ): Time {
if (! is_string($value)) { if (! is_string($value)) {
self::invalidTypeValueError($value); self::invalidTypeValueError($value);
@ -56,7 +56,7 @@ class DatetimeCast extends BaseCast
public static function set( public static function set(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): string { ): string {
if (! $value instanceof Time) { if (! $value instanceof Time) {
self::invalidTypeValueError($value); self::invalidTypeValueError($value);

View File

@ -24,7 +24,7 @@ class FloatCast extends BaseCast
public static function get( public static function get(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): float { ): float {
if (! is_float($value) && ! is_string($value)) { if (! is_float($value) && ! is_string($value)) {
self::invalidTypeValueError($value); self::invalidTypeValueError($value);

View File

@ -24,7 +24,7 @@ final class IntBoolCast extends BaseCast
public static function get( public static function get(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): bool { ): bool {
if (! is_int($value) && ! is_string($value)) { if (! is_int($value) && ! is_string($value)) {
self::invalidTypeValueError($value); self::invalidTypeValueError($value);
@ -36,7 +36,7 @@ final class IntBoolCast extends BaseCast
public static function set( public static function set(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): int { ): int {
if (! is_bool($value)) { if (! is_bool($value)) {
self::invalidTypeValueError($value); self::invalidTypeValueError($value);

View File

@ -24,7 +24,7 @@ class IntegerCast extends BaseCast
public static function get( public static function get(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): int { ): int {
if (! is_string($value) && ! is_int($value)) { if (! is_string($value) && ! is_int($value)) {
self::invalidTypeValueError($value); self::invalidTypeValueError($value);

View File

@ -28,7 +28,7 @@ class JsonCast extends BaseCast
public static function get( public static function get(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): array|stdClass { ): array|stdClass {
if (! is_string($value)) { if (! is_string($value)) {
self::invalidTypeValueError($value); self::invalidTypeValueError($value);
@ -50,7 +50,7 @@ class JsonCast extends BaseCast
public static function set( public static function set(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): string { ): string {
try { try {
$output = json_encode($value, JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR); $output = json_encode($value, JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR);

View File

@ -26,7 +26,7 @@ class TimestampCast extends BaseCast
public static function get( public static function get(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): Time { ): Time {
if (! is_int($value) && ! is_string($value)) { if (! is_int($value) && ! is_string($value)) {
self::invalidTypeValueError($value); self::invalidTypeValueError($value);
@ -38,7 +38,7 @@ class TimestampCast extends BaseCast
public static function set( public static function set(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): int { ): int {
if (! $value instanceof Time) { if (! $value instanceof Time) {
self::invalidTypeValueError($value); self::invalidTypeValueError($value);

View File

@ -26,7 +26,7 @@ class URICast extends BaseCast
public static function get( public static function get(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): URI { ): URI {
if (! is_string($value)) { if (! is_string($value)) {
self::invalidTypeValueError($value); self::invalidTypeValueError($value);
@ -38,7 +38,7 @@ class URICast extends BaseCast
public static function set( public static function set(
mixed $value, mixed $value,
array $params = [], array $params = [],
?object $helper = null ?object $helper = null,
): string { ): string {
if (! $value instanceof URI) { if (! $value instanceof URI) {
self::invalidTypeValueError($value); self::invalidTypeValueError($value);

View File

@ -68,7 +68,7 @@ final class DataCaster
?array $castHandlers = null, ?array $castHandlers = null,
?array $types = null, ?array $types = null,
private readonly ?object $helper = null, private readonly ?object $helper = null,
private readonly bool $strict = true private readonly bool $strict = true,
) { ) {
$this->castHandlers = array_merge($this->castHandlers, $castHandlers); $this->castHandlers = array_merge($this->castHandlers, $castHandlers);
@ -83,7 +83,7 @@ final class DataCaster
&& ! is_subclass_of($handler, EntityCastInterface::class) && ! is_subclass_of($handler, EntityCastInterface::class)
) { ) {
throw new InvalidArgumentException( 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 @@ final class DataCaster
if (! isset($handlers[$type])) { if (! isset($handlers[$type])) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
'No such handler for "' . $field . '". Invalid type: ' . $type 'No such handler for "' . $field . '". Invalid type: ' . $type,
); );
} }

View File

@ -807,7 +807,7 @@ class BaseBuilder
'/\s*(!?=|<>|IS(?:\s+NOT)?)\s*$/i', '/\s*(!?=|<>|IS(?:\s+NOT)?)\s*$/i',
$k, $k,
$match, $match,
PREG_OFFSET_CAPTURE PREG_OFFSET_CAPTURE,
) )
) { ) {
$k = substr($k, 0, $match[0][1]); $k = substr($k, 0, $match[0][1]);
@ -2022,8 +2022,8 @@ class BaseBuilder
' = ' . $value : ' = ' . $value :
' = VALUES(' . $value . ')'), ' = VALUES(' . $value . ')'),
array_keys($updateFields), array_keys($updateFields),
$updateFields $updateFields,
) ),
); );
$this->QBOptions['sql'] = $sql; $this->QBOptions['sql'] = $sql;
@ -2291,10 +2291,10 @@ class BaseBuilder
$this->removeAlias($this->QBFrom[0]), $this->removeAlias($this->QBFrom[0]),
true, true,
null, null,
false false,
), ),
array_keys($this->QBSet), array_keys($this->QBSet),
array_values($this->QBSet) array_values($this->QBSet),
); );
if ($reset) { if ($reset) {
@ -2328,10 +2328,10 @@ class BaseBuilder
$this->removeAlias($this->QBFrom[0]), $this->removeAlias($this->QBFrom[0]),
true, true,
$escape, $escape,
false false,
), ),
array_keys($this->QBSet), array_keys($this->QBSet),
array_values($this->QBSet) array_values($this->QBSet),
); );
if (! $this->testMode) { if (! $this->testMode) {
@ -2653,8 +2653,8 @@ class BaseBuilder
' = ' . $value : ' = ' . $value :
' = ' . $alias . '.' . $value), ' = ' . $alias . '.' . $value),
array_keys($updateFields), array_keys($updateFields),
$updateFields $updateFields,
) ),
) . "\n"; ) . "\n";
$sql .= "FROM (\n{:_table_:}"; $sql .= "FROM (\n{:_table_:}";
@ -2678,8 +2678,8 @@ class BaseBuilder
) )
), ),
array_keys($constraints), array_keys($constraints),
$constraints $constraints,
) ),
); );
$this->QBOptions['sql'] = $sql; $this->QBOptions['sql'] = $sql;
@ -2694,10 +2694,10 @@ class BaseBuilder
static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($value): string => 'SELECT ' . implode(', ', array_map(
static fn ($key, $index): string => $index . ' ' . $key, static fn ($key, $index): string => $index . ' ' . $key,
$keys, $keys,
$value $value,
)), )),
$values $values,
) ),
) . "\n"; ) . "\n";
} }
@ -2924,8 +2924,8 @@ class BaseBuilder
) )
), ),
array_keys($constraints), array_keys($constraints),
$constraints $constraints,
) ),
); );
// convert binds in where // convert binds in where
@ -2949,10 +2949,10 @@ class BaseBuilder
static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($value): string => 'SELECT ' . implode(', ', array_map(
static fn ($key, $index): string => $index . ' ' . $key, static fn ($key, $index): string => $index . ' ' . $key,
$keys, $keys,
$value $value,
)), )),
$values $values,
) ),
) . "\n"; ) . "\n";
} }
@ -3160,7 +3160,7 @@ class BaseBuilder
'/((?:^|\s+)AND\s+|(?:^|\s+)OR\s+)/i', '/((?:^|\s+)AND\s+|(?:^|\s+)OR\s+)/i',
$qbkey['condition'], $qbkey['condition'],
-1, -1,
PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY,
); );
foreach ($conditions as &$condition) { foreach ($conditions as &$condition) {
@ -3170,7 +3170,7 @@ class BaseBuilder
|| preg_match( || preg_match(
'/^(\(?)(.*)(' . preg_quote($op, '/') . ')\s*(.*(?<!\)))?(\)?)$/i', '/^(\(?)(.*)(' . preg_quote($op, '/') . ')\s*(.*(?<!\)))?(\)?)$/i',
$condition, $condition,
$matches $matches,
) !== 1 ) !== 1
) { ) {
continue; continue;
@ -3436,7 +3436,7 @@ class BaseBuilder
{ {
return preg_match( return preg_match(
'/(<|>|!|=|\sIS NULL|\sIS NOT NULL|\sEXISTS|\sBETWEEN|\sLIKE|\sIN\s*\(|\s)/i', '/(<|>|!|=|\sIS NULL|\sIS NOT NULL|\sEXISTS|\sBETWEEN|\sLIKE|\sIN\s*\(|\s)/i',
trim($str) trim($str),
) === 1; ) === 1;
} }
@ -3470,7 +3470,7 @@ class BaseBuilder
return preg_match_all( return preg_match_all(
'/' . implode('|', $this->pregOperators) . '/i', '/' . implode('|', $this->pregOperators) . '/i',
$str, $str,
$match $match,
) >= 1 ? ($list ? $match[0] : $match[0][0]) : false; ) >= 1 ? ($list ? $match[0] : $match[0][0]) : false;
} }
@ -3501,7 +3501,7 @@ class BaseBuilder
return preg_match_all( return preg_match_all(
'/' . implode('|', $pregOperators) . '/i', '/' . implode('|', $pregOperators) . '/i',
$whereKey, $whereKey,
$match $match,
) >= 1 ? $match[0] : false; ) >= 1 ? $match[0] : false;
} }

View File

@ -424,7 +424,7 @@ abstract class BaseConnection implements ConnectionInterface
$connectionErrors[] = sprintf( $connectionErrors[] = sprintf(
'Main connection [%s]: %s', 'Main connection [%s]: %s',
$this->DBDriver, $this->DBDriver,
$e->getMessage() $e->getMessage(),
); );
log_message('error', 'Error connecting to the database: ' . $e); log_message('error', 'Error connecting to the database: ' . $e);
} }
@ -450,7 +450,7 @@ abstract class BaseConnection implements ConnectionInterface
'Failover #%d [%s]: %s', 'Failover #%d [%s]: %s',
++$index, ++$index,
$this->DBDriver, $this->DBDriver,
$e->getMessage() $e->getMessage(),
); );
log_message('error', 'Error connecting to the database: ' . $e); log_message('error', 'Error connecting to the database: ' . $e);
} }
@ -467,7 +467,7 @@ abstract class BaseConnection implements ConnectionInterface
throw new DatabaseException(sprintf( throw new DatabaseException(sprintf(
'Unable to connect to the database.%s%s', 'Unable to connect to the database.%s%s',
PHP_EOL, PHP_EOL,
implode(PHP_EOL, $connectionErrors) implode(PHP_EOL, $connectionErrors),
)); ));
} }
} }
@ -688,7 +688,7 @@ abstract class BaseConnection implements ConnectionInterface
throw new DatabaseException( throw new DatabaseException(
$exception->getMessage(), $exception->getMessage(),
$exception->getCode(), $exception->getCode(),
$exception $exception,
); );
} }
@ -1220,7 +1220,7 @@ abstract class BaseConnection implements ConnectionInterface
. str_replace( . str_replace(
$this->escapeChar, $this->escapeChar,
$this->escapeChar . $this->escapeChar, $this->escapeChar . $this->escapeChar,
$item $item,
) )
. $this->escapeChar; . $this->escapeChar;
} }
@ -1277,7 +1277,7 @@ abstract class BaseConnection implements ConnectionInterface
return preg_replace( return preg_replace(
'/' . $this->pregEscapeChar[0] . '?([^' . $this->pregEscapeChar[1] . '\.]+)' . $this->pregEscapeChar[1] . '?\./i', '/' . $this->pregEscapeChar[0] . '?([^' . $this->pregEscapeChar[1] . '\.]+)' . $this->pregEscapeChar[1] . '?\./i',
$this->pregEscapeChar[2] . '$1' . $this->pregEscapeChar[3] . '.', $this->pregEscapeChar[2] . '$1' . $this->pregEscapeChar[3] . '.',
$item $item,
); );
} }
} }
@ -1286,7 +1286,7 @@ abstract class BaseConnection implements ConnectionInterface
return preg_replace( return preg_replace(
'/' . $this->pregEscapeChar[0] . '?([^' . $this->pregEscapeChar[1] . '\.]+)' . $this->pregEscapeChar[1] . '?(\.)?/i', '/' . $this->pregEscapeChar[0] . '?([^' . $this->pregEscapeChar[1] . '\.]+)' . $this->pregEscapeChar[1] . '?(\.)?/i',
$this->pregEscapeChar[2] . '$1' . $this->pregEscapeChar[3] . '$2', $this->pregEscapeChar[2] . '$1' . $this->pregEscapeChar[3] . '$2',
$item $item,
); );
} }
@ -1386,7 +1386,7 @@ abstract class BaseConnection implements ConnectionInterface
$this->likeEscapeChar . '%', $this->likeEscapeChar . '%',
$this->likeEscapeChar . '_', $this->likeEscapeChar . '_',
], ],
$str $str,
); );
} }
@ -1522,7 +1522,7 @@ abstract class BaseConnection implements ConnectionInterface
$key = array_search( $key = array_search(
strtolower($tableName), strtolower($tableName),
array_map(strtolower(...), $this->dataCache['table_names']), 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 // table doesn't exist but still in cache - lets reset cache, it can be rebuilt later

View File

@ -217,7 +217,7 @@ abstract class BaseUtils
$line[] = $enclosure . str_replace( $line[] = $enclosure . str_replace(
$enclosure, $enclosure,
$enclosure . $enclosure, $enclosure . $enclosure,
(string) $item (string) $item,
) . $enclosure; ) . $enclosure;
} }

View File

@ -234,8 +234,8 @@ class Forge
$ifNotExists ? $this->createDatabaseIfStr : $this->createDatabaseStr, $ifNotExists ? $this->createDatabaseIfStr : $this->createDatabaseStr,
$this->db->escapeIdentifier($dbName), $this->db->escapeIdentifier($dbName),
$this->db->charset, $this->db->charset,
$this->db->DBCollat $this->db->DBCollat,
) ),
)) { )) {
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
if ($this->db->DBDebug) { if ($this->db->DBDebug) {
@ -294,7 +294,7 @@ class Forge
} }
if (! $this->db->query( if (! $this->db->query(
sprintf($this->dropDatabaseStr, $this->db->escapeIdentifier($dbName)) sprintf($this->dropDatabaseStr, $this->db->escapeIdentifier($dbName)),
)) { )) {
if ($this->db->DBDebug) { if ($this->db->DBDebug) {
throw new DatabaseException('Unable to drop the specified database.'); throw new DatabaseException('Unable to drop the specified database.');
@ -307,7 +307,7 @@ class Forge
$key = array_search( $key = array_search(
strtolower($dbName), strtolower($dbName),
array_map(strtolower(...), $this->db->dataCache['db_names']), array_map(strtolower(...), $this->db->dataCache['db_names']),
true true,
); );
if ($key !== false) { if ($key !== false) {
unset($this->db->dataCache['db_names'][$key]); unset($this->db->dataCache['db_names'][$key]);
@ -425,7 +425,7 @@ class Forge
$tableField = '', $tableField = '',
string $onUpdate = '', string $onUpdate = '',
string $onDelete = '', string $onDelete = '',
string $fkName = '' string $fkName = '',
): Forge { ): Forge {
$fieldName = (array) $fieldName; $fieldName = (array) $fieldName;
$tableField = (array) $tableField; $tableField = (array) $tableField;
@ -525,7 +525,7 @@ class Forge
$sql = sprintf( $sql = sprintf(
(string) $this->dropConstraintStr, (string) $this->dropConstraintStr,
$this->db->escapeIdentifiers($this->db->DBPrefix . $table), $this->db->escapeIdentifiers($this->db->DBPrefix . $table),
$this->db->escapeIdentifiers($foreignName) $this->db->escapeIdentifiers($foreignName),
); );
if ($sql === '') { if ($sql === '') {
@ -618,7 +618,7 @@ class Forge
'CREATE TABLE', 'CREATE TABLE',
$this->db->escapeIdentifiers($table), $this->db->escapeIdentifiers($table),
$processedFields, $processedFields,
$this->_createTableAttributes($attributes) $this->_createTableAttributes($attributes),
); );
} }
@ -668,7 +668,7 @@ class Forge
$key = array_search( $key = array_search(
strtolower($this->db->DBPrefix . $tableName), strtolower($this->db->DBPrefix . $tableName),
array_map(strtolower(...), $this->db->dataCache['table_names']), array_map(strtolower(...), $this->db->dataCache['table_names']),
true true,
); );
if ($key !== false) { if ($key !== false) {
@ -723,14 +723,14 @@ class Forge
$result = $this->db->query(sprintf( $result = $this->db->query(sprintf(
$this->renameTableStr, $this->renameTableStr,
$this->db->escapeIdentifiers($this->db->DBPrefix . $tableName), $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'])) { if ($result && ! empty($this->db->dataCache['table_names'])) {
$key = array_search( $key = array_search(
strtolower($this->db->DBPrefix . $tableName), strtolower($this->db->DBPrefix . $tableName),
array_map(strtolower(...), $this->db->dataCache['table_names']), array_map(strtolower(...), $this->db->dataCache['table_names']),
true true,
); );
if ($key !== false) { if ($key !== false) {
@ -1112,7 +1112,7 @@ class Forge
$this->fields = array_combine( $this->fields = array_combine(
array_map(static fn ($columnName) => $columnName->name, $fieldData), array_map(static fn ($columnName) => $columnName->name, $fieldData),
array_fill(0, count($fieldData), []) array_fill(0, count($fieldData), []),
); );
} }

View File

@ -605,7 +605,7 @@ class MigrationRunner
CLI::color(lang('Migrations.added'), 'yellow'), CLI::color(lang('Migrations.added'), 'yellow'),
$migration->namespace, $migration->namespace,
$migration->version, $migration->version,
$migration->class $migration->class,
); );
} }
} }
@ -625,7 +625,7 @@ class MigrationRunner
CLI::color(lang('Migrations.removed'), 'yellow'), CLI::color(lang('Migrations.removed'), 'yellow'),
$history->namespace, $history->namespace,
$history->version, $history->version,
$history->class $history->class,
); );
} }
} }

View File

@ -106,8 +106,8 @@ class Builder extends BaseBuilder
) )
), ),
array_keys($constraints), array_keys($constraints),
$constraints $constraints,
) ),
) . "\n"; ) . "\n";
$sql .= "SET\n"; $sql .= "SET\n";
@ -119,8 +119,8 @@ class Builder extends BaseBuilder
' = ' . $value : ' = ' . $value :
' = ' . $alias . '.' . $value), ' = ' . $alias . '.' . $value),
array_keys($updateFields), array_keys($updateFields),
$updateFields $updateFields,
) ),
); );
$this->QBOptions['sql'] = $sql; $this->QBOptions['sql'] = $sql;
@ -135,10 +135,10 @@ class Builder extends BaseBuilder
static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($value): string => 'SELECT ' . implode(', ', array_map(
static fn ($key, $index): string => $index . ' ' . $key, static fn ($key, $index): string => $index . ' ' . $key,
$keys, $keys,
$value $value,
)), )),
$values $values,
) ),
) . "\n"; ) . "\n";
} }

View File

@ -116,7 +116,7 @@ class Connection extends BaseConnection
if ($this->strictOn) { if ($this->strictOn) {
$this->mysqli->options( $this->mysqli->options(
MYSQLI_INIT_COMMAND, MYSQLI_INIT_COMMAND,
"SET SESSION sql_mode = CONCAT(@@sql_mode, ',', 'STRICT_ALL_TABLES')" "SET SESSION sql_mode = CONCAT(@@sql_mode, ',', 'STRICT_ALL_TABLES')",
); );
} else { } else {
$this->mysqli->options( $this->mysqli->options(
@ -128,7 +128,7 @@ class Connection extends BaseConnection
'STRICT_ALL_TABLES', ''), 'STRICT_ALL_TABLES', ''),
'STRICT_TRANS_TABLES,', ''), 'STRICT_TRANS_TABLES,', ''),
',STRICT_TRANS_TABLES', ''), ',STRICT_TRANS_TABLES', ''),
'STRICT_TRANS_TABLES', '')" 'STRICT_TRANS_TABLES', '')",
); );
} }
} }
@ -175,7 +175,7 @@ class Connection extends BaseConnection
$ssl['cert'] ?? null, $ssl['cert'] ?? null,
$ssl['ca'] ?? null, $ssl['ca'] ?? null,
$ssl['capath'] ?? null, $ssl['capath'] ?? null,
$ssl['cipher'] ?? null $ssl['cipher'] ?? null,
); );
} }
@ -190,7 +190,7 @@ class Connection extends BaseConnection
$this->database, $this->database,
$port, $port,
$socket, $socket,
$clientFlags $clientFlags,
)) { )) {
// Prior to version 5.7.3, MySQL silently downgrades to an unencrypted connection if SSL setup fails // 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', '<=') if (($clientFlags & MYSQLI_CLIENT_SSL) !== 0 && version_compare($this->mysqli->client_info, 'mysqlnd 5.7.3', '<=')
@ -381,7 +381,7 @@ class Connection extends BaseConnection
return str_replace( return str_replace(
[$this->likeEscapeChar, '%', '_'], [$this->likeEscapeChar, '%', '_'],
['\\' . $this->likeEscapeChar, '\\%', '\\_'], ['\\' . $this->likeEscapeChar, '\\%', '\\_'],
$str $str,
); );
} }

View File

@ -258,7 +258,7 @@ class Forge extends BaseForge
{ {
$sql = sprintf( $sql = sprintf(
'ALTER TABLE %s DROP PRIMARY KEY', '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); return $this->db->query($sql);

View File

@ -92,10 +92,10 @@ class Builder extends BaseBuilder
static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($value): string => 'SELECT ' . implode(', ', array_map(
static fn ($key, $index): string => $index . ' ' . $key, static fn ($key, $index): string => $index . ' ' . $key,
$keys, $keys,
$value $value,
)), )),
$values $values,
) ),
) . " FROM DUAL\n"; ) . " FROM DUAL\n";
} }
@ -287,8 +287,8 @@ class Builder extends BaseBuilder
) )
), ),
array_keys($constraints), array_keys($constraints),
$constraints $constraints,
) ),
) . ")\n"; ) . ")\n";
$sql .= "WHEN MATCHED THEN UPDATE\n"; $sql .= "WHEN MATCHED THEN UPDATE\n";
@ -302,8 +302,8 @@ class Builder extends BaseBuilder
' = ' . $value : ' = ' . $value :
' = ' . $alias . '.' . $value), ' = ' . $alias . '.' . $value),
array_keys($updateFields), array_keys($updateFields),
$updateFields $updateFields,
) ),
); );
$this->QBOptions['sql'] = $sql; $this->QBOptions['sql'] = $sql;
@ -318,10 +318,10 @@ class Builder extends BaseBuilder
static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($value): string => 'SELECT ' . implode(', ', array_map(
static fn ($key, $index): string => $index . ' ' . $key, static fn ($key, $index): string => $index . ' ' . $key,
$keys, $keys,
$value $value,
)) . ' FROM DUAL', )) . ' FROM DUAL',
$values $values,
) ),
) . "\n"; ) . "\n";
} }
@ -392,8 +392,8 @@ class Builder extends BaseBuilder
) )
), ),
array_keys($constraints), array_keys($constraints),
$constraints $constraints,
) ),
) . ")\n"; ) . ")\n";
$sql .= "WHEN MATCHED THEN UPDATE SET\n"; $sql .= "WHEN MATCHED THEN UPDATE SET\n";
@ -405,8 +405,8 @@ class Builder extends BaseBuilder
" = {$value}" : " = {$value}" :
" = {$alias}.{$value}"), " = {$alias}.{$value}"),
array_keys($updateFields), array_keys($updateFields),
$updateFields $updateFields,
) ),
); );
$sql .= "\nWHEN NOT MATCHED THEN INSERT (" . implode(', ', $keys) . ")\nVALUES "; $sql .= "\nWHEN NOT MATCHED THEN INSERT (" . implode(', ', $keys) . ")\nVALUES ";
@ -427,10 +427,10 @@ class Builder extends BaseBuilder
static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($value): string => 'SELECT ' . implode(', ', array_map(
static fn ($key, $index): string => $index . ' ' . $key, static fn ($key, $index): string => $index . ' ' . $key,
$keys, $keys,
$value $value,
)), )),
$values $values,
) ),
) . " FROM DUAL\n"; ) . " FROM DUAL\n";
} }
@ -477,8 +477,8 @@ class Builder extends BaseBuilder
) )
), ),
array_keys($constraints), array_keys($constraints),
$constraints $constraints,
) ),
); );
// convert binds in where // convert binds in where
@ -491,7 +491,7 @@ class Builder extends BaseBuilder
$sql .= ' ' . str_replace( $sql .= ' ' . str_replace(
'WHERE ', 'WHERE ',
'AND ', 'AND ',
$this->compileWhereHaving('QBWhere') $this->compileWhereHaving('QBWhere'),
) . ')'; ) . ')';
$this->QBOptions['sql'] = $sql; $this->QBOptions['sql'] = $sql;
@ -506,10 +506,10 @@ class Builder extends BaseBuilder
static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($value): string => 'SELECT ' . implode(', ', array_map(
static fn ($key, $index): string => $index . ' ' . $key, static fn ($key, $index): string => $index . ' ' . $key,
$keys, $keys,
$value $value,
)), )),
$values $values,
) ),
) . " FROM DUAL\n"; ) . " FROM DUAL\n";
} }

View File

@ -523,7 +523,7 @@ class Connection extends BaseConnection
$sql = sprintf( $sql = sprintf(
'BEGIN %s (' . substr(str_repeat(',%s', count($params)), 1) . '); END;', 'BEGIN %s (' . substr(str_repeat(',%s', count($params)), 1) . '); END;',
$procedureName, $procedureName,
...array_map(static fn ($row) => $row['name'], $params) ...array_map(static fn ($row) => $row['name'], $params),
); );
$this->resetStmtId = false; $this->resetStmtId = false;
@ -554,7 +554,7 @@ class Connection extends BaseConnection
$param['name'], $param['name'],
$param['value'], $param['value'],
$param['length'] ?? -1, $param['length'] ?? -1,
$param['type'] ?? SQLT_CHR $param['type'] ?? SQLT_CHR,
); );
} }
} }

View File

@ -112,7 +112,7 @@ class Forge extends BaseForge
$fields = array_map( $fields = array_map(
fn ($field) => $this->db->escapeIdentifiers(trim($field)), 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'; return $sql . ' DROP (' . implode(',', $fields) . ') CASCADE CONSTRAINT INVALIDATE';

View File

@ -357,8 +357,8 @@ class Builder extends BaseBuilder
' = ' . $value : ' = ' . $value :
' = ' . $that->cast($alias . '.' . $value, $that->getFieldType($table, $key))), ' = ' . $that->cast($alias . '.' . $value, $that->getFieldType($table, $key))),
array_keys($updateFields), array_keys($updateFields),
$updateFields $updateFields,
) ),
) . "\n"; ) . "\n";
$sql .= "FROM (\n{:_table_:}"; $sql .= "FROM (\n{:_table_:}";
@ -381,8 +381,8 @@ class Builder extends BaseBuilder
. $that->cast($alias . '.' . $value, $that->getFieldType($table, $value)); . $that->cast($alias . '.' . $value, $that->getFieldType($table, $value));
}, },
array_keys($constraints), array_keys($constraints),
$constraints $constraints,
) ),
); );
$this->QBOptions['sql'] = $sql; $this->QBOptions['sql'] = $sql;
@ -397,10 +397,10 @@ class Builder extends BaseBuilder
static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($value): string => 'SELECT ' . implode(', ', array_map(
static fn ($key, $index): string => $index . ' ' . $key, static fn ($key, $index): string => $index . ' ' . $key,
$keys, $keys,
$value $value,
)), )),
$values $values,
) ),
) . "\n"; ) . "\n";
} }
@ -528,8 +528,8 @@ class Builder extends BaseBuilder
" = {$value}" : " = {$value}" :
" = {$alias}.{$value}"), " = {$alias}.{$value}"),
array_keys($updateFields), array_keys($updateFields),
$updateFields $updateFields,
) ),
); );
$this->QBOptions['sql'] = $sql; $this->QBOptions['sql'] = $sql;
@ -584,15 +584,15 @@ class Builder extends BaseBuilder
return $table . '.' . $key . ' = ' return $table . '.' . $key . ' = '
. $that->cast( . $that->cast(
$alias . '.' . $value, $alias . '.' . $value,
$that->getFieldType($table, $key) $that->getFieldType($table, $key),
); );
} }
return $table . '.' . $value . ' = ' . $alias . '.' . $value; return $table . '.' . $value . ' = ' . $alias . '.' . $value;
}, },
array_keys($constraints), array_keys($constraints),
$constraints $constraints,
) ),
); );
// convert binds in where // convert binds in where
@ -605,7 +605,7 @@ class Builder extends BaseBuilder
$sql .= ' ' . str_replace( $sql .= ' ' . str_replace(
'WHERE ', 'WHERE ',
'AND ', 'AND ',
$this->compileWhereHaving('QBWhere') $this->compileWhereHaving('QBWhere'),
); );
$this->QBOptions['sql'] = $sql; $this->QBOptions['sql'] = $sql;
@ -620,10 +620,10 @@ class Builder extends BaseBuilder
static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($value): string => 'SELECT ' . implode(', ', array_map(
static fn ($key, $index): string => $index . ' ' . $key, static fn ($key, $index): string => $index . ' ' . $key,
$keys, $keys,
$value $value,
)), )),
$values $values,
) ),
) . "\n"; ) . "\n";
} }

View File

@ -764,8 +764,8 @@ class Builder extends BaseBuilder
) )
), ),
array_keys($constraints), array_keys($constraints),
$constraints $constraints,
) ),
) . ")\n"; ) . ")\n";
$sql .= "WHEN MATCHED THEN UPDATE SET\n"; $sql .= "WHEN MATCHED THEN UPDATE SET\n";
@ -777,8 +777,8 @@ class Builder extends BaseBuilder
' = ' . $value : ' = ' . $value :
" = {$alias}.{$value}"), " = {$alias}.{$value}"),
array_keys($updateFields), array_keys($updateFields),
$updateFields $updateFields,
) ),
); );
$sql .= "\nWHEN NOT MATCHED THEN INSERT (" . implode(', ', $keys) . ")\nVALUES "; $sql .= "\nWHEN NOT MATCHED THEN INSERT (" . implode(', ', $keys) . ")\nVALUES ";
@ -792,8 +792,8 @@ class Builder extends BaseBuilder
. 'isnull(IDENT_CURRENT(\'' . $fullTableName . '\')+IDENT_INCR(\'' . 'isnull(IDENT_CURRENT(\'' . $fullTableName . '\')+IDENT_INCR(\''
. $fullTableName . "'),1)) ELSE {$alias}.{$columnName} END" . $fullTableName . "'),1)) ELSE {$alias}.{$columnName} END"
: "{$alias}.{$columnName}", : "{$alias}.{$columnName}",
$keys $keys,
) ),
) . ');' ) . ');'
); );

View File

@ -134,12 +134,12 @@ class Forge extends BaseForge
$sql = sprintf( $sql = sprintf(
$this->createDatabaseIfStr, $this->createDatabaseIfStr,
$dbName, $dbName,
$this->db->escapeIdentifier($dbName) $this->db->escapeIdentifier($dbName),
); );
} else { } else {
$sql = sprintf( $sql = sprintf(
$this->createDatabaseStr, $this->createDatabaseStr,
$this->db->escapeIdentifier($dbName) $this->db->escapeIdentifier($dbName),
); );
} }
@ -381,8 +381,8 @@ class Forge extends BaseForge
$maxLength = max( $maxLength = max(
array_map( array_map(
static fn ($value): int => strlen($value), static fn ($value): int => strlen($value),
$attributes['CONSTRAINT'] $attributes['CONSTRAINT'],
) ),
); );
$attributes['TYPE'] = 'VARCHAR'; $attributes['TYPE'] = 'VARCHAR';

View File

@ -196,8 +196,8 @@ class Builder extends BaseBuilder
" = {$value}" : " = {$value}" :
" = {$alias}.{$value}"), " = {$alias}.{$value}"),
array_keys($updateFields), array_keys($updateFields),
$updateFields $updateFields,
) ),
); );
$this->QBOptions['sql'] = $sql; $this->QBOptions['sql'] = $sql;
@ -268,10 +268,10 @@ class Builder extends BaseBuilder
static fn ($value): string => 'SELECT ' . implode(', ', array_map( static fn ($value): string => 'SELECT ' . implode(', ', array_map(
static fn ($key, $index): string => $index . ' ' . $key, static fn ($key, $index): string => $index . ' ' . $key,
$keys, $keys,
$value $value,
)), )),
$values $values,
) ),
) . "\n"; ) . "\n";
} }

View File

@ -308,7 +308,7 @@ class Table
$this->keys = array_filter( $this->keys = array_filter(
$this->keys, $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 // Unique/Index keys
@ -334,7 +334,7 @@ class Table
$this->forge->addForeignKey( $this->forge->addForeignKey(
$foreignKey->column_name, $foreignKey->column_name,
trim($foreignKey->foreign_table_name, $this->db->DBPrefix), trim($foreignKey->foreign_table_name, $this->db->DBPrefix),
$foreignKey->foreign_column_name $foreignKey->foreign_column_name,
); );
} }
@ -358,15 +358,15 @@ class Table
$exFields = implode( $exFields = implode(
', ', ', ',
array_map(fn ($item) => $this->db->protectIdentifiers($item), $exFields) array_map(fn ($item) => $this->db->protectIdentifiers($item), $exFields),
); );
$newFields = implode( $newFields = implode(
', ', ', ',
array_map(fn ($item) => $this->db->protectIdentifiers($item), $newFields) array_map(fn ($item) => $this->db->protectIdentifiers($item), $newFields),
); );
$this->db->query( $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}",
); );
} }

View File

@ -61,7 +61,7 @@ abstract class BaseExceptionHandler
RequestInterface $request, RequestInterface $request,
ResponseInterface $response, ResponseInterface $response,
int $statusCode, int $statusCode,
int $exitCode int $exitCode,
); );
/** /**
@ -221,7 +221,7 @@ abstract class BaseExceptionHandler
"<span class='line highlight'><span class='number'>{$format}</span> %s\n</span>%s", "<span class='line highlight'><span class='number'>{$format}</span> %s\n</span>%s",
$n + $start + 1, $n + $start + 1,
strip_tags($row), strip_tags($row),
implode('', $tags[0]) implode('', $tags[0]),
); );
} else { } else {
$out .= sprintf('<span class="line"><span class="number">' . $format . '</span> %s', $n + $start + 1, $row) . "\n"; $out .= sprintf('<span class="line"><span class="number">' . $format . '</span> %s', $n + $start + 1, $row) . "\n";

View File

@ -47,7 +47,7 @@ final class ExceptionHandler extends BaseExceptionHandler implements ExceptionHa
RequestInterface $request, RequestInterface $request,
ResponseInterface $response, ResponseInterface $response,
int $statusCode, int $statusCode,
int $exitCode int $exitCode,
): void { ): void {
// ResponseTrait needs these properties. // ResponseTrait needs these properties.
$this->request = $request; $this->request = $request;
@ -68,10 +68,10 @@ final class ExceptionHandler extends BaseExceptionHandler implements ExceptionHa
'HTTP/%s %s %s', 'HTTP/%s %s %s',
$request->getProtocolVersion(), $request->getProtocolVersion(),
$response->getStatusCode(), $response->getStatusCode(),
$response->getReasonPhrase() $response->getReasonPhrase(),
), ),
true, true,
$statusCode $statusCode,
); );
} }
@ -129,7 +129,7 @@ final class ExceptionHandler extends BaseExceptionHandler implements ExceptionHa
protected function determineView( protected function determineView(
Throwable $exception, Throwable $exception,
string $templatePath, string $templatePath,
int $statusCode = 500 int $statusCode = 500,
): string { ): string {
// Production environments should have a custom exception file. // Production environments should have a custom exception file.
$view = 'production.php'; $view = 'production.php';
@ -138,7 +138,7 @@ final class ExceptionHandler extends BaseExceptionHandler implements ExceptionHa
in_array( in_array(
strtolower(ini_get('display_errors')), strtolower(ini_get('display_errors')),
['1', 'true', 'on', 'yes'], ['1', 'true', 'on', 'yes'],
true true,
) )
) { ) {
$view = 'error_exception.php'; $view = 'error_exception.php';

View File

@ -27,6 +27,6 @@ interface ExceptionHandlerInterface
RequestInterface $request, RequestInterface $request,
ResponseInterface $response, ResponseInterface $response,
int $statusCode, int $statusCode,
int $exitCode int $exitCode,
): void; ): void;
} }

View File

@ -164,7 +164,7 @@ class Exceptions
$this->request, $this->request,
$this->response, $this->response,
$statusCode, $statusCode,
$exitCode $exitCode,
); );
return; return;
@ -270,7 +270,7 @@ class Exceptions
in_array( in_array(
strtolower(ini_get('display_errors')), strtolower(ini_get('display_errors')),
['1', 'true', 'on', 'yes'], ['1', 'true', 'on', 'yes'],
true true,
) )
) { ) {
$view = 'error_exception.php'; $view = 'error_exception.php';
@ -462,7 +462,7 @@ class Exceptions
'errFile' => clean_path($file ?? ''), 'errFile' => clean_path($file ?? ''),
'errLine' => $line ?? 0, 'errLine' => $line ?? 0,
'trace' => self::renderBacktrace($trace), 'trace' => self::renderBacktrace($trace),
] ],
); );
return true; return true;
@ -567,7 +567,7 @@ class Exceptions
"<span class='line highlight'><span class='number'>{$format}</span> %s\n</span>%s", "<span class='line highlight'><span class='number'>{$format}</span> %s\n</span>%s",
$n + $start + 1, $n + $start + 1,
strip_tags($row), strip_tags($row),
implode('', $tags[0]) implode('', $tags[0]),
); );
} else { } else {
$out .= sprintf('<span class="line"><span class="number">' . $format . '</span> %s', $n + $start + 1, $row) . "\n"; $out .= sprintf('<span class="line"><span class="number">' . $format . '</span> %s', $n + $start + 1, $row) . "\n";
@ -611,7 +611,7 @@ class Exceptions
$frame['class'], $frame['class'],
$frame['type'], $frame['type'],
$frame['function'], $frame['function'],
$args $args,
); );
} }

View File

@ -58,7 +58,7 @@ class Toolbar
log_message( log_message(
'critical', 'critical',
'Toolbar collector does not exist (' . $collector . ').' '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; continue;
@ -391,7 +391,7 @@ class Toolbar
$stats['startTime'], $stats['startTime'],
$stats['totalTime'], $stats['totalTime'],
$request, $request,
$response $response,
); );
helper('filesystem'); helper('filesystem');
@ -439,8 +439,8 @@ class Toolbar
'/<head>/', '/<head>/',
'<head>' . $script, '<head>' . $script,
$response->getBody(), $response->getBody(),
1 1,
) ),
); );
return; return;
@ -516,7 +516,7 @@ class Toolbar
$history = new History(); $history = new History();
$history->setFiles( $history->setFiles(
$debugbarTime[0], $debugbarTime[0],
$this->config->maxHistory $this->config->maxHistory,
); );
$data['collectors'][] = $history->getAsArray(); $data['collectors'][] = $history->getAsArray();

View File

@ -228,7 +228,7 @@ class Database extends BaseCollector
$uniqueCount, $uniqueCount,
$uniqueCount > 1 ? 'of them' : '', $uniqueCount > 1 ? 'of them' : '',
$connectionCount, $connectionCount,
$connectionCount > 1 ? 's' : '' $connectionCount > 1 ? 's' : '',
); );
} }

View File

@ -109,7 +109,7 @@ class Routes extends BaseCollector
' <empty> | default: ' ' <empty> | default: '
. var_export( . var_export(
$param->isDefaultValueAvailable() ? $param->getDefaultValue() : null, $param->isDefaultValueAvailable() ? $param->getDefaultValue() : null,
true true,
), ),
]; ];
} }

View File

@ -1659,7 +1659,7 @@ class Email
$this->finalBody = preg_replace_callback( $this->finalBody = preg_replace_callback(
'/\{unwrap\}(.*?)\{\/unwrap\}/si', '/\{unwrap\}(.*?)\{\/unwrap\}/si',
$this->removeNLCallback(...), $this->removeNLCallback(...),
$this->finalBody $this->finalBody,
); );
} }
@ -1900,7 +1900,7 @@ class Email
$this->SMTPPort, $this->SMTPPort,
$errno, $errno,
$errstr, $errstr,
$this->SMTPTimeout $this->SMTPTimeout,
); );
if (! is_resource($this->SMTPConnect)) { if (! is_resource($this->SMTPConnect)) {
@ -1921,7 +1921,7 @@ class Email
STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT
| STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT
| STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
| STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT,
); );
if ($crypto !== true) { if ($crypto !== true) {

View File

@ -138,7 +138,7 @@ class Entity implements JsonSerializable
array_merge($this->defaultCastHandlers, $this->castHandlers), array_merge($this->defaultCastHandlers, $this->castHandlers),
null, null,
null, null,
false false,
); );
$this->syncOriginal(); $this->syncOriginal();
@ -185,7 +185,7 @@ class Entity implements JsonSerializable
if (is_array($this->datamap)) { if (is_array($this->datamap)) {
$keys = array_unique( $keys = array_unique(
[...array_diff($keys, $this->datamap), ...array_keys($this->datamap)] [...array_diff($keys, $this->datamap), ...array_keys($this->datamap)],
); );
} }

View File

@ -212,7 +212,7 @@ class Events
if ($check === $listener) { if ($check === $listener) {
unset( unset(
static::$listeners[$eventName][1][$index], static::$listeners[$eventName][1][$index],
static::$listeners[$eventName][2][$index] static::$listeners[$eventName][2][$index],
); );
return true; return true;

View File

@ -68,7 +68,7 @@ class FrameworkException extends RuntimeException implements ExceptionInterface
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
$message = sprintf( $message = sprintf(
'The framework needs the following extension(s) installed and loaded: %s.', 'The framework needs the following extension(s) installed and loaded: %s.',
$extension $extension,
); );
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
} else { } else {

View File

@ -103,7 +103,7 @@ class FileCollection implements Countable, IteratorAggregate
$pattern = str_replace( $pattern = str_replace(
['#', '.', '*', '?'], ['#', '.', '*', '?'],
['\#', '\.', '.*', '.'], ['\#', '\.', '.*', '.'],
$pattern $pattern,
); );
$pattern = "#\\A{$pattern}\\z#"; $pattern = "#\\A{$pattern}\\z#";
} }

View File

@ -202,7 +202,7 @@ class Filters
$result = $class->before( $result = $class->before(
$this->request, $this->request,
$this->argumentsClass[$className] ?? null $this->argumentsClass[$className] ?? null,
); );
if ($result instanceof RequestInterface) { if ($result instanceof RequestInterface) {
@ -241,7 +241,7 @@ class Filters
$result = $class->after( $result = $class->after(
$this->request, $this->request,
$this->response, $this->response,
$this->argumentsClass[$className] ?? null $this->argumentsClass[$className] ?? null,
); );
if ($result instanceof ResponseInterface) { if ($result instanceof ResponseInterface) {
@ -648,7 +648,7 @@ class Filters
@trigger_error( @trigger_error(
'Setting lowercase HTTP method key "' . strtolower($method) . '" is deprecated.' 'Setting lowercase HTTP method key "' . strtolower($method) . '" is deprecated.'
. ' Use uppercase HTTP method like "' . strtoupper($method) . '".', . ' Use uppercase HTTP method like "' . strtoupper($method) . '".',
E_USER_DEPRECATED E_USER_DEPRECATED,
); );
$found = true; $found = true;
@ -744,7 +744,7 @@ class Filters
if ($check && array_key_exists($name, $this->arguments)) { if ($check && array_key_exists($name, $this->arguments)) {
throw new ConfigException( throw new ConfigException(
'"' . $name . '" already has arguments: ' '"' . $name . '" already has arguments: '
. (($this->arguments[$name] === null) ? 'null' : implode(',', $this->arguments[$name])) . (($this->arguments[$name] === null) ? 'null' : implode(',', $this->arguments[$name])),
); );
} }

View File

@ -53,7 +53,7 @@ class PerformanceMetrics implements FilterInterface
(string) $benchmark->getElapsedTime('total_execution'), (string) $benchmark->getElapsedTime('total_execution'),
number_format(memory_get_peak_usage() / 1024 / 1024, 3), number_format(memory_get_peak_usage() / 1024 / 1024, 3),
], ],
$body $body,
); );
$response->setBody($output); $response->setBody($output);

View File

@ -342,7 +342,7 @@ class CURLRequest extends OutgoingRequest
$uri->getAuthority(), $uri->getAuthority(),
$uri->getPath(), $uri->getPath(),
$uri->getQuery(), $uri->getQuery(),
$uri->getFragment() $uri->getFragment(),
); );
} }

View File

@ -107,7 +107,7 @@ class Cors
if (in_array('*', $this->config[$name], true) && $count > 1) { if (in_array('*', $this->config[$name], true) && $count > 1) {
throw new ConfigException( throw new ConfigException(
"If wildcard is specified, you must set `'{$name}' => ['*']`." "If wildcard is specified, you must set `'{$name}' => ['*']`."
. ' But using wildcard is not recommended.' . ' But using wildcard is not recommended.',
); );
} }
} }
@ -121,7 +121,7 @@ class Cors
throw new ConfigException( throw new ConfigException(
'When responding to a credentialed request, ' 'When responding to a credentialed request, '
. 'the server must not specify the "*" wildcard for the ' . 'the server must not specify the "*" wildcard for the '
. $header . ' response-header value.' . $header . ' response-header value.',
); );
} }
} }
@ -176,7 +176,7 @@ class Cors
$response->setHeader( $response->setHeader(
'Access-Control-Allow-Headers', 'Access-Control-Allow-Headers',
implode(', ', $this->config['allowedHeaders']) implode(', ', $this->config['allowedHeaders']),
); );
} }
@ -187,7 +187,7 @@ class Cors
$response->setHeader( $response->setHeader(
'Access-Control-Allow-Methods', 'Access-Control-Allow-Methods',
implode(', ', $this->config['allowedMethods']) implode(', ', $this->config['allowedMethods']),
); );
} }
@ -223,7 +223,7 @@ class Cors
if ($this->config['exposedHeaders'] !== []) { if ($this->config['exposedHeaders'] !== []) {
$response->setHeader( $response->setHeader(
'Access-Control-Expose-Headers', 'Access-Control-Expose-Headers',
implode(', ', $this->config['exposedHeaders']) implode(', ', $this->config['exposedHeaders']),
); );
} }
} }

View File

@ -45,7 +45,7 @@ class RedirectException extends Exception implements ResponsableInterface, HTTPE
throw new InvalidArgumentException( throw new InvalidArgumentException(
'RedirectException::__construct() first argument must be a string or ResponseInterface', 'RedirectException::__construct() first argument must be a string or ResponseInterface',
0, 0,
$this $this,
); );
} }
@ -55,7 +55,7 @@ class RedirectException extends Exception implements ResponsableInterface, HTTPE
if ($this->response->getHeaderLine('Location') === '' && $this->response->getHeaderLine('Refresh') === '') { if ($this->response->getHeaderLine('Location') === '' && $this->response->getHeaderLine('Refresh') === '') {
throw new LogicException( 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 @@ class RedirectException extends Exception implements ResponsableInterface, HTTPE
service('logger')->info( service('logger')->info(
'REDIRECTED ROUTE at ' '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; return $this->response;

View File

@ -189,7 +189,7 @@ class FileCollection
$array['type'] ?? null, $array['type'] ?? null,
($array['size'] ?? null) === null ? null : (int) $array['size'], ($array['size'] ?? null) === null ? null : (int) $array['size'],
$array['error'] ?? null, $array['error'] ?? null,
$array['full_path'] ?? null $array['full_path'] ?? null,
); );
} }
@ -219,7 +219,7 @@ class FileCollection
$stack = [&$pointer]; $stack = [&$pointer];
$iterator = new RecursiveIteratorIterator( $iterator = new RecursiveIteratorIterator(
new RecursiveArrayIterator($value), new RecursiveArrayIterator($value),
RecursiveIteratorIterator::SELF_FIRST RecursiveIteratorIterator::SELF_FIRST,
); );
foreach ($iterator as $key => $val) { foreach ($iterator as $key => $val) {

View File

@ -119,7 +119,7 @@ class Message implements MessageInterface
if ($this->hasMultipleHeaders($name)) { if ($this->hasMultipleHeaders($name)) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
'The header "' . $name . '" already has multiple headers.' 'The header "' . $name . '" already has multiple headers.'
. ' You cannot use getHeaderLine().' . ' You cannot use getHeaderLine().',
); );
} }

View File

@ -182,7 +182,7 @@ trait MessageTrait
if ($this->hasMultipleHeaders($name)) { if ($this->hasMultipleHeaders($name)) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
'The header "' . $name . '" already has multiple headers.' '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.',
); );
} }
} }

View File

@ -90,7 +90,7 @@ class Negotiate
$supported, $supported,
$this->request->getHeaderLine('accept-charset'), $this->request->getHeaderLine('accept-charset'),
false, false,
true true,
); );
// If no charset is shown as a match, ignore the directive // If no charset is shown as a match, ignore the directive
@ -154,7 +154,7 @@ class Negotiate
?string $header = null, ?string $header = null,
bool $enforceTypes = false, bool $enforceTypes = false,
bool $strictMatch = false, bool $strictMatch = false,
bool $matchLocales = false bool $matchLocales = false,
): string { ): string {
if ($supported === []) { if ($supported === []) {
throw HTTPException::forEmptySupportedNegotiations(); throw HTTPException::forEmptySupportedNegotiations();
@ -212,7 +212,7 @@ class Negotiate
if (preg_match( if (preg_match(
'/^(?P<name>.+?)=(?P<quoted>"|\')?(?P<value>.*?)(?:\k<quoted>)?$/', '/^(?P<name>.+?)=(?P<quoted>"|\')?(?P<value>.*?)(?:\k<quoted>)?$/',
$pair, $pair,
$param $param,
)) { )) {
$parameters[trim($param['name'])] = trim($param['value']); $parameters[trim($param['name'])] = trim($param['value']);
} }

View File

@ -43,7 +43,7 @@ class OutgoingRequest extends Message implements OutgoingRequestInterface
?URI $uri = null, ?URI $uri = null,
array $headers = [], array $headers = [],
$body = null, $body = null,
string $version = '1.1' string $version = '1.1',
) { ) {
$this->method = $method; $this->method = $method;
$this->uri = $uri; $this->uri = $uri;

View File

@ -72,7 +72,7 @@ trait RequestTrait
if (! empty($proxyIPs) && (! is_array($proxyIPs) || is_int(array_key_first($proxyIPs)))) { if (! empty($proxyIPs) && (! is_array($proxyIPs) || is_int(array_key_first($proxyIPs)))) {
throw new ConfigException( 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.',
); );
} }

View File

@ -341,7 +341,7 @@ interface ResponseInterface extends MessageInterface
$prefix = '', $prefix = '',
$secure = false, $secure = false,
$httponly = false, $httponly = false,
$samesite = null $samesite = null,
); );
/** /**

View File

@ -407,14 +407,14 @@ trait ResponseTrait
header( header(
$name . ': ' . $value->getValueLine(), $name . ': ' . $value->getValueLine(),
false, false,
$this->getStatusCode() $this->getStatusCode(),
); );
} else { } else {
foreach ($value as $header) { foreach ($value as $header) {
header( header(
$name . ': ' . $header->getValueLine(), $name . ': ' . $header->getValueLine(),
false, false,
$this->getStatusCode() $this->getStatusCode(),
); );
} }
} }
@ -512,7 +512,7 @@ trait ResponseTrait
$prefix = '', $prefix = '',
$secure = null, $secure = null,
$httponly = null, $httponly = null,
$samesite = null $samesite = null,
) { ) {
if ($name instanceof Cookie) { if ($name instanceof Cookie) {
$this->cookieStore = $this->cookieStore->put($name); $this->cookieStore = $this->cookieStore->put($name);

View File

@ -95,7 +95,7 @@ class SiteURI extends URI
App $configApp, App $configApp,
string $relativePath = '', string $relativePath = '',
?string $host = null, ?string $host = null,
?string $scheme = null ?string $scheme = null,
) { ) {
$this->indexPage = $configApp->indexPage; $this->indexPage = $configApp->indexPage;
@ -142,7 +142,7 @@ class SiteURI extends URI
private function determineBaseURL( private function determineBaseURL(
App $configApp, App $configApp,
?string $host, ?string $host,
?string $scheme ?string $scheme,
): URI { ): URI {
$baseURL = $this->normalizeBaseURL($configApp); $baseURL = $this->normalizeBaseURL($configApp);
@ -199,7 +199,7 @@ class SiteURI extends URI
// Validate baseURL // Validate baseURL
if (filter_var($baseURL, FILTER_VALIDATE_URL) === false) { if (filter_var($baseURL, FILTER_VALIDATE_URL) === false) {
throw new ConfigException( 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 @@ class SiteURI extends URI
$this->getAuthority(), $this->getAuthority(),
$this->getPath(), $this->getPath(),
$this->getQuery(), $this->getQuery(),
$this->getFragment() $this->getFragment(),
); );
} }

View File

@ -163,7 +163,7 @@ class URI implements Stringable
?string $authority = null, ?string $authority = null,
?string $path = null, ?string $path = null,
?string $query = null, ?string $query = null,
?string $fragment = null ?string $fragment = null,
): string { ): string {
$uri = ''; $uri = '';
if ($scheme !== null && $scheme !== '') { if ($scheme !== null && $scheme !== '') {
@ -638,7 +638,7 @@ class URI implements Stringable
$this->getAuthority(), $this->getAuthority(),
$path, // Absolute URIs should use a "/" for an empty path $path, // Absolute URIs should use a "/" for an empty path
$this->getQuery(), $this->getQuery(),
$this->getFragment() $this->getFragment(),
); );
} }
@ -1022,7 +1022,7 @@ class URI implements Stringable
$path = preg_replace_callback( $path = preg_replace_callback(
'/(?:[^' . static::CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/', '/(?:[^' . static::CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/',
static fn (array $matches): string => rawurlencode($matches[0]), static fn (array $matches): string => rawurlencode($matches[0]),
$path $path,
); );
return $path; return $path;
@ -1170,7 +1170,7 @@ class URI implements Stringable
$params = array_map(static fn (string $chunk): ?string => preg_replace_callback( $params = array_map(static fn (string $chunk): ?string => preg_replace_callback(
'/^(?<key>[^&=]+?)(?:\[[^&=]*\])?=(?<value>[^&=]+)/', '/^(?<key>[^&=]+?)(?:\[[^&=]*\])?=(?<value>[^&=]+)/',
static fn (array $match): string => str_replace($match['key'], bin2hex($match['key']), $match[0]), static fn (array $match): string => str_replace($match['key'], bin2hex($match['key']), $match[0]),
urldecode($chunk) urldecode($chunk),
), $query); ), $query);
$params = implode('&', $params); $params = implode('&', $params);

Some files were not shown because too many files have changed in this diff Show More