Skip to content

Commit 68a7d27

Browse files
committed
chore: re-run rector
1 parent 2f0c6a7 commit 68a7d27

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

rector.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
2222
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
2323
use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector;
24+
use Rector\CodingStyle\Rector\FunctionLike\FunctionLikeToFirstClassCallableRector;
2425
use Rector\Config\RectorConfig;
2526
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedConstructorParamRector;
2627
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
@@ -37,7 +38,6 @@
3738
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
3839
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
3940
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
40-
use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
4141
use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector;
4242
use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector;
4343
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
@@ -52,7 +52,7 @@
5252

5353
return RectorConfig::configure()
5454
->withPhpSets(php81: true)
55-
->withPreparedSets(deadCode: true, instanceOf: true, strictBooleans: true, phpunitCodeQuality: true)
55+
->withPreparedSets(deadCode: true, instanceOf: true, phpunitCodeQuality: true)
5656
->withComposerBased(phpunit: true)
5757
->withParallel(120, 8, 10)
5858
->withCache(
@@ -169,6 +169,9 @@
169169

170170
// possibly isset() on purpose, on updated Config classes property accross versions
171171
IssetOnPropertyObjectToPropertyExistsRector::class,
172+
173+
// needs separate PR for activation to allow more depth review
174+
FunctionLikeToFirstClassCallableRector::class,
172175
])
173176
// auto import fully qualified class names
174177
->withImportNames(removeUnusedImports: true)
@@ -189,7 +192,6 @@
189192
TernaryEmptyArrayArrayDimFetchToCoalesceRector::class,
190193
DisallowedEmptyRuleFixerRector::class,
191194
PrivatizeFinalClassPropertyRector::class,
192-
BooleanInIfConditionRuleFixerRector::class,
193195
VersionCompareFuncCallToConstantRector::class,
194196
AddClosureVoidReturnTypeWhereNoReturnRector::class,
195197
AddFunctionVoidReturnTypeWhereNoReturnRector::class,

system/Config/Services.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ public static function image(?string $handler = null, ?Images $config = null, bo
345345
$config ??= config(Images::class);
346346
assert($config instanceof Images);
347347

348-
$handler = $handler !== null && $handler !== '' && $handler !== '0' ? $handler : $config->defaultHandler;
348+
$handler = in_array($handler, [null, '', '0'], true) ? $config->defaultHandler : $handler;
349349
$class = $config->handlers[$handler];
350350

351351
return new $class($config);
@@ -385,7 +385,7 @@ public static function language(?string $locale = null, bool $getShared = true)
385385
}
386386

387387
// Use '?:' for empty string check
388-
$locale = $locale !== null && $locale !== '' && $locale !== '0' ? $locale : $requestLocale;
388+
$locale = in_array($locale, [null, '', '0'], true) ? $requestLocale : $locale;
389389

390390
return new Language($locale);
391391
}
@@ -484,7 +484,7 @@ public static function parser(?string $viewPath = null, ?ViewConfig $config = nu
484484
return static::getSharedInstance('parser', $viewPath, $config);
485485
}
486486

487-
$viewPath = $viewPath !== null && $viewPath !== '' && $viewPath !== '0' ? $viewPath : (new Paths())->viewDirectory;
487+
$viewPath = in_array($viewPath, [null, '', '0'], true) ? (new Paths())->viewDirectory : $viewPath;
488488
$config ??= config(ViewConfig::class);
489489

490490
return new Parser($config, $viewPath, AppServices::get('locator'), CI_DEBUG, AppServices::get('logger'));
@@ -503,7 +503,7 @@ public static function renderer(?string $viewPath = null, ?ViewConfig $config =
503503
return static::getSharedInstance('renderer', $viewPath, $config);
504504
}
505505

506-
$viewPath = $viewPath !== null && $viewPath !== '' && $viewPath !== '0' ? $viewPath : (new Paths())->viewDirectory;
506+
$viewPath = in_array($viewPath, [null, '', '0'], true) ? (new Paths())->viewDirectory : $viewPath;
507507
$config ??= config(ViewConfig::class);
508508

509509
return new View($config, $viewPath, AppServices::get('locator'), CI_DEBUG, AppServices::get('logger'));

system/Cookie/Cookie.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ public function withExpired()
507507
*/
508508
public function withPath(?string $path)
509509
{
510-
$path = $path !== null && $path !== '' && $path !== '0' ? $path : self::$defaults['path'];
510+
$path = in_array($path, [null, '', '0'], true) ? self::$defaults['path'] : $path;
511511
$this->validatePrefix($this->prefix, $this->secure, $path, $this->domain);
512512

513513
$cookie = clone $this;

system/I18n/TimeTrait.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ trait TimeTrait
7373
*/
7474
public function __construct(?string $time = null, $timezone = null, ?string $locale = null)
7575
{
76-
$this->locale = $locale !== null && $locale !== '' && $locale !== '0' ? $locale : Locale::getDefault();
76+
$this->locale = in_array($locale, [null, '', '0'], true) ? Locale::getDefault() : $locale;
7777

7878
$time ??= '';
7979

@@ -940,7 +940,7 @@ public function sameAs($testTime, ?string $timezone = null): bool
940940
if ($testTime instanceof DateTimeInterface) {
941941
$testTime = $testTime->format('Y-m-d H:i:s.u O');
942942
} elseif (is_string($testTime)) {
943-
$timezone = $timezone !== null && $timezone !== '' && $timezone !== '0' ? $timezone : $this->timezone;
943+
$timezone = in_array($timezone, [null, '', '0'], true) ? $this->timezone : $timezone;
944944
$timezone = $timezone instanceof DateTimeZone ? $timezone : new DateTimeZone($timezone);
945945
$testTime = new DateTime($testTime, $timezone);
946946
$testTime = $testTime->format('Y-m-d H:i:s.u O');
@@ -1102,7 +1102,7 @@ public function getUTCObject($time, ?string $timezone = null)
11021102
if ($time instanceof static) {
11031103
$time = $time->toDateTime();
11041104
} elseif (is_string($time)) {
1105-
$timezone = $timezone !== null && $timezone !== '' && $timezone !== '0' ? $timezone : $this->timezone;
1105+
$timezone = in_array($timezone, [null, '', '0'], true) ? $this->timezone : $timezone;
11061106
$timezone = $timezone instanceof DateTimeZone ? $timezone : new DateTimeZone($timezone);
11071107
$time = new DateTime($time, $timezone);
11081108
}

system/View/Cell.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,6 @@ public function prepareParams($params)
154154
unset($newParams);
155155
}
156156

157-
if ($params === []) {
158-
return [];
159-
}
160-
161157
return $params;
162158
}
163159

0 commit comments

Comments
 (0)