Skip to content
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"phpunit/phpcov": "^9.0.2 || ^10.0",
"phpunit/phpunit": "^10.5.16 || ^11.2",
"predis/predis": "^3.0",
"rector/rector": "2.2.3",
"rector/rector": "2.2.4",
"shipmonk/phpstan-baseline-per-identifier": "^2.0"
},
"replace": {
Expand Down
8 changes: 5 additions & 3 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector;
use Rector\CodingStyle\Rector\FunctionLike\FunctionLikeToFirstClassCallableRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedConstructorParamRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
Expand All @@ -37,7 +38,6 @@
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
Expand All @@ -52,7 +52,7 @@

return RectorConfig::configure()
->withPhpSets(php81: true)
->withPreparedSets(deadCode: true, instanceOf: true, strictBooleans: true, phpunitCodeQuality: true)
->withPreparedSets(deadCode: true, instanceOf: true, phpunitCodeQuality: true)
->withComposerBased(phpunit: true)
->withParallel(120, 8, 10)
->withCache(
Expand Down Expand Up @@ -169,6 +169,9 @@

// possibly isset() on purpose, on updated Config classes property accross versions
IssetOnPropertyObjectToPropertyExistsRector::class,

// needs separate PR for activation to allow more depth review
FunctionLikeToFirstClassCallableRector::class,
])
// auto import fully qualified class names
->withImportNames(removeUnusedImports: true)
Expand All @@ -189,7 +192,6 @@
TernaryEmptyArrayArrayDimFetchToCoalesceRector::class,
DisallowedEmptyRuleFixerRector::class,
PrivatizeFinalClassPropertyRector::class,
BooleanInIfConditionRuleFixerRector::class,
VersionCompareFuncCallToConstantRector::class,
AddClosureVoidReturnTypeWhereNoReturnRector::class,
AddFunctionVoidReturnTypeWhereNoReturnRector::class,
Expand Down
8 changes: 4 additions & 4 deletions system/Config/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public static function image(?string $handler = null, ?Images $config = null, bo
$config ??= config(Images::class);
assert($config instanceof Images);

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

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

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

return new Language($locale);
}
Expand Down Expand Up @@ -484,7 +484,7 @@ public static function parser(?string $viewPath = null, ?ViewConfig $config = nu
return static::getSharedInstance('parser', $viewPath, $config);
}

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

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

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

return new View($config, $viewPath, AppServices::get('locator'), CI_DEBUG, AppServices::get('logger'));
Expand Down
2 changes: 1 addition & 1 deletion system/Cookie/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ public function withExpired()
*/
public function withPath(?string $path)
{
$path = $path !== null && $path !== '' && $path !== '0' ? $path : self::$defaults['path'];
$path = in_array($path, [null, '', '0'], true) ? self::$defaults['path'] : $path;
$this->validatePrefix($this->prefix, $this->secure, $path, $this->domain);

$cookie = clone $this;
Expand Down
6 changes: 3 additions & 3 deletions system/I18n/TimeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ trait TimeTrait
*/
public function __construct(?string $time = null, $timezone = null, ?string $locale = null)
{
$this->locale = $locale !== null && $locale !== '' && $locale !== '0' ? $locale : Locale::getDefault();
$this->locale = in_array($locale, [null, '', '0'], true) ? Locale::getDefault() : $locale;

$time ??= '';

Expand Down Expand Up @@ -940,7 +940,7 @@ public function sameAs($testTime, ?string $timezone = null): bool
if ($testTime instanceof DateTimeInterface) {
$testTime = $testTime->format('Y-m-d H:i:s.u O');
} elseif (is_string($testTime)) {
$timezone = $timezone !== null && $timezone !== '' && $timezone !== '0' ? $timezone : $this->timezone;
$timezone = in_array($timezone, [null, '', '0'], true) ? $this->timezone : $timezone;
$timezone = $timezone instanceof DateTimeZone ? $timezone : new DateTimeZone($timezone);
$testTime = new DateTime($testTime, $timezone);
$testTime = $testTime->format('Y-m-d H:i:s.u O');
Expand Down Expand Up @@ -1102,7 +1102,7 @@ public function getUTCObject($time, ?string $timezone = null)
if ($time instanceof static) {
$time = $time->toDateTime();
} elseif (is_string($time)) {
$timezone = $timezone !== null && $timezone !== '' && $timezone !== '0' ? $timezone : $this->timezone;
$timezone = in_array($timezone, [null, '', '0'], true) ? $this->timezone : $timezone;
$timezone = $timezone instanceof DateTimeZone ? $timezone : new DateTimeZone($timezone);
$time = new DateTime($time, $timezone);
}
Expand Down
4 changes: 0 additions & 4 deletions system/View/Cell.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@ public function prepareParams($params)
unset($newParams);
}

if ($params === []) {
return [];
}

return $params;
}

Expand Down
Loading