diff --git a/lib/Assert/Assertion.php b/lib/Assert/Assertion.php index 6f5b3c2d..a86275bc 100644 --- a/lib/Assert/Assertion.php +++ b/lib/Assert/Assertion.php @@ -353,6 +353,10 @@ public static function eqArraySubset($value, $value2, $message = null, string $p * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-template ExpectedType + * @psalm-param ExpectedType $value2 + * @psalm-assert =ExpectedType $value + * * @return bool * * @throws AssertionFailedException @@ -406,6 +410,10 @@ public static function notEq($value1, $value2, $message = null, string $property * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-template ExpectedType + * @psalm-param ExpectedType $value2 + * @psalm-assert !=ExpectedType $value + * * @return bool * * @throws AssertionFailedException @@ -457,6 +465,8 @@ public static function notInArray($value, array $choices, $message = null, strin * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert int $value + * * @return bool * * @throws AssertionFailedException @@ -482,6 +492,8 @@ public static function integer($value, $message = null, string $propertyPath = n * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert float $value + * * @return bool * * @throws AssertionFailedException @@ -507,6 +519,8 @@ public static function float($value, $message = null, string $propertyPath = nul * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert =numeric $value + * * @return bool * * @throws AssertionFailedException @@ -570,6 +584,8 @@ public static function integerish($value, $message = null, string $propertyPath * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert bool $value + * * @return bool * * @throws AssertionFailedException @@ -595,6 +611,8 @@ public static function boolean($value, $message = null, string $propertyPath = n * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert scalar $value + * * @return bool * * @throws AssertionFailedException @@ -620,6 +638,8 @@ public static function scalar($value, $message = null, string $propertyPath = nu * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert !empty $value + * * @return bool * * @throws AssertionFailedException @@ -645,6 +665,8 @@ public static function notEmpty($value, $message = null, string $propertyPath = * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert empty $value + * * @return bool * * @throws AssertionFailedException @@ -670,6 +692,8 @@ public static function noContent($value, $message = null, string $propertyPath = * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert null $value + * * @return bool */ public static function null($value, $message = null, string $propertyPath = null): bool @@ -693,6 +717,8 @@ public static function null($value, $message = null, string $propertyPath = null * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert !null $value + * * @return bool * * @throws AssertionFailedException @@ -718,6 +744,8 @@ public static function notNull($value, $message = null, string $propertyPath = n * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert string $value + * * @return bool * * @throws AssertionFailedException @@ -745,6 +773,8 @@ public static function string($value, $message = null, string $propertyPath = nu * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert =string $value + * * @return bool * * @throws AssertionFailedException @@ -775,6 +805,8 @@ public static function regex($value, $pattern, $message = null, string $property * * @return bool * + * @psalm-assert !=string $value + * * @throws AssertionFailedException */ public static function notRegex($value, $pattern, $message = null, string $propertyPath = null): bool @@ -802,6 +834,8 @@ public static function notRegex($value, $pattern, $message = null, string $prope * @param string|null $propertyPath * @param string $encoding * + * @psalm-assert =string $value + * * @return bool * * @throws AssertionFailedException @@ -833,6 +867,8 @@ public static function length($value, $length, $message = null, string $property * @param string|null $propertyPath * @param string $encoding * + * @psalm-assert =string $value + * * @return bool * * @throws AssertionFailedException @@ -864,6 +900,8 @@ public static function minLength($value, $minLength, $message = null, string $pr * @param string|null $propertyPath * @param string $encoding * + * @psalm-assert =string $value + * * @return bool * * @throws AssertionFailedException @@ -896,6 +934,8 @@ public static function maxLength($value, $maxLength, $message = null, string $pr * @param string|null $propertyPath * @param string $encoding * + * @psalm-assert =string $value + * * @return bool * * @throws AssertionFailedException @@ -918,6 +958,8 @@ public static function betweenLength($value, $minLength, $maxLength, $message = * @param string|null $propertyPath * @param string $encoding * + * @psalm-assert =string $string + * * @return bool * * @throws AssertionFailedException @@ -948,6 +990,8 @@ public static function startsWith($string, $needle, $message = null, string $pro * @param string|null $propertyPath * @param string $encoding * + * @psalm-assert =string $string + * * @return bool * * @throws AssertionFailedException @@ -980,6 +1024,8 @@ public static function endsWith($string, $needle, $message = null, string $prope * @param string|null $propertyPath * @param string $encoding * + * @psalm-assert =string $string + * * @return bool * * @throws AssertionFailedException @@ -1010,6 +1056,8 @@ public static function contains($string, $needle, $message = null, string $prope * @param string|null $propertyPath * @param string $encoding * + * @psalm-assert =string $string + * * @return bool * * @throws AssertionFailedException @@ -1084,6 +1132,8 @@ public static function inArray($value, array $choices, $message = null, string $ * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert numeric $string + * * @return bool * * @throws AssertionFailedException @@ -1109,6 +1159,8 @@ public static function numeric($value, $message = null, string $propertyPath = n * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert resource $string + * * @return bool */ public static function isResource($value, $message = null, string $propertyPath = null): bool @@ -1132,6 +1184,8 @@ public static function isResource($value, $message = null, string $propertyPath * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert array $string + * * @return bool * * @throws AssertionFailedException @@ -1157,6 +1211,8 @@ public static function isArray($value, $message = null, string $propertyPath = n * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert iterable $string + * * @return bool * * @throws AssertionFailedException @@ -1207,6 +1263,8 @@ public static function isArrayAccessible($value, $message = null, string $proper * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert countable $string + * * @return bool * * @throws AssertionFailedException @@ -1368,6 +1426,10 @@ public static function notBlank($value, $message = null, string $propertyPath = * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-template ExpectedType of object + * @psalm-param class-string $className + * @psalm-assert ExpectedType $value + * * @return bool * * @throws AssertionFailedException @@ -1395,6 +1457,10 @@ public static function isInstanceOf($value, $className, $message = null, string * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-template ExpectedType of object + * @psalm-param class-string $className + * @psalm-assert !ExpectedType $value + * * @return bool * * @throws AssertionFailedException @@ -1450,6 +1516,8 @@ public static function subclassOf($value, $className, $message = null, string $p * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert =numeric $value + * * @return bool * * @throws AssertionFailedException @@ -1480,6 +1548,8 @@ public static function range($value, $minValue, $maxValue, $message = null, stri * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert =numeric $value + * * @return bool * * @throws AssertionFailedException @@ -1509,6 +1579,8 @@ public static function min($value, $minValue, $message = null, string $propertyP * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert =numeric $value + * * @return bool * * @throws AssertionFailedException @@ -1646,6 +1718,8 @@ public static function writeable($value, $message = null, string $propertyPath = * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert =string $value + * * @return bool * * @throws AssertionFailedException @@ -1675,6 +1749,8 @@ public static function email($value, $message = null, string $propertyPath = nul * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert =string $value + * * @return bool * * @throws AssertionFailedException @@ -1754,6 +1830,8 @@ public static function alnum($value, $message = null, string $propertyPath = nul * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert true $value + * * @return bool * * @throws AssertionFailedException @@ -1779,6 +1857,8 @@ public static function true($value, $message = null, string $propertyPath = null * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert false $value + * * @return bool * * @throws AssertionFailedException @@ -1804,6 +1884,8 @@ public static function false($value, $message = null, string $propertyPath = nul * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert class-string $value + * * @return bool * * @throws AssertionFailedException @@ -1829,6 +1911,8 @@ public static function classExists($value, $message = null, string $propertyPath * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert class-string $value + * * @return bool * * @throws AssertionFailedException @@ -1896,6 +1980,8 @@ public static function implementsInterface($class, $interfaceName, $message = nu * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert =string $value + * * @return bool * * @throws AssertionFailedException @@ -1982,6 +2068,8 @@ public static function e164($value, $message = null, string $propertyPath = null * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert non-empty-countable $value + * * @return bool * * @throws AssertionFailedException @@ -2162,6 +2250,8 @@ public static function methodExists($value, $object, $message = null, string $pr * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert object $value + * * @return bool * * @throws AssertionFailedException @@ -2569,6 +2659,8 @@ public static function extensionVersion($extension, $operator, $version, $messag * @param string|callable|null $message * @param string|null $propertyPath * + * @psalm-assert callable $value + * * @return bool * * @throws AssertionFailedException