mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
refactor: enable AddClosureVoidReturnTypeWhereNoReturnRector to add void return on closure
This commit is contained in:
parent
fc5dd88e22
commit
9e4777a0c8
@ -23,7 +23,7 @@ use CodeIgniter\HotReloader\HotReloader;
|
||||
* Events::on('create', [$myInstance, 'myMethod']);
|
||||
*/
|
||||
|
||||
Events::on('pre_system', static function () {
|
||||
Events::on('pre_system', static function (): void {
|
||||
if (ENVIRONMENT !== 'testing') {
|
||||
if (ini_get('zlib.output_compression')) {
|
||||
throw FrameworkException::forEnabledZlibOutputCompression();
|
||||
@ -47,7 +47,7 @@ Events::on('pre_system', static function () {
|
||||
Services::toolbar()->respond();
|
||||
// Hot Reload route - for framework use on the hot reloader.
|
||||
if (ENVIRONMENT === 'development') {
|
||||
Services::routes()->get('__hot-reload', static function () {
|
||||
Services::routes()->get('__hot-reload', static function (): void {
|
||||
(new HotReloader())->run();
|
||||
});
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
|
||||
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
|
||||
use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
|
||||
use Rector\TypeDeclaration\Rector\Closure\AddClosureVoidReturnTypeWhereNoReturnRector;
|
||||
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
|
||||
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
|
||||
use Utils\Rector\PassStrictParameterToFunctionParameterRector;
|
||||
@ -217,6 +218,7 @@ return RectorConfig::configure()
|
||||
SingleInArrayToCompareRector::class,
|
||||
VersionCompareFuncCallToConstantRector::class,
|
||||
ExplicitBoolCompareRector::class,
|
||||
AddClosureVoidReturnTypeWhereNoReturnRector::class,
|
||||
])
|
||||
->withConfiguredRule(StringClassNameToClassConstantRector::class, [
|
||||
// keep '\\' prefix string on string '\Foo\Bar'
|
||||
|
@ -507,7 +507,7 @@ class Autoloader
|
||||
{
|
||||
// If we have KINT_DIR it means it's already loaded via composer
|
||||
if (! defined('KINT_DIR')) {
|
||||
spl_autoload_register(function ($class) {
|
||||
spl_autoload_register(function ($class): void {
|
||||
$class = explode('\\', $class);
|
||||
|
||||
if (array_shift($class) !== 'Kint') {
|
||||
|
@ -857,7 +857,7 @@ class CLI
|
||||
|
||||
$first = true;
|
||||
|
||||
array_walk($lines, static function (&$line) use ($padLeft, &$first) {
|
||||
array_walk($lines, static function (&$line) use ($padLeft, &$first): void {
|
||||
if (! $first) {
|
||||
$line = str_repeat(' ', $padLeft) . $line;
|
||||
} else {
|
||||
|
@ -253,7 +253,7 @@ class CodeIgniter
|
||||
{
|
||||
// If we have KINT_DIR it means it's already loaded via composer
|
||||
if (! defined('KINT_DIR')) {
|
||||
spl_autoload_register(function ($class) {
|
||||
spl_autoload_register(function ($class): void {
|
||||
$class = explode('\\', $class);
|
||||
|
||||
if (array_shift($class) !== 'Kint') {
|
||||
|
@ -140,7 +140,7 @@ final class DataConverter
|
||||
return $classObj;
|
||||
}
|
||||
|
||||
$classSet = Closure::bind(function ($key, $value) {
|
||||
$classSet = Closure::bind(function ($key, $value): void {
|
||||
$this->{$key} = $value;
|
||||
}, $classObj, $classname);
|
||||
|
||||
|
@ -159,7 +159,7 @@ class Builder extends BaseBuilder
|
||||
$table = $this->QBFrom[0];
|
||||
$set = $this->binds;
|
||||
|
||||
array_walk($set, static function (array &$item) {
|
||||
array_walk($set, static function (array &$item): void {
|
||||
$item = $item[0];
|
||||
});
|
||||
|
||||
|
@ -118,7 +118,7 @@ class Query implements QueryInterface, Stringable
|
||||
}
|
||||
|
||||
if ($setEscape) {
|
||||
array_walk($binds, static function (&$item) {
|
||||
array_walk($binds, static function (&$item): void {
|
||||
$item = [
|
||||
$item,
|
||||
true,
|
||||
@ -141,7 +141,7 @@ class Query implements QueryInterface, Stringable
|
||||
public function setBinds(array $binds, bool $setEscape = true)
|
||||
{
|
||||
if ($setEscape) {
|
||||
array_walk($binds, static function (&$item) {
|
||||
array_walk($binds, static function (&$item): void {
|
||||
$item = [$item, true];
|
||||
});
|
||||
}
|
||||
|
@ -420,7 +420,7 @@ class Builder extends BaseBuilder
|
||||
|
||||
// Get the binds
|
||||
$binds = $this->binds;
|
||||
array_walk($binds, static function (&$item) {
|
||||
array_walk($binds, static function (&$item): void {
|
||||
$item = $item[0];
|
||||
});
|
||||
|
||||
|
@ -147,7 +147,7 @@ class Result extends BaseResult
|
||||
return $classObj->injectRawData($row);
|
||||
}
|
||||
|
||||
$classSet = Closure::bind(function ($key, $value) {
|
||||
$classSet = Closure::bind(function ($key, $value): void {
|
||||
$this->{$key} = $value;
|
||||
}, $classObj, $className);
|
||||
|
||||
|
@ -294,7 +294,7 @@ class Toolbar
|
||||
array_multisort(...$sortArray);
|
||||
|
||||
// Add end time to each element
|
||||
array_walk($data, static function (&$row) {
|
||||
array_walk($data, static function (&$row): void {
|
||||
$row['end'] = $row['start'] + $row['duration'];
|
||||
});
|
||||
|
||||
|
@ -522,7 +522,7 @@ class Filters
|
||||
[$name, $arguments] = explode(':', $name);
|
||||
|
||||
$arguments = explode(',', $arguments);
|
||||
array_walk($arguments, static function (&$item) {
|
||||
array_walk($arguments, static function (&$item): void {
|
||||
$item = trim($item);
|
||||
});
|
||||
}
|
||||
|
@ -586,7 +586,7 @@ class IncomingRequest extends Request
|
||||
) {
|
||||
if (is_array($data)) {
|
||||
// Iterate over array and append filter and flags
|
||||
array_walk_recursive($data, static function (&$val) use ($filter, $flags) {
|
||||
array_walk_recursive($data, static function (&$val) use ($filter, $flags): void {
|
||||
$valType = gettype($val);
|
||||
$val = filter_var($val, $filter, $flags);
|
||||
|
||||
@ -672,7 +672,7 @@ class IncomingRequest extends Request
|
||||
)
|
||||
) {
|
||||
// Iterate over array and append filter and flags
|
||||
array_walk_recursive($output, static function (&$val) use ($filter, $flags) {
|
||||
array_walk_recursive($output, static function (&$val) use ($filter, $flags): void {
|
||||
$val = filter_var($val, $filter, $flags);
|
||||
});
|
||||
|
||||
|
@ -322,7 +322,7 @@ trait RequestTrait
|
||||
)
|
||||
) {
|
||||
// Iterate over array and append filter and flags
|
||||
array_walk_recursive($value, static function (&$val) use ($filter, $flags) {
|
||||
array_walk_recursive($value, static function (&$val) use ($filter, $flags): void {
|
||||
$val = filter_var($val, $filter, $flags);
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user