if ( ! function_exists('formatSizeUnits')) {
function formatSizeUnits($bytes): string
{
if ($bytes >= 1_073_741_824) {
$bytes = number_format($bytes / 1_073_741_824, 1).' GB';
} elseif ($bytes >= 1_048_576) {
$bytes = number_format($bytes / 1_048_576, 1).' MB';
} elseif ($bytes >= 1024) {
$bytes = number_format($bytes / 1024, 1).' KB';
} elseif ($bytes > 1) {
$bytes .= ' bytes';
} elseif (1 === $bytes) {
$bytes .= ' byte';
} else {
$bytes = '0 bytes';
}
return $bytes;
}
}
[ERROR] Could not process "/var/www/app/modules/CMS/src/Helpers/functions.php" file, due to:
"System error:
"Rector\TypeDeclaration\Rector\ClassMethod\StrictStringParamConcatRector::resolveVariableConcattedFromParam():
Return value must be of type ?PhpParser\Node\Expr\Variable, PhpParser\Node\Expr\AssignOp\Concat returned"
Reproduction:
Try to refactor: