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 @@ -29,7 +29,7 @@
"phpunit/phpcov": "^9.0.2 || ^10.0",
"phpunit/phpunit": "^10.5.16 || ^11.2",
"predis/predis": "^3.0",
"rector/rector": "2.6.1",
"rector/rector": "2.6.3",
"shipmonk/phpstan-baseline-per-identifier": "^2.0"
},
"replace": {
Expand Down
10 changes: 0 additions & 10 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
use Rector\DeadCode\Rector\MethodCall\RemoveNullArgOnNullDefaultParamRector;
use Rector\DeadCode\Rector\Property\RemoveDefaultValueFromAssignedPropertyRector;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
Expand All @@ -37,7 +33,6 @@
use Rector\Privatization\Rector\Class_\FinalizeTestCaseClassRector;
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
use Rector\Renaming\Rector\ConstFetch\RenameConstantRector;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
Expand Down Expand Up @@ -179,15 +174,10 @@
DeclareStrictTypesRector::class,
UnderscoreToCamelCaseVariableNameRector::class,
SimplifyUselessVariableRector::class,
RemoveAlwaysElseRector::class,
PassStrictParameterToFunctionParameterRector::class,
ChangeNestedForeachIfsToEarlyContinueRector::class,
ChangeIfElseValueAssignToEarlyReturnRector::class,
PreparedValueToEarlyReturnRector::class,
RemoveErrorSuppressInTryCatchStmtsRector::class,
FuncGetArgsToVariadicParamRector::class,
MakeInheritedMethodVisibilitySameAsParentRector::class,
DisallowedEmptyRuleFixerRector::class,
PrivatizeFinalClassPropertyRector::class,
VersionCompareFuncCallToConstantRector::class,
AddClosureVoidReturnTypeWhereNoReturnRector::class,
Expand Down
2 changes: 1 addition & 1 deletion system/CLI/InputOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function input(?string $prefix = null): string
$input = fgets(fopen('php://stdin', 'rb'));

if ($input === false) {
$input = '';
return '';
}

return $input;
Expand Down
2 changes: 1 addition & 1 deletion system/Config/DotEnv.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ protected function sanitizeValue(string $value): string
protected function resolveNestedVariables(string $value): string
{
if (str_contains($value, '$')) {
$value = preg_replace_callback(
return preg_replace_callback(
'/\${([a-zA-Z0-9_\.]+)}/',
function ($matchedPatterns) {
$nestedVariable = $this->getVariable($matchedPatterns[1]);
Expand Down
2 changes: 1 addition & 1 deletion system/Database/Postgre/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function compileIgnore(string $statement)
$sql = parent::compileIgnore($statement);

if ($sql !== '') {
$sql = ' ' . trim($sql);
return ' ' . trim($sql);
}

return $sql;
Expand Down
2 changes: 1 addition & 1 deletion system/Files/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private function getSizeByUnitInternal(int $fileSizeBase, FileSizeUnit $unit, in
$size = $this->getSize() / $divider;

if ($unit !== FileSizeUnit::B) {
$size = number_format($size, $precision);
return number_format($size, $precision);
}

return $size;
Expand Down
4 changes: 2 additions & 2 deletions system/HTTP/ResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public function getXML()
$body = $this->body;

if ($this->bodyFormat !== 'xml') {
$body = service('format')->getFormatter('application/xml')->format($body);
return service('format')->getFormatter('application/xml')->format($body);
}

return $body;
Expand All @@ -249,7 +249,7 @@ protected function formatBody($body, string $format)

// Nothing much to do for a string...
if (! is_string($body) || $format === 'json-unencoded') {
$body = service('format')->getFormatter($mime)->format($body);
return service('format')->getFormatter($mime)->format($body);
}

return $body;
Expand Down
4 changes: 2 additions & 2 deletions system/HTTP/SiteURI.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private function getIndexPageRoutePath(string $routePath): string
$indexPageRoutePath = $indexPage . $routePath;

if ($indexPageRoutePath === '/') {
$indexPageRoutePath = '';
return '';
}

return $indexPageRoutePath;
Expand Down Expand Up @@ -420,7 +420,7 @@ public function baseUrl($relativePath = '', ?string $scheme = null): string
private function stringifyRelativePath($relativePath): string
{
if (is_array($relativePath)) {
$relativePath = implode('/', $relativePath);
return implode('/', $relativePath);
}

return $relativePath;
Expand Down
2 changes: 1 addition & 1 deletion system/Helpers/url_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ function prep_url(string $str = '', bool $secure = false): string

// force replace http:// with https://
if ($secure) {
$str = preg_replace('/^(?:http):/i', 'https:', $str);
return preg_replace('/^(?:http):/i', 'https:', $str);
}

return $str;
Expand Down
2 changes: 1 addition & 1 deletion system/Honeypot/Honeypot.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected function prepareTemplate(string $template): string
$template = str_ireplace('{name}', $this->config->name, $template);

if ($this->config->hidden) {
$template = str_ireplace('{template}', $template, $this->config->container);
return str_ireplace('{template}', $template, $this->config->container);
}

return $template;
Expand Down
2 changes: 1 addition & 1 deletion system/I18n/TimeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ public function getUTCObject($time, ?string $timezone = null)
}

if ($time instanceof DateTime || $time instanceof DateTimeImmutable) {
$time = $time->setTimezone(new DateTimeZone('UTC'));
return $time->setTimezone(new DateTimeZone('UTC'));
}

return $time;
Expand Down
6 changes: 4 additions & 2 deletions system/Router/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1455,8 +1455,10 @@ private function checkHostname($hostname): bool

/**
* @param array<array-key, mixed> $to
*
* @return array<array-key, mixed>|string
*/
private function processArrayCallableSyntax(string $from, array $to): string
private function processArrayCallableSyntax(string $from, array $to): array|string
{
// [classname, method]
// eg, [Home::class, 'index']
Expand All @@ -1474,7 +1476,7 @@ private function processArrayCallableSyntax(string $from, array $to): string
&& is_callable($to[0], true, $callableName)
&& is_string($to[1])
) {
$to = '\\' . $callableName . '/' . $to[1];
return '\\' . $callableName . '/' . $to[1];
}

return $to;
Expand Down
2 changes: 1 addition & 1 deletion system/Test/Mock/MockConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function connect(bool $persistent = false)
if (is_array($return)) {
// By removing the top item here, we can
// get a different value for, say, testing failover connections.
$return = array_shift($this->returnValues['connect']);
return array_shift($this->returnValues['connect']);
}

return $return;
Expand Down
Loading