Resolve PHPStan level 6 findings

This commit is contained in:
2024-08-30 09:24:25 -04:00
parent 9e0e663811
commit 0a188a80c2
29 changed files with 185 additions and 112 deletions

View File

@@ -33,8 +33,8 @@ class Field
/**
* Append the parameter name and value to the given associative array
*
* @param array $existing The existing parameters
* @return array The given parameter array with this field's name and value appended
* @param array<string, mixed> $existing The existing parameters
* @return array<string, mixed> The given parameter array with this field's name and value(s) appended
*/
public function appendParameter(array $existing): array
{
@@ -88,11 +88,11 @@ class Field
* @param string $fieldName The name of the field against which the value will be compared
* @param mixed $value The value for which equality will be checked
* @param string $paramName The name of the parameter to which this should be bound (optional; generated if blank)
* @return static The field with the requested criterion
* @return self The field with the requested criterion
*/
public static function EQ(string $fieldName, mixed $value, string $paramName = ''): static
public static function EQ(string $fieldName, mixed $value, string $paramName = ''): self
{
return new static($fieldName, Op::EQ, $value, $paramName);
return new self($fieldName, Op::EQ, $value, $paramName);
}
/**
@@ -101,11 +101,11 @@ class Field
* @param string $fieldName The name of the field against which the value will be compared
* @param mixed $value The value for the greater than comparison
* @param string $paramName The name of the parameter to which this should be bound (optional; generated if blank)
* @return static The field with the requested criterion
* @return self The field with the requested criterion
*/
public static function GT(string $fieldName, mixed $value, string $paramName = ''): static
public static function GT(string $fieldName, mixed $value, string $paramName = ''): self
{
return new static($fieldName, Op::GT, $value, $paramName);
return new self($fieldName, Op::GT, $value, $paramName);
}
/**
@@ -114,11 +114,11 @@ class Field
* @param string $fieldName The name of the field against which the value will be compared
* @param mixed $value The value for the greater than or equal to comparison
* @param string $paramName The name of the parameter to which this should be bound (optional; generated if blank)
* @return static The field with the requested criterion
* @return self The field with the requested criterion
*/
public static function GE(string $fieldName, mixed $value, string $paramName = ''): static
public static function GE(string $fieldName, mixed $value, string $paramName = ''): self
{
return new static($fieldName, Op::GE, $value, $paramName);
return new self($fieldName, Op::GE, $value, $paramName);
}
/**
@@ -127,11 +127,11 @@ class Field
* @param string $fieldName The name of the field against which the value will be compared
* @param mixed $value The value for the less than comparison
* @param string $paramName The name of the parameter to which this should be bound (optional; generated if blank)
* @return static The field with the requested criterion
* @return self The field with the requested criterion
*/
public static function LT(string $fieldName, mixed $value, string $paramName = ''): static
public static function LT(string $fieldName, mixed $value, string $paramName = ''): self
{
return new static($fieldName, Op::LT, $value, $paramName);
return new self($fieldName, Op::LT, $value, $paramName);
}
/**
@@ -140,11 +140,11 @@ class Field
* @param string $fieldName The name of the field against which the value will be compared
* @param mixed $value The value for the less than or equal to comparison
* @param string $paramName The name of the parameter to which this should be bound (optional; generated if blank)
* @return static The field with the requested criterion
* @return self The field with the requested criterion
*/
public static function LE(string $fieldName, mixed $value, string $paramName = ''): static
public static function LE(string $fieldName, mixed $value, string $paramName = ''): self
{
return new static($fieldName, Op::LE, $value, $paramName);
return new self($fieldName, Op::LE, $value, $paramName);
}
/**
@@ -153,11 +153,11 @@ class Field
* @param string $fieldName The name of the field against which the value will be compared
* @param mixed $value The value for the not equals comparison
* @param string $paramName The name of the parameter to which this should be bound (optional; generated if blank)
* @return static The field with the requested criterion
* @return self The field with the requested criterion
*/
public static function NE(string $fieldName, mixed $value, string $paramName = ''): static
public static function NE(string $fieldName, mixed $value, string $paramName = ''): self
{
return new static($fieldName, Op::NE, $value, $paramName);
return new self($fieldName, Op::NE, $value, $paramName);
}
/**
@@ -167,32 +167,32 @@ class Field
* @param mixed $minValue The lower value for range
* @param mixed $maxValue The upper value for the range
* @param string $paramName The name of the parameter to which this should be bound (optional; generated if blank)
* @return static The field with the requested criterion
* @return self The field with the requested criterion
*/
public static function BT(string $fieldName, mixed $minValue, mixed $maxValue, string $paramName = ''): static
public static function BT(string $fieldName, mixed $minValue, mixed $maxValue, string $paramName = ''): self
{
return new static($fieldName, Op::BT, [$minValue, $maxValue], $paramName);
return new self($fieldName, Op::BT, [$minValue, $maxValue], $paramName);
}
/**
* Create an exists (IS NOT NULL) field criterion
*
* @param string $fieldName The name of the field for which existence will be checked
* @return static The field with the requested criterion
* @return self The field with the requested criterion
*/
public static function EX(string $fieldName): static
public static function EX(string $fieldName): self
{
return new static($fieldName, Op::EX, '', '');
return new self($fieldName, Op::EX, '', '');
}
/**
* Create a not exists (IS NULL) field criterion
*
* @param string $fieldName The name of the field for which non-existence will be checked
* @return static The field with the requested criterion
* @return self The field with the requested criterion
*/
public static function NEX(string $fieldName): static
public static function NEX(string $fieldName): self
{
return new static($fieldName, Op::NEX, '', '');
return new self($fieldName, Op::NEX, '', '');
}
}