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

@ -41,6 +41,16 @@ $finder = Finder::create()
$overrides = [
'get_class_to_class_keyword' => true,
'trailing_comma_in_multiline' => [
'after_heredoc' => true,
'elements' => [
'arguments',
'array_destructuring',
'arrays',
'match',
'parameters',
],
],
];
$options = [
@ -55,5 +65,5 @@ $options = [
return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(
'CodeIgniter 4 framework',
'CodeIgniter Foundation',
'admin@codeigniter.com'
'admin@codeigniter.com',
);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

2
spark
View File

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

View File

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

View File

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

View File

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

View File

@ -379,7 +379,7 @@ abstract class BaseModel
$this->converter = new DataConverter(
$this->casts,
$this->castHandlers,
$this->db
$this->db,
);
}
}
@ -1081,7 +1081,7 @@ abstract class BaseModel
if ($updateIndex === null) {
throw new InvalidArgumentException(
'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(
'The framework needs the following extension(s) installed and loaded: %s.',
implode(', ', $missingExtensions)
implode(', ', $missingExtensions),
);
header('HTTP/1.1 503 Service Unavailable.', true, 503);

View File

@ -610,11 +610,11 @@ class CLI
$nonColoredText = preg_replace(
$pattern,
'<<__colored_string__>>',
$text
$text,
);
$nonColoredChunks = preg_split(
'/<<__colored_string__>>/u',
$nonColoredText
$nonColoredText,
);
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::CI_VERSION,
date('Y-m-d H:i:s'),
date('P')
date('P'),
), 'green');
CLI::newLine();
}

View File

@ -171,7 +171,7 @@ trait GeneratorTrait
CLI::prompt(
'Are you sure you want to continue?',
['y', 'n'],
'required'
'required',
) === 'n'
) {
CLI::newLine();
@ -193,7 +193,7 @@ trait GeneratorTrait
CLI::error(
lang('CLI.generator.fileExist', [clean_path($target)]),
'light_gray',
'red'
'red',
);
CLI::newLine();
@ -216,7 +216,7 @@ trait GeneratorTrait
CLI::error(
lang('CLI.generator.fileError', [clean_path($target)]),
'light_gray',
'red'
'red',
);
CLI::newLine();
@ -227,7 +227,7 @@ trait GeneratorTrait
if ($this->getOption('force') && $isFile) {
CLI::write(
lang('CLI.generator.fileOverwrite', [clean_path($target)]),
'yellow'
'yellow',
);
CLI::newLine();
@ -236,7 +236,7 @@ trait GeneratorTrait
CLI::write(
lang('CLI.generator.fileCreate', [clean_path($target)]),
'green'
'green',
);
CLI::newLine();
}
@ -326,10 +326,10 @@ trait GeneratorTrait
'\\',
array_map(
pascalize(...),
explode('\\', str_replace('/', '\\', trim($class)))
)
explode('\\', str_replace('/', '\\', trim($class))),
),
'\\/'
),
'\\/',
);
}
@ -351,7 +351,7 @@ trait GeneratorTrait
return view(
"CodeIgniter\\Commands\\Generators\\Views\\{$this->template}",
$data,
['debug' => false]
['debug' => false],
);
}
}
@ -370,15 +370,15 @@ trait GeneratorTrait
string $class,
array $search = [],
array $replace = [],
array $data = []
array $data = [],
): string {
// Retrieves the namespace part from the fully qualified class name.
$namespace = trim(
implode(
'\\',
array_slice(explode('\\', $class), 0, -1)
array_slice(explode('\\', $class), 0, -1),
),
'\\'
'\\',
);
$search[] = '<@php';
$search[] = '{namespace}';
@ -404,7 +404,7 @@ trait GeneratorTrait
&& preg_match(
'/(?P<imports>(?:^use [^;]+;$\n?)+)/m',
$template,
$match
$match,
)
) {
$imports = explode("\n", trim($match['imports']));
@ -432,7 +432,7 @@ trait GeneratorTrait
CLI::error(
lang('CLI.namespaceNotDefined', [$namespace]),
'light_gray',
'red'
'red',
);
CLI::newLine();
@ -446,7 +446,7 @@ trait GeneratorTrait
. str_replace(
'\\',
DIRECTORY_SEPARATOR,
trim(str_replace($namespace . '\\', '', $class), '\\')
trim(str_replace($namespace . '\\', '', $class), '\\'),
) . '.php';
return implode(
@ -454,8 +454,8 @@ trait GeneratorTrait
array_slice(
explode(DIRECTORY_SEPARATOR, $file),
0,
-1
)
-1,
),
) . DIRECTORY_SEPARATOR . $this->basename($file);
}
@ -470,9 +470,9 @@ trait GeneratorTrait
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->config['host'],
$this->config['port'],
$this->config['weight']
$this->config['weight'],
);
// attempt to get status of servers
@ -103,7 +103,7 @@ class MemcachedHandler extends BaseHandler
// Check if we can connect to the server
$canConnect = $this->memcached->connect(
$this->config['host'],
$this->config['port']
$this->config['port'],
);
// If we can't connect, throw a CriticalError exception
@ -116,7 +116,7 @@ class MemcachedHandler extends BaseHandler
$this->config['host'],
$this->config['port'],
true,
$this->config['weight']
$this->config['weight'],
);
} else {
throw new CriticalError('Cache: Not support Memcache(d) extension.');

View File

@ -82,7 +82,7 @@ class PredisHandler extends BaseHandler
$data = array_combine(
['__ci_type', '__ci_value'],
$this->redis->hmget($key, ['__ci_type', '__ci_value'])
$this->redis->hmget($key, ['__ci_type', '__ci_value']),
);
if (! isset($data['__ci_type'], $data['__ci_value']) || $data['__ci_value'] === false) {

View File

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

View File

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

View File

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

View File

@ -182,7 +182,7 @@ class GenerateKey extends BaseCommand
$newFileContents = preg_replace(
'/^[#\s]*encryption.key[=\s]*(?:hex2bin\:[a-f0-9]{64}|base64\:(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?)$/m',
$replacementKey,
$oldFileContents
$oldFileContents,
);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -109,7 +109,7 @@ final class ConfigCheck extends BaseCommand
CLI::write($this->getKintD($config));
} else {
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(
'!.*system/Commands/Utilities/ConfigCheck.php.*\n!u',
'',
$output
$output,
);
}
}

View File

@ -151,7 +151,7 @@ final class Environment extends BaseCommand
return file_put_contents(
$envFile,
preg_replace($pattern, "\nCI_ENVIRONMENT = {$newEnv}", file_get_contents($envFile), -1, $count)
preg_replace($pattern, "\nCI_ENVIRONMENT = {$newEnv}", file_get_contents($envFile), -1, $count),
) !== false && $count > 0;
}
}

View File

@ -100,7 +100,7 @@ class FilterCheck extends BaseCommand
CLI::color(
'"' . strtoupper($method) . ' ' . $route . '"',
'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 $locatorCacheEnabled = false;' => 'public bool $locatorCacheEnabled = true;',
]
],
);
if ($result) {
CLI::write(
'Config Caching and FileLocator Caching are enabled in "app/Config/Optimize.php".',
'green'
'green',
);
return;

View File

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

View File

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

View File

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

View File

@ -33,7 +33,7 @@ final class ControllerMethodReader
*/
public function __construct(
private readonly string $namespace,
private readonly array $httpMethods
private readonly array $httpMethods,
) {
$config = config(Routing::class);
$this->translateURIDashes = $config->translateURIDashes;
@ -78,7 +78,7 @@ final class ControllerMethodReader
$classname,
$methodName,
$httpVerb,
$method
$method,
);
if ($routeForDefaultController !== []) {
@ -193,7 +193,7 @@ final class ControllerMethodReader
{
if ($this->translateUriToCamelCase) {
$string = strtolower(
preg_replace('/([a-z\d])([A-Z])/', '$1-$2', $string)
preg_replace('/([a-z\d])([A-Z])/', '$1-$2', $string),
);
} elseif ($this->translateURIDashes) {
$string = str_replace('_', '-', $string);
@ -214,7 +214,7 @@ final class ControllerMethodReader
string $classname,
string $methodName,
string $httpVerb,
ReflectionMethod $method
ReflectionMethod $method,
): array {
$output = [];

View File

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

View File

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

View File

@ -32,7 +32,7 @@ final class FilterCollector
*
* 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(
'Passing lowercase HTTP method "' . $method . '" is deprecated.'
. ' 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(
'{locale}',
config(App::class)->defaultLocale,
$routeKey
$routeKey,
);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -68,7 +68,7 @@ final class DataCaster
?array $castHandlers = null,
?array $types = null,
private readonly ?object $helper = null,
private readonly bool $strict = true
private readonly bool $strict = true,
) {
$this->castHandlers = array_merge($this->castHandlers, $castHandlers);
@ -83,7 +83,7 @@ final class DataCaster
&& ! is_subclass_of($handler, EntityCastInterface::class)
) {
throw new InvalidArgumentException(
'Invalid class type. It must implement CastInterface. class: ' . $handler
'Invalid class type. It must implement CastInterface. class: ' . $handler,
);
}
}
@ -169,7 +169,7 @@ final class DataCaster
if (! isset($handlers[$type])) {
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',
$k,
$match,
PREG_OFFSET_CAPTURE
PREG_OFFSET_CAPTURE,
)
) {
$k = substr($k, 0, $match[0][1]);
@ -2022,8 +2022,8 @@ class BaseBuilder
' = ' . $value :
' = VALUES(' . $value . ')'),
array_keys($updateFields),
$updateFields
)
$updateFields,
),
);
$this->QBOptions['sql'] = $sql;
@ -2291,10 +2291,10 @@ class BaseBuilder
$this->removeAlias($this->QBFrom[0]),
true,
null,
false
false,
),
array_keys($this->QBSet),
array_values($this->QBSet)
array_values($this->QBSet),
);
if ($reset) {
@ -2328,10 +2328,10 @@ class BaseBuilder
$this->removeAlias($this->QBFrom[0]),
true,
$escape,
false
false,
),
array_keys($this->QBSet),
array_values($this->QBSet)
array_values($this->QBSet),
);
if (! $this->testMode) {
@ -2653,8 +2653,8 @@ class BaseBuilder
' = ' . $value :
' = ' . $alias . '.' . $value),
array_keys($updateFields),
$updateFields
)
$updateFields,
),
) . "\n";
$sql .= "FROM (\n{:_table_:}";
@ -2678,8 +2678,8 @@ class BaseBuilder
)
),
array_keys($constraints),
$constraints
)
$constraints,
),
);
$this->QBOptions['sql'] = $sql;
@ -2694,10 +2694,10 @@ class BaseBuilder
static fn ($value): string => 'SELECT ' . implode(', ', array_map(
static fn ($key, $index): string => $index . ' ' . $key,
$keys,
$value
$value,
)),
$values
)
$values,
),
) . "\n";
}
@ -2924,8 +2924,8 @@ class BaseBuilder
)
),
array_keys($constraints),
$constraints
)
$constraints,
),
);
// convert binds in where
@ -2949,10 +2949,10 @@ class BaseBuilder
static fn ($value): string => 'SELECT ' . implode(', ', array_map(
static fn ($key, $index): string => $index . ' ' . $key,
$keys,
$value
$value,
)),
$values
)
$values,
),
) . "\n";
}
@ -3160,7 +3160,7 @@ class BaseBuilder
'/((?:^|\s+)AND\s+|(?:^|\s+)OR\s+)/i',
$qbkey['condition'],
-1,
PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY,
);
foreach ($conditions as &$condition) {
@ -3170,7 +3170,7 @@ class BaseBuilder
|| preg_match(
'/^(\(?)(.*)(' . preg_quote($op, '/') . ')\s*(.*(?<!\)))?(\)?)$/i',
$condition,
$matches
$matches,
) !== 1
) {
continue;
@ -3436,7 +3436,7 @@ class BaseBuilder
{
return preg_match(
'/(<|>|!|=|\sIS NULL|\sIS NOT NULL|\sEXISTS|\sBETWEEN|\sLIKE|\sIN\s*\(|\s)/i',
trim($str)
trim($str),
) === 1;
}
@ -3470,7 +3470,7 @@ class BaseBuilder
return preg_match_all(
'/' . implode('|', $this->pregOperators) . '/i',
$str,
$match
$match,
) >= 1 ? ($list ? $match[0] : $match[0][0]) : false;
}
@ -3501,7 +3501,7 @@ class BaseBuilder
return preg_match_all(
'/' . implode('|', $pregOperators) . '/i',
$whereKey,
$match
$match,
) >= 1 ? $match[0] : false;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -258,7 +258,7 @@ class Forge extends BaseForge
{
$sql = sprintf(
'ALTER TABLE %s DROP PRIMARY KEY',
$this->db->escapeIdentifiers($this->db->DBPrefix . $table)
$this->db->escapeIdentifiers($this->db->DBPrefix . $table),
);
return $this->db->query($sql);

View File

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

View File

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

View File

@ -112,7 +112,7 @@ class Forge extends BaseForge
$fields = array_map(
fn ($field) => $this->db->escapeIdentifiers(trim($field)),
is_string($columnNamesToDrop) ? explode(',', $columnNamesToDrop) : $columnNamesToDrop
is_string($columnNamesToDrop) ? explode(',', $columnNamesToDrop) : $columnNamesToDrop,
);
return $sql . ' DROP (' . implode(',', $fields) . ') CASCADE CONSTRAINT INVALIDATE';

View File

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

View File

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

View File

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

View File

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

View File

@ -308,7 +308,7 @@ class Table
$this->keys = array_filter(
$this->keys,
static fn ($index): bool => count(array_intersect($index['fields'], $fieldNames)) === count($index['fields'])
static fn ($index): bool => count(array_intersect($index['fields'], $fieldNames)) === count($index['fields']),
);
// Unique/Index keys
@ -334,7 +334,7 @@ class Table
$this->forge->addForeignKey(
$foreignKey->column_name,
trim($foreignKey->foreign_table_name, $this->db->DBPrefix),
$foreignKey->foreign_column_name
$foreignKey->foreign_column_name,
);
}
@ -358,15 +358,15 @@ class Table
$exFields = implode(
', ',
array_map(fn ($item) => $this->db->protectIdentifiers($item), $exFields)
array_map(fn ($item) => $this->db->protectIdentifiers($item), $exFields),
);
$newFields = implode(
', ',
array_map(fn ($item) => $this->db->protectIdentifiers($item), $newFields)
array_map(fn ($item) => $this->db->protectIdentifiers($item), $newFields),
);
$this->db->query(
"INSERT INTO {$this->prefixedTableName}({$newFields}) SELECT {$exFields} FROM {$this->db->DBPrefix}temp_{$this->tableName}"
"INSERT INTO {$this->prefixedTableName}({$newFields}) SELECT {$exFields} FROM {$this->db->DBPrefix}temp_{$this->tableName}",
);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -107,7 +107,7 @@ class Cors
if (in_array('*', $this->config[$name], true) && $count > 1) {
throw new ConfigException(
"If wildcard is specified, you must set `'{$name}' => ['*']`."
. ' But using wildcard is not recommended.'
. ' But using wildcard is not recommended.',
);
}
}
@ -121,7 +121,7 @@ class Cors
throw new ConfigException(
'When responding to a credentialed request, '
. 'the server must not specify the "*" wildcard for the '
. $header . ' response-header value.'
. $header . ' response-header value.',
);
}
}
@ -176,7 +176,7 @@ class Cors
$response->setHeader(
'Access-Control-Allow-Headers',
implode(', ', $this->config['allowedHeaders'])
implode(', ', $this->config['allowedHeaders']),
);
}
@ -187,7 +187,7 @@ class Cors
$response->setHeader(
'Access-Control-Allow-Methods',
implode(', ', $this->config['allowedMethods'])
implode(', ', $this->config['allowedMethods']),
);
}
@ -223,7 +223,7 @@ class Cors
if ($this->config['exposedHeaders'] !== []) {
$response->setHeader(
'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(
'RedirectException::__construct() first argument must be a string or ResponseInterface',
0,
$this
$this,
);
}
@ -55,7 +55,7 @@ class RedirectException extends Exception implements ResponsableInterface, HTTPE
if ($this->response->getHeaderLine('Location') === '' && $this->response->getHeaderLine('Refresh') === '') {
throw new LogicException(
'The Response object passed to RedirectException does not contain a redirect address.'
'The Response object passed to RedirectException does not contain a redirect address.',
);
}
@ -76,7 +76,7 @@ class RedirectException extends Exception implements ResponsableInterface, HTTPE
service('logger')->info(
'REDIRECTED ROUTE at '
. ($this->response->getHeaderLine('Location') ?: substr($this->response->getHeaderLine('Refresh'), 6))
. ($this->response->getHeaderLine('Location') ?: substr($this->response->getHeaderLine('Refresh'), 6)),
);
return $this->response;

View File

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

View File

@ -119,7 +119,7 @@ class Message implements MessageInterface
if ($this->hasMultipleHeaders($name)) {
throw new InvalidArgumentException(
'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)) {
throw new InvalidArgumentException(
'The header "' . $name . '" already has multiple headers.'
. ' You cannot change them. If you really need to change, remove the header first.'
. ' You cannot change them. If you really need to change, remove the header first.',
);
}
}

View File

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

View File

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

View File

@ -72,7 +72,7 @@ trait RequestTrait
if (! empty($proxyIPs) && (! is_array($proxyIPs) || is_int(array_key_first($proxyIPs)))) {
throw new ConfigException(
'You must set an array with Proxy IP address key and HTTP header name value in Config\App::$proxyIPs.'
'You must set an array with Proxy IP address key and HTTP header name value in Config\App::$proxyIPs.',
);
}

View File

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

View File

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

View File

@ -95,7 +95,7 @@ class SiteURI extends URI
App $configApp,
string $relativePath = '',
?string $host = null,
?string $scheme = null
?string $scheme = null,
) {
$this->indexPage = $configApp->indexPage;
@ -142,7 +142,7 @@ class SiteURI extends URI
private function determineBaseURL(
App $configApp,
?string $host,
?string $scheme
?string $scheme,
): URI {
$baseURL = $this->normalizeBaseURL($configApp);
@ -199,7 +199,7 @@ class SiteURI extends URI
// Validate baseURL
if (filter_var($baseURL, FILTER_VALIDATE_URL) === false) {
throw new ConfigException(
'Config\App::$baseURL "' . $baseURL . '" is not a valid URL.'
'Config\App::$baseURL "' . $baseURL . '" is not a valid URL.',
);
}
@ -266,7 +266,7 @@ class SiteURI extends URI
$this->getAuthority(),
$this->getPath(),
$this->getQuery(),
$this->getFragment()
$this->getFragment(),
);
}

View File

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

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