fix phpstan issues

This commit is contained in:
2023-04-28 22:55:01 +02:00
parent 9027cbd196
commit c35994203d
10 changed files with 24 additions and 43 deletions

View File

@@ -258,7 +258,9 @@ class ApiController extends AbstractCRUDController
}
match ($request->getMethod()) {
/* @phpstan-ignore-next-line */
Request::METHOD_DELETE => $entity->{'remove' . ucfirst($property)}($postedData),
/* @phpstan-ignore-next-line */
Request::METHOD_POST => $entity->{'add' . ucfirst($property)}($postedData),
default => throw new BadRequestHttpException('this method is not supported'),
};

View File

@@ -209,9 +209,9 @@ class AuthorizationHelper implements AuthorizationHelperInterface
throw new UnexpectedValueException(
sprintf(
'The entity given is not an instance of %s, %s given',
'The entity given is not an instance of %s or an array of centers, %s given',
Center::class,
$center::class
gettype($center)
)
);
}

View File

@@ -23,25 +23,15 @@ class PasswordRecoverEvent extends Event
public const INVALID_TOKEN = 'chill_main.password_recover_invalid_token';
/**
* @var bool
*/
protected $safelyGenerated;
/**
* @var User
*/
protected $user;
/**
* @param type $token
* @param User $user
* @param type $ip
* @param bool $safelyGenerated true if generated safely (from console command, etc.)
*/
public function __construct(protected $token = null, ?User $user = null, protected $ip = null, bool $safelyGenerated = false)
public function __construct(
private ?string $token = null,
private ?User $user = null,
private $ip = null,
private bool $safelyGenerated = false,
)
{
$this->user = $user;
$this->safelyGenerated = $safelyGenerated;
}
public function getIp()

View File

@@ -87,7 +87,6 @@ class RollingDateConverter implements RollingDateConverterInterface
4, 5, 6 => '04',
7, 8, 9 => '07',
10, 11, 12 => '10',
default => throw new LogicException('this month is not valid: ' . $date->format('n')),
};
return DateTimeImmutable::createFromFormat(