Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: enable AddClosureVoidReturnTypeWhereNoReturnRector to add void return on closure #9008

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/Config/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* 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();
Expand All @@ -47,7 +47,7 @@
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();
});
}
Expand Down
2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
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;
Expand Down Expand Up @@ -217,6 +218,7 @@
SingleInArrayToCompareRector::class,
VersionCompareFuncCallToConstantRector::class,
ExplicitBoolCompareRector::class,
AddClosureVoidReturnTypeWhereNoReturnRector::class,
])
->withConfiguredRule(StringClassNameToClassConstantRector::class, [
// keep '\\' prefix string on string '\Foo\Bar'
Expand Down
2 changes: 1 addition & 1 deletion system/Autoloader/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ private function autoloadKint(): void
{
// 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') {
Expand Down
2 changes: 1 addition & 1 deletion system/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ public static function wrap(?string $string = null, int $max = 0, int $padLeft =

$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 {
Expand Down
2 changes: 1 addition & 1 deletion system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ private function autoloadKint(): void
{
// 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') {
Expand Down
2 changes: 1 addition & 1 deletion system/DataConverter/DataConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function reconstruct(string $classname, array $row): object
return $classObj;
}

$classSet = Closure::bind(function ($key, $value) {
$classSet = Closure::bind(function ($key, $value): void {
$this->{$key} = $value;
}, $classObj, $classname);

Expand Down
2 changes: 1 addition & 1 deletion system/Database/Postgre/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function replace(?array $set = null)
$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];
});

Expand Down
4 changes: 2 additions & 2 deletions system/Database/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function setQuery(string $sql, $binds = null, bool $setEscape = true)
}

if ($setEscape) {
array_walk($binds, static function (&$item) {
array_walk($binds, static function (&$item): void {
$item = [
$item,
true,
Expand All @@ -141,7 +141,7 @@ public function setQuery(string $sql, $binds = null, bool $setEscape = true)
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];
});
}
Expand Down
2 changes: 1 addition & 1 deletion system/Database/SQLSRV/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ protected function _replace(string $table, array $keys, array $values): string

// Get the binds
$binds = $this->binds;
array_walk($binds, static function (&$item) {
array_walk($binds, static function (&$item): void {
$item = $item[0];
});

Expand Down
2 changes: 1 addition & 1 deletion system/Database/SQLite3/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ protected function fetchObject(string $className = 'stdClass')
return $classObj->injectRawData($row);
}

$classSet = Closure::bind(function ($key, $value) {
$classSet = Closure::bind(function ($key, $value): void {
$this->{$key} = $value;
}, $classObj, $className);

Expand Down
2 changes: 1 addition & 1 deletion system/Debug/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ protected function collectTimelineData($collectors): array
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'];
});

Expand Down
2 changes: 1 addition & 1 deletion system/Filters/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ private function getCleanName(string $name): array
[$name, $arguments] = explode(':', $name);

$arguments = explode(',', $arguments);
array_walk($arguments, static function (&$item) {
array_walk($arguments, static function (&$item): void {
$item = trim($item);
});
}
Expand Down
4 changes: 2 additions & 2 deletions system/HTTP/IncomingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ public function getJsonVar($index = null, bool $assoc = false, ?int $filter = nu
) {
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);

Expand Down Expand Up @@ -672,7 +672,7 @@ public function getRawInputVar($index = null, ?int $filter = null, $flags = null
)
) {
// 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);
});

Expand Down
2 changes: 1 addition & 1 deletion system/HTTP/RequestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public function fetchGlobal(string $name, $index = null, ?int $filter = null, $f
)
) {
// 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);
});

Expand Down
Loading