diff options
author | Andrew Dolgov <[email protected]> | 2021-11-18 07:32:28 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-11-18 07:32:28 +0300 |
commit | 63ec5a89657bb7f9650582b96e0bb255a0889b48 (patch) | |
tree | 074b61eedd7304ba1d8d7deec01d26973ef8e6b8 /vendor/beberlei/assert/lib/Assert/AssertionChain.php | |
parent | 3a3fde1a2e0beac6d179c6449eaad726100710d7 (diff) | |
parent | 2d830c6281c19a7ee29cd379f5aedc82deef3775 (diff) |
Merge branch 'wip-phpstan-level6'
Diffstat (limited to 'vendor/beberlei/assert/lib/Assert/AssertionChain.php')
-rw-r--r-- | vendor/beberlei/assert/lib/Assert/AssertionChain.php | 50 |
1 files changed, 16 insertions, 34 deletions
diff --git a/vendor/beberlei/assert/lib/Assert/AssertionChain.php b/vendor/beberlei/assert/lib/Assert/AssertionChain.php index dbb6e839b..4d3ca1c01 100644 --- a/vendor/beberlei/assert/lib/Assert/AssertionChain.php +++ b/vendor/beberlei/assert/lib/Assert/AssertionChain.php @@ -24,15 +24,15 @@ use ReflectionClass; * * @method AssertionChain alnum(string|callable $message = null, string $propertyPath = null) Assert that value is alphanumeric. * @method AssertionChain base64(string|callable $message = null, string $propertyPath = null) Assert that a constant is defined. - * @method AssertionChain between(mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater or equal than a lower limit, and less than or equal to an upper limit. - * @method AssertionChain betweenExclusive(mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater than a lower limit, and less than an upper limit. + * @method AssertionChain between(mixed $lowerLimit, mixed $upperLimit, string $message = null, string $propertyPath = null) Assert that a value is greater or equal than a lower limit, and less than or equal to an upper limit. + * @method AssertionChain betweenExclusive(mixed $lowerLimit, mixed $upperLimit, string $message = null, string $propertyPath = null) Assert that a value is greater than a lower limit, and less than an upper limit. * @method AssertionChain betweenLength(int $minLength, int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string length is between min and max lengths. * @method AssertionChain boolean(string|callable $message = null, string $propertyPath = null) Assert that value is php boolean. * @method AssertionChain choice(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is in array of choices. * @method AssertionChain choicesNotEmpty(array $choices, string|callable $message = null, string $propertyPath = null) Determines if the values array has every choice as key and that this choice has content. * @method AssertionChain classExists(string|callable $message = null, string $propertyPath = null) Assert that the class exists. * @method AssertionChain contains(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string contains a sequence of chars. - * @method AssertionChain count(int $count, string|callable $message = null, string $propertyPath = null) Assert that the count of countable is equal to count. + * @method AssertionChain count(int $count, string $message = null, string $propertyPath = null) Assert that the count of countable is equal to count. * @method AssertionChain date(string $format, string|callable $message = null, string $propertyPath = null) Assert that date is valid and corresponds to the given format. * @method AssertionChain defined(string|callable $message = null, string $propertyPath = null) Assert that a constant is defined. * @method AssertionChain digit(string|callable $message = null, string $propertyPath = null) Validates if an integer or integerish is a digit. @@ -73,23 +73,23 @@ use ReflectionClass; * @method AssertionChain lessOrEqualThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less or equal than given limit. * @method AssertionChain lessThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less than given limit. * @method AssertionChain max(mixed $maxValue, string|callable $message = null, string $propertyPath = null) Assert that a number is smaller as a given limit. - * @method AssertionChain maxCount(int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at most $count elements. + * @method AssertionChain maxCount(int $count, string $message = null, string $propertyPath = null) Assert that the countable have at most $count elements. * @method AssertionChain maxLength(int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string value is not longer than $maxLength chars. * @method AssertionChain methodExists(mixed $object, string|callable $message = null, string $propertyPath = null) Determines that the named method is defined in the provided object. * @method AssertionChain min(mixed $minValue, string|callable $message = null, string $propertyPath = null) Assert that a value is at least as big as a given limit. - * @method AssertionChain minCount(int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at least $count elements. + * @method AssertionChain minCount(int $count, string $message = null, string $propertyPath = null) Assert that the countable have at least $count elements. * @method AssertionChain minLength(int $minLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that a string is at least $minLength chars long. * @method AssertionChain noContent(string|callable $message = null, string $propertyPath = null) Assert that value is empty. * @method AssertionChain notBlank(string|callable $message = null, string $propertyPath = null) Assert that value is not blank. * @method AssertionChain notContains(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string does not contains a sequence of chars. * @method AssertionChain notEmpty(string|callable $message = null, string $propertyPath = null) Assert that value is not empty. * @method AssertionChain notEmptyKey(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array/array-accessible object and its value is not empty. - * @method AssertionChain notEq(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not equal (using ==). + * @method AssertionChain notEq(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not equal (using == ). * @method AssertionChain notInArray(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is not in array of choices. * @method AssertionChain notIsInstanceOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is not instance of given class-name. * @method AssertionChain notNull(string|callable $message = null, string $propertyPath = null) Assert that value is not null. * @method AssertionChain notRegex(string $pattern, string|callable $message = null, string $propertyPath = null) Assert that value does not match a regex. - * @method AssertionChain notSame(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not the same (using ===). + * @method AssertionChain notSame(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not the same (using === ). * @method AssertionChain null(string|callable $message = null, string $propertyPath = null) Assert that value is null. * @method AssertionChain numeric(string|callable $message = null, string $propertyPath = null) Assert that value is numeric. * @method AssertionChain objectOrClass(string|callable $message = null, string $propertyPath = null) Assert that the value is an object, or a class that exists. @@ -113,19 +113,8 @@ use ReflectionClass; */ class AssertionChain { - /** - * @var mixed - */ private $value; - - /** - * @var string|callable|null - */ private $defaultMessage; - - /** - * @var string|null - */ private $defaultPropertyPath; /** @@ -145,14 +134,7 @@ class AssertionChain /** @var string|Assertion Class to use for assertion calls */ private $assertionClassName = 'Assert\Assertion'; - /** - * AssertionChain constructor. - * - * @param mixed $value - * @param string|callable|null $defaultMessage - * @param string|null $defaultPropertyPath - */ - public function __construct($value, $defaultMessage = null, string $defaultPropertyPath = null) + public function __construct($value, $defaultMessage = null, $defaultPropertyPath = null) { $this->value = $value; $this->defaultMessage = $defaultMessage; @@ -163,11 +145,11 @@ class AssertionChain * Call assertion on the current value in the chain. * * @param string $methodName - * @param array $args + * @param array $args * - * @return AssertionChain + * @return \Assert\AssertionChain */ - public function __call($methodName, $args): AssertionChain + public function __call($methodName, $args) { if (true === $this->alwaysValid) { return $this; @@ -209,9 +191,9 @@ class AssertionChain /** * Switch chain into validation mode for an array of values. * - * @return AssertionChain + * @return \Assert\AssertionChain */ - public function all(): AssertionChain + public function all() { $this->all = true; @@ -221,9 +203,9 @@ class AssertionChain /** * Switch chain into mode allowing nulls, ignoring further assertions. * - * @return AssertionChain + * @return \Assert\AssertionChain */ - public function nullOr(): AssertionChain + public function nullOr() { if (null === $this->value) { $this->alwaysValid = true; @@ -237,7 +219,7 @@ class AssertionChain * * @return $this */ - public function setAssertionClassName($className): AssertionChain + public function setAssertionClassName($className) { if (!\is_string($className)) { throw new LogicException('Exception class name must be passed as a string'); |