From ff2f756baa70eefd77978ac90fefb8ba1d5d82ea Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 21 Oct 2024 02:47:51 +0700 Subject: [PATCH] refactor: enable rector code quality level 14 --- rector.php | 6 +----- system/Config/Services.php | 2 +- system/Images/Handlers/ImageMagickHandler.php | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/rector.php b/rector.php index 4c15387198d9..6c24c66e5539 100644 --- a/rector.php +++ b/rector.php @@ -23,9 +23,7 @@ use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector; use Rector\CodeQuality\Rector\If_\ShortenElseIfRector; use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector; -use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector; use Rector\CodeQuality\Rector\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector; -use Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector; use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector; use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector; use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector; @@ -189,14 +187,12 @@ ChangeNestedForeachIfsToEarlyContinueRector::class, ChangeIfElseValueAssignToEarlyReturnRector::class, CombineIfRector::class, - SimplifyIfReturnBoolRector::class, InlineIfToExplicitIfRector::class, PreparedValueToEarlyReturnRector::class, ShortenElseIfRector::class, SimplifyIfElseToTernaryRector::class, UnusedForeachValueToArrayKeysRector::class, ChangeArrayPushToArrayAssignRector::class, - UnnecessaryTernaryExpressionRector::class, RemoveErrorSuppressInTryCatchStmtsRector::class, FuncGetArgsToVariadicParamRector::class, MakeInheritedMethodVisibilitySameAsParentRector::class, @@ -220,4 +216,4 @@ // keep '\\' prefix string on string '\Foo\Bar' StringClassNameToClassConstantRector::SHOULD_KEEP_PRE_SLASH => true, ]) - ->withCodeQualityLevel(9); + ->withCodeQualityLevel(14); diff --git a/system/Config/Services.php b/system/Config/Services.php index e37b1278e9a7..1a8843fa39b4 100644 --- a/system/Config/Services.php +++ b/system/Config/Services.php @@ -230,7 +230,7 @@ public static function email($config = null, bool $getShared = true) return static::getSharedInstance('email', $config); } - if (empty($config) || ! (is_array($config) || $config instanceof EmailConfig)) { + if (empty($config) || (! is_array($config) && ! $config instanceof EmailConfig)) { $config = config(EmailConfig::class); } diff --git a/system/Images/Handlers/ImageMagickHandler.php b/system/Images/Handlers/ImageMagickHandler.php index fa226ccf2289..e59f91869851 100644 --- a/system/Images/Handlers/ImageMagickHandler.php +++ b/system/Images/Handlers/ImageMagickHandler.php @@ -42,7 +42,7 @@ public function __construct($config = null) { parent::__construct($config); - if (! (extension_loaded('imagick') || class_exists(Imagick::class))) { + if (! extension_loaded('imagick') && ! class_exists(Imagick::class)) { throw ImageException::forMissingExtension('IMAGICK'); // @codeCoverageIgnore }