DX: apply rector rules up to php8.0

This commit is contained in:
2023-04-15 01:05:37 +02:00
parent d8870e906f
commit dde3002100
714 changed files with 2348 additions and 9263 deletions

View File

@@ -73,20 +73,11 @@ class OverlapsI extends FunctionNode
protected function makeCase($sqlWalker, $part, string $position): string
{
switch ($position) {
case 'start':
$p = '-infinity';
break;
case 'end':
$p = 'infinity';
break;
default:
throw new Exception('Unexpected position value.');
}
$p = match ($position) {
'start' => '-infinity',
'end' => 'infinity',
default => throw new Exception('Unexpected position value.'),
};
if ($part instanceof PathExpression) {
return sprintf(

View File

@@ -22,11 +22,8 @@ use Symfony\Component\Security\Core\Security;
class TrackCreateUpdateSubscriber implements EventSubscriber
{
private Security $security;
public function __construct(Security $security)
public function __construct(private Security $security)
{
$this->security = $security;
}
public function getSubscribedEvents()

View File

@@ -20,14 +20,8 @@ class Point implements JsonSerializable
{
public static string $SRID = '4326';
private ?float $lat;
private ?float $lon;
private function __construct(?float $lon, ?float $lat)
private function __construct(private ?float $lon, private ?float $lat)
{
$this->lat = $lat;
$this->lon = $lon;
}
public static function fromArrayGeoJson(array $array): self

View File

@@ -91,28 +91,12 @@ class NativeDateIntervalType extends DateIntervalType
if (is_numeric($current)) {
$next = next($strings);
switch ($next) {
case 'year':
case 'years':
$unit = 'Y';
break;
case 'mon':
case 'mons':
$unit = 'M';
break;
case 'day':
case 'days':
$unit = 'D';
break;
default:
throw $this->createConversionException(implode('', $strings));
}
$unit = match ($next) {
'year', 'years' => 'Y',
'mon', 'mons' => 'M',
'day', 'days' => 'D',
default => throw $this->createConversionException(implode('', $strings)),
};
return $current . $unit;
}

View File

@@ -44,10 +44,8 @@ class PointType extends Type
/**
* @param mixed $value
*
* @return ?Point
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
public function convertToPHPValue($value, AbstractPlatform $platform): ?\Chill\MainBundle\Doctrine\Model\Point
{
if (null === $value) {
return null;