Skip to content

Commit 39a6a06

Browse files
committed
[Rector] Apply Full PHP 7.3 Rector Set List (Skip JsonThrowOnErrorRector)
1 parent 35fc1d0 commit 39a6a06

File tree

7 files changed

+15
-10
lines changed

7 files changed

+15
-10
lines changed

rector.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
2222
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
2323
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
24-
use Rector\Php73\Rector\FuncCall\ArrayKeyFirstLastRector;
24+
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
25+
use Rector\Set\ValueObject\SetList;
2526
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
2627
use Utils\Rector\PassStrictParameterToFunctionParameterRector;
2728
use Utils\Rector\UnderscoreToCamelCaseVariableNameRector;
@@ -37,6 +38,10 @@
3738
__DIR__ . '/system/Test/bootstrap.php',
3839
]);
3940

41+
$parameters->set(Option::SETS, [
42+
SetList::PHP_73,
43+
]);
44+
4045
// is there a file you need to skip?
4146
$parameters->set(Option::SKIP, [
4247
__DIR__ . '/app/Views',
@@ -45,6 +50,7 @@
4550
__DIR__ . '/tests/system/Config/fixtures',
4651
__DIR__ . '/tests/_support',
4752
PassStrictParameterToFunctionParameterRector::class => [__DIR__ . '/tests/system/Database/Live/SelectTest.php'],
53+
JsonThrowOnErrorRector::class,
4854
]);
4955

5056
// auto import fully qualified class names
@@ -61,7 +67,6 @@
6167
$services->set(ForToForeachRector::class);
6268
$services->set(ChangeNestedForeachIfsToEarlyContinueRector::class);
6369
$services->set(ChangeIfElseValueAssignToEarlyReturnRector::class);
64-
$services->set(ArrayKeyFirstLastRector::class);
6570
$services->set(SimplifyStrposLowerRector::class);
6671
$services->set(CombineIfRector::class);
6772
$services->set(SimplifyIfReturnBoolRector::class);

system/Autoloader/Autoloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ protected function loadInNamespace(string $class)
259259
{
260260
$directory = rtrim($directory, '\\/');
261261

262-
if (strpos($class, $namespace) === 0)
262+
if (strpos($class, (string) $namespace) === 0)
263263
{
264264
$filePath = $directory . str_replace('\\', DIRECTORY_SEPARATOR, substr($class, strlen($namespace))) . '.php';
265265
$filename = $this->includeFile($filePath);

system/CLI/GeneratorTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ protected function qualifyClassName(): string
231231
$class = $matches[1] . ucfirst($matches[2]);
232232
}
233233

234-
if ($this->enabledSuffixing && $this->getOption('suffix') && ! strripos($class, $component))
234+
if ($this->enabledSuffixing && $this->getOption('suffix') && ! strripos($class, (string) $component))
235235
{
236236
$class .= ucfirst($component);
237237
}

system/Email/Email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ protected function getEncoding()
940940

941941
foreach ($this->baseCharsets as $charset)
942942
{
943-
if (strpos($this->charset, $charset) === 0)
943+
if (strpos($this->charset, (string) $charset) === 0)
944944
{
945945
$this->encoding = '7bit';
946946

system/HTTP/IncomingRequest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -727,14 +727,14 @@ protected function parseRequestURI(): string
727727
if (isset($_SERVER['SCRIPT_NAME'][0]) && pathinfo($_SERVER['SCRIPT_NAME'], PATHINFO_EXTENSION) === 'php')
728728
{
729729
// strip the script name from the beginning of the URI
730-
if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0 && strpos($uri, '/index.php') === 0)
730+
if (strpos($uri, (string) $_SERVER['SCRIPT_NAME']) === 0 && strpos($uri, '/index.php') === 0)
731731
{
732732
$uri = (string) substr($uri, strlen($_SERVER['SCRIPT_NAME']));
733733
}
734734
// if the script is nested, strip the parent folder & script from the URI
735-
elseif (strpos($uri, $_SERVER['SCRIPT_NAME']) > 0)
735+
elseif (strpos($uri, (string) $_SERVER['SCRIPT_NAME']) > 0)
736736
{
737-
$uri = (string) substr($uri, strpos($uri, $_SERVER['SCRIPT_NAME']) + strlen($_SERVER['SCRIPT_NAME']));
737+
$uri = (string) substr($uri, strpos($uri, (string) $_SERVER['SCRIPT_NAME']) + strlen($_SERVER['SCRIPT_NAME']));
738738
}
739739
// or if index.php is implied
740740
elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0)

system/HTTP/RequestTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function getIPAddress(): string
115115
}
116116

117117
// If the proxy entry doesn't match the IP protocol - skip it
118-
if (strpos($proxyIP, $separator) === false)
118+
if (strpos($proxyIP, (string) $separator) === false)
119119
{
120120
continue;
121121
}

system/Router/RouteCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ protected function fillRouteParams(string $from, array $params = null): string
13421342

13431343
// Ensure that the param we're inserting matches
13441344
// the expected param type.
1345-
$pos = strpos($from, $pattern);
1345+
$pos = strpos($from, (string) $pattern);
13461346
$from = substr_replace($from, $params[$index], $pos, strlen($pattern));
13471347
}
13481348

0 commit comments

Comments
 (0)