Skip to content

Commit d8b43eb

Browse files
Update rector/rector requirement from 0.11.48 to 0.11.49 (#5018)
1 parent 9b4fbce commit d8b43eb

File tree

5 files changed

+27
-45
lines changed

5 files changed

+27
-45
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"phpstan/phpstan": "^0.12.91",
2424
"phpunit/phpunit": "^9.1",
2525
"predis/predis": "^1.1",
26-
"rector/rector": "0.11.48",
26+
"rector/rector": "0.11.49",
2727
"symplify/package-builder": "^9.3"
2828
},
2929
"suggest": {

rector.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@
3030
use Rector\DeadCode\Rector\Cast\RecastingRemovalRector;
3131
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
3232
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector;
33-
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
34-
use Rector\DeadCode\Rector\Expression\RemoveDeadStmtRector;
33+
use Rector\DeadCode\Rector\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector;
3534
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
3635
use Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector;
37-
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
3836
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
3937
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
4038
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
@@ -78,9 +76,6 @@
7876
// requires php 8
7977
RemoveUnusedPromotedPropertyRector::class,
8078

81-
// currently buggy on call inside assign, wait for next release
82-
RemoveParentCallWithoutParentRector::class,
83-
8479
// private method called via getPrivateMethodInvoker
8580
RemoveUnusedPrivateMethodRector::class => [
8681
__DIR__ . '/system/Entity/Entity.php',
@@ -92,21 +87,11 @@
9287
__DIR__ . '/tests',
9388
],
9489

95-
// currently buggy on class implements ArrayAccess, wait for next release
96-
RemoveDeadStmtRector::class => [
97-
__DIR__ . '/tests/system/Cookie/CookieTest.php',
98-
],
99-
10090
// check on constant compare
10191
UnwrapFutureCompatibleIfPhpVersionRector::class => [
10292
__DIR__ . '/system/CodeIgniter.php',
10393
],
10494

105-
// check context ResponseTrait
106-
RemoveUselessReturnTagRector::class => [
107-
__DIR__ . '/system/HTTP/MessageTrait.php',
108-
],
109-
11095
// casted to Entity via EntityTest->getCastEntity()
11196
RecastingRemovalRector::class => [
11297
__DIR__ . '/tests/system/Entity/EntityTest.php',
@@ -116,6 +101,11 @@
116101
UnderscoreToCamelCaseVariableNameRector::class => [
117102
__DIR__ . '/system/Session/Handlers',
118103
],
104+
105+
// check on $_SESSION
106+
RemoveUnusedNonEmptyArrayBeforeForeachRector::class => [
107+
__DIR__ . '/system/Debug/Toolbar.php',
108+
],
119109
]);
120110

121111
// auto import fully qualified class names

system/Common.php

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -471,9 +471,9 @@ function force_https(int $duration = 31536000, ?RequestInterface $request = null
471471
$baseURL = config(App::class)->baseURL;
472472

473473
if (strpos($baseURL, 'https://') === 0) {
474-
$baseURL = (string) substr($baseURL, strlen('https://'));
474+
$baseURL = substr($baseURL, strlen('https://'));
475475
} elseif (strpos($baseURL, 'http://') === 0) {
476-
$baseURL = (string) substr($baseURL, strlen('http://'));
476+
$baseURL = substr($baseURL, strlen('http://'));
477477
}
478478

479479
$uri = URI::createURIString(
@@ -601,18 +601,16 @@ function helper($filenames)
601601
else {
602602
$paths = $loader->search('Helpers/' . $filename);
603603

604-
if (! empty($paths)) {
605-
foreach ($paths as $path) {
606-
if (strpos($path, APPPATH) === 0) {
607-
// @codeCoverageIgnoreStart
608-
$appHelper = $path;
609-
// @codeCoverageIgnoreEnd
610-
} elseif (strpos($path, SYSTEMPATH) === 0) {
611-
$systemHelper = $path;
612-
} else {
613-
$localIncludes[] = $path;
614-
$loaded[] = $filename;
615-
}
604+
foreach ($paths as $path) {
605+
if (strpos($path, APPPATH) === 0) {
606+
// @codeCoverageIgnoreStart
607+
$appHelper = $path;
608+
// @codeCoverageIgnoreEnd
609+
} elseif (strpos($path, SYSTEMPATH) === 0) {
610+
$systemHelper = $path;
611+
} else {
612+
$localIncludes[] = $path;
613+
$loaded[] = $filename;
616614
}
617615
}
618616

@@ -636,10 +634,8 @@ function helper($filenames)
636634
}
637635

638636
// Now actually include all of the files
639-
if (! empty($includes)) {
640-
foreach ($includes as $path) {
641-
include_once $path;
642-
}
637+
foreach ($includes as $path) {
638+
include_once $path;
643639
}
644640
}
645641
}

system/Test/DatabaseTestTrait.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,10 @@ public static function resetMigrationSeedCount()
225225
*/
226226
protected function clearInsertCache()
227227
{
228-
if (! empty($this->insertCache)) {
229-
foreach ($this->insertCache as $row) {
230-
$this->db->table($row[0])
231-
->where($row[1])
232-
->delete();
233-
}
228+
foreach ($this->insertCache as $row) {
229+
$this->db->table($row[0])
230+
->where($row[1])
231+
->delete();
234232
}
235233
}
236234

system/Test/FeatureTestCase.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,8 @@ protected function setupRequest(string $method, ?string $path = null): IncomingR
326326
*/
327327
protected function setupHeaders(IncomingRequest $request)
328328
{
329-
if (! empty($this->headers)) {
330-
foreach ($this->headers as $name => $value) {
331-
$request->setHeader($name, $value);
332-
}
329+
foreach ($this->headers as $name => $value) {
330+
$request->setHeader($name, $value);
333331
}
334332

335333
return $request;

0 commit comments

Comments
 (0)