Fixed phpstan issues

This commit is contained in:
Jan Böhmer 2025-11-30 23:37:34 +01:00
parent 8efc1ab07d
commit 9f2989444a
2 changed files with 5 additions and 7 deletions

View file

@ -124,7 +124,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
/** /**
* @var float|null the guaranteed minimum value of this property * @var float|null the guaranteed minimum value of this property
*/ */
#[Assert\Type(['float', null])] #[Assert\Type(['float', 'null'])]
#[Assert\LessThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.min_lesser_typical')] #[Assert\LessThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.min_lesser_typical')]
#[Assert\LessThan(propertyPath: 'value_max', message: 'parameters.validator.min_lesser_max')] #[Assert\LessThan(propertyPath: 'value_max', message: 'parameters.validator.min_lesser_max')]
#[Groups(['full', 'parameter:read', 'parameter:write', 'import'])] #[Groups(['full', 'parameter:read', 'parameter:write', 'import'])]
@ -134,7 +134,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
/** /**
* @var float|null the typical value of this property * @var float|null the typical value of this property
*/ */
#[Assert\Type([null, 'float'])] #[Assert\Type(['null', 'float'])]
#[Groups(['full', 'parameter:read', 'parameter:write', 'import'])] #[Groups(['full', 'parameter:read', 'parameter:write', 'import'])]
#[ORM\Column(type: Types::FLOAT, nullable: true)] #[ORM\Column(type: Types::FLOAT, nullable: true)]
protected ?float $value_typical = null; protected ?float $value_typical = null;
@ -142,7 +142,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
/** /**
* @var float|null the maximum value of this property * @var float|null the maximum value of this property
*/ */
#[Assert\Type(['float', null])] #[Assert\Type(['float', 'null'])]
#[Assert\GreaterThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.max_greater_typical')] #[Assert\GreaterThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.max_greater_typical')]
#[Groups(['full', 'parameter:read', 'parameter:write', 'import'])] #[Groups(['full', 'parameter:read', 'parameter:write', 'import'])]
#[ORM\Column(type: Types::FLOAT, nullable: true)] #[ORM\Column(type: Types::FLOAT, nullable: true)]
@ -461,7 +461,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
return $str; return $str;
} }
/** /**
* Returns the class of the element that is allowed to be associated with this attachment. * Returns the class of the element that is allowed to be associated with this attachment.
* @return string * @return string

View file

@ -72,11 +72,9 @@ class ProviderSelectType extends AbstractType
$resolver->setDefault('choice_label', function (Options $options){ $resolver->setDefault('choice_label', function (Options $options){
if ('object' === $options['input']) { if ('object' === $options['input']) {
return ChoiceList::label($this, static fn (?InfoProviderInterface $choice) => new StaticMessage($choice?->getProviderInfo()['name'])); return ChoiceList::label($this, static fn (?InfoProviderInterface $choice) => new StaticMessage($choice?->getProviderInfo()['name']));
} else {
return static fn ($choice, $key, $value) => new StaticMessage($key);
} }
return null; return static fn ($choice, $key, $value) => new StaticMessage($key);
}); });
$resolver->setDefault('choice_value', function (Options $options) { $resolver->setDefault('choice_value', function (Options $options) {
if ('object' === $options['input']) { if ('object' === $options['input']) {