mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Fixed strict typing errors
This commit is contained in:
parent
6a2ff9d153
commit
e5a14557a2
6 changed files with 32 additions and 23 deletions
|
@ -40,10 +40,12 @@ abstract class AbstractConstraint implements FilterInterface
|
|||
*/
|
||||
abstract public function isEnabled(): bool;
|
||||
|
||||
public function __construct(/**
|
||||
public function __construct(
|
||||
/**
|
||||
* @var string The property where this BooleanConstraint should apply to
|
||||
*/
|
||||
protected string $property, string $identifier = null)
|
||||
protected string $property,
|
||||
string $identifier = null)
|
||||
{
|
||||
$this->identifier = $identifier ?? $this->generateParameterIdentifier($property);
|
||||
}
|
||||
|
|
|
@ -26,8 +26,12 @@ use Doctrine\ORM\QueryBuilder;
|
|||
|
||||
class BooleanConstraint extends AbstractConstraint
|
||||
{
|
||||
public function __construct(string $property, string $identifier = null, /** @var bool|null The value of our constraint */
|
||||
protected ?bool $value = null)
|
||||
public function __construct(
|
||||
string $property,
|
||||
string $identifier = null,
|
||||
/** @var bool|null The value of our constraint */
|
||||
protected ?bool $value = null
|
||||
)
|
||||
{
|
||||
parent::__construct($property, $identifier);
|
||||
}
|
||||
|
|
|
@ -31,12 +31,12 @@ class ChoiceConstraint extends AbstractConstraint
|
|||
/**
|
||||
* @var string[]|int[] The values to compare to
|
||||
*/
|
||||
protected array $value;
|
||||
protected array $value = [];
|
||||
|
||||
/**
|
||||
* @var string The operator to use
|
||||
*/
|
||||
protected string $operator;
|
||||
protected string $operator = "";
|
||||
|
||||
/**
|
||||
* @return string[]|int[]
|
||||
|
|
|
@ -43,7 +43,12 @@ class EntityConstraint extends AbstractConstraint
|
|||
* @param null $value
|
||||
* @param string $operator
|
||||
*/
|
||||
public function __construct(protected ?NodesListBuilder $nodesListBuilder, protected string $class, string $property, string $identifier = null, protected $value = null, protected ?string $operator = '')
|
||||
public function __construct(protected ?NodesListBuilder $nodesListBuilder,
|
||||
protected string $class,
|
||||
string $property,
|
||||
string $identifier = null,
|
||||
protected $value = null,
|
||||
protected ?string $operator = null)
|
||||
{
|
||||
if (!$nodesListBuilder instanceof NodesListBuilder && $this->isStructural()) {
|
||||
throw new \InvalidArgumentException('NodesListBuilder must be provided for structural entities');
|
||||
|
|
|
@ -34,12 +34,12 @@ class InstanceOfConstraint extends AbstractConstraint
|
|||
/**
|
||||
* @var string[] The values to compare to (fully qualified class names)
|
||||
*/
|
||||
protected array $value;
|
||||
protected array $value = [];
|
||||
|
||||
/**
|
||||
* @var string The operator to use
|
||||
*/
|
||||
protected string $operator;
|
||||
protected string $operator = "";
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
|
|
|
@ -63,20 +63,18 @@ class NumberConstraint extends AbstractConstraint
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param float|null|int|\DateTimeInterface $value1
|
||||
* @param float|null|int|\DateTimeInterface $value2
|
||||
*/
|
||||
public function __construct(string $property, string $identifier = null, /**
|
||||
* The value1 used for comparison (this is the main one used for all mono-value comparisons)
|
||||
*/
|
||||
protected float|int|\DateTimeInterface|null $value1 = null, /**
|
||||
* @var string|null The operator to use
|
||||
*/
|
||||
protected ?string $operator = null, /**
|
||||
* The second value used when operator is RANGE; this is the upper bound of the range
|
||||
*/
|
||||
protected float|int|\DateTimeInterface|null $value2 = null)
|
||||
public function __construct(
|
||||
string $property,
|
||||
string $identifier = null,
|
||||
/**
|
||||
* The value1 used for comparison (this is the main one used for all mono-value comparisons)
|
||||
*/
|
||||
protected float|int|\DateTimeInterface|null $value1 = null,
|
||||
protected ?string $operator = null,
|
||||
/**
|
||||
* The second value used when operator is RANGE; this is the upper bound of the range
|
||||
*/
|
||||
protected float|int|\DateTimeInterface|null $value2 = null)
|
||||
{
|
||||
parent::__construct($property, $identifier);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue