Skip to content

Commit 910edf5

Browse files
committed
refactor: enable code quality level 34 for rector
1 parent 124a7e6 commit 910edf5

File tree

14 files changed

+36
-28
lines changed

14 files changed

+36
-28
lines changed

rector.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector;
2020
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
2121
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
22-
use Rector\CodeQuality\Rector\If_\ShortenElseIfRector;
2322
use Rector\CodeQuality\Rector\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector;
2423
use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector;
2524
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
@@ -187,7 +186,6 @@
187186
ChangeIfElseValueAssignToEarlyReturnRector::class,
188187
InlineIfToExplicitIfRector::class,
189188
PreparedValueToEarlyReturnRector::class,
190-
ShortenElseIfRector::class,
191189
UnusedForeachValueToArrayKeysRector::class,
192190
ChangeArrayPushToArrayAssignRector::class,
193191
RemoveErrorSuppressInTryCatchStmtsRector::class,
@@ -211,4 +209,4 @@
211209
// keep '\\' prefix string on string '\Foo\Bar'
212210
StringClassNameToClassConstantRector::SHOULD_KEEP_PRE_SLASH => true,
213211
])
214-
->withCodeQualityLevel(31);
212+
->withCodeQualityLevel(34);

system/CLI/Commands.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ public function __construct($logger = null)
5252
/**
5353
* Runs a command given
5454
*
55-
* @return int|void Exit code
55+
* @return int|null Exit code
5656
*/
5757
public function run(string $command, array $params)
5858
{
5959
if (! $this->verifyCommand($command, $this->commands)) {
60-
return;
60+
return null;
6161
}
6262

6363
// The file would have already been loaded during the

system/CodeIgniter.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ private function configureKint(): void
318318
*
319319
* @param bool $returnResponse Used for testing purposes only.
320320
*
321-
* @return ResponseInterface|void
321+
* @return ResponseInterface|null
322322
*/
323323
public function run(?RouteCollectionInterface $routes = null, bool $returnResponse = false)
324324
{
@@ -379,6 +379,7 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon
379379
}
380380

381381
$this->sendResponse();
382+
return null;
382383
}
383384

384385
/**
@@ -863,7 +864,7 @@ protected function determinePath()
863864
* controller method and make the script go. If it's not able to, will
864865
* show the appropriate Page Not Found error.
865866
*
866-
* @return ResponseInterface|string|void
867+
* @return ResponseInterface|string|null
867868
*/
868869
protected function startController()
869870
{
@@ -889,6 +890,7 @@ protected function startController()
889890
) {
890891
throw PageNotFoundException::forControllerNotFound($this->controller, $this->method);
891892
}
893+
return null;
892894
}
893895

894896
/**

system/Commands/Database/MigrateRollback.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function run(array $params)
7474
$force = array_key_exists('f', $params) || CLI::getOption('f');
7575

7676
if (! $force && CLI::prompt(lang('Migrations.rollBackConfirm'), ['y', 'n']) === 'n') {
77-
return;
77+
return null;
7878
}
7979
// @codeCoverageIgnoreEnd
8080
}
@@ -115,5 +115,6 @@ public function run(array $params)
115115
$this->showError($e);
116116
// @codeCoverageIgnoreEnd
117117
}
118+
return null;
118119
}
119120
}

system/Database/BaseBuilder.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3014,7 +3014,7 @@ protected function _delete(string $table): string
30143014
*
30153015
* @param array|string $table The table to inspect
30163016
*
3017-
* @return string|void
3017+
* @return string|null
30183018
*/
30193019
protected function trackAliases($table)
30203020
{
@@ -3023,7 +3023,7 @@ protected function trackAliases($table)
30233023
$this->trackAliases($t);
30243024
}
30253025

3026-
return;
3026+
return null;
30273027
}
30283028

30293029
// Does the string contain a comma? If so, we need to separate
@@ -3043,6 +3043,7 @@ protected function trackAliases($table)
30433043
// Store the alias, if it doesn't already exist
30443044
$this->db->addTableAlias($table);
30453045
}
3046+
return null;
30463047
}
30473048

30483049
/**

system/Filters/CSRF.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ class CSRF implements FilterInterface
3535
*
3636
* @param list<string>|null $arguments
3737
*
38-
* @return RedirectResponse|void
38+
* @return RedirectResponse|null
3939
*
4040
* @throws SecurityException
4141
*/
4242
public function before(RequestInterface $request, $arguments = null)
4343
{
4444
if (! $request instanceof IncomingRequest) {
45-
return;
45+
return null;
4646
}
4747

4848
/** @var Security $security */
@@ -57,6 +57,7 @@ public function before(RequestInterface $request, $arguments = null)
5757

5858
throw $e;
5959
}
60+
return null;
6061
}
6162

6263
/**

system/Filters/Cors.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@ public function __construct(array $config = [])
4848
/**
4949
* @param list<string>|null $arguments
5050
*
51-
* @return ResponseInterface|string|void
51+
* @return ResponseInterface|string|null
5252
*/
5353
public function before(RequestInterface $request, $arguments = null)
5454
{
5555
if (! $request instanceof IncomingRequest) {
56-
return;
56+
return null;
5757
}
5858

5959
$this->createCorsService($arguments);
6060

6161
if (! $this->cors->isPreflightRequest($request)) {
62-
return;
62+
return null;
6363
}
6464

6565
/** @var ResponseInterface $response */
@@ -88,12 +88,12 @@ private function createCorsService(?array $arguments): void
8888
/**
8989
* @param list<string>|null $arguments
9090
*
91-
* @return ResponseInterface|void
91+
* @return ResponseInterface|null
9292
*/
9393
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
9494
{
9595
if (! $request instanceof IncomingRequest) {
96-
return;
96+
return null;
9797
}
9898

9999
$this->createCorsService($arguments);

system/Filters/ForceHTTPS.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ class ForceHTTPS implements FilterInterface
3232
*
3333
* @param array|null $arguments
3434
*
35-
* @return ResponseInterface|void
35+
* @return ResponseInterface|null
3636
*/
3737
public function before(RequestInterface $request, $arguments = null)
3838
{
3939
$config = config(App::class);
4040

4141
if ($config->forceGlobalSecureRequests !== true) {
42-
return;
42+
return null;
4343
}
4444

4545
$response = service('response');
@@ -49,6 +49,7 @@ public function before(RequestInterface $request, $arguments = null)
4949
} catch (RedirectException $e) {
5050
return $e->getResponse();
5151
}
52+
return null;
5253
}
5354

5455
/**

system/Filters/PageCache.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct()
3838
*
3939
* @param array|null $arguments
4040
*
41-
* @return ResponseInterface|void
41+
* @return ResponseInterface|null
4242
*/
4343
public function before(RequestInterface $request, $arguments = null)
4444
{
@@ -51,6 +51,7 @@ public function before(RequestInterface $request, $arguments = null)
5151
if ($cachedResponse instanceof ResponseInterface) {
5252
return $cachedResponse;
5353
}
54+
return null;
5455
}
5556

5657
/**

system/Images/Handlers/BaseHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ public function __call(string $name, array $args = [])
702702
if (method_exists($this->image(), $name)) {
703703
return $this->image()->{$name}(...$args);
704704
}
705+
return null;
705706
}
706707

707708
/**

0 commit comments

Comments
 (0)