summaryrefslogtreecommitdiff
path: root/vendor/beberlei/assert/lib/Assert/functions.php
diff options
context:
space:
mode:
authorChih-Hsuan Yen <[email protected]>2022-07-03 14:47:43 +0800
committerAndrew Dolgov <[email protected]>2022-07-12 22:23:30 +0300
commitd9861038bcc3cb2f38c7153bdca7d5ab89597afa (patch)
tree7b7b28f75714a24856106edce8dfdc0ec989057a /vendor/beberlei/assert/lib/Assert/functions.php
parentf8fe5e02f18ce3d61544865cc8eb22df18be6bf1 (diff)
Update beberlei/assert for PHP 8 compatibility
Run `composer update beberlei/assert` using composer 2.3.8 on PHP 8.1.7 Updating other packages without updating this fails with: ``` Your requirements could not be resolved to an installable set of packages. Problem 1 - beberlei/assert v3.2.2 requires php ^7 -> your php version (8.1.7) does not satisfy that requirement. - spomky-labs/otphp v10.0.1 requires beberlei/assert ^3.0 -> satisfiable by beberlei/assert[v3.2.2]. - spomky-labs/otphp is locked to version v10.0.1 and an update of this package was not requested. ```
Diffstat (limited to 'vendor/beberlei/assert/lib/Assert/functions.php')
-rw-r--r--vendor/beberlei/assert/lib/Assert/functions.php32
1 files changed, 12 insertions, 20 deletions
diff --git a/vendor/beberlei/assert/lib/Assert/functions.php b/vendor/beberlei/assert/lib/Assert/functions.php
index 67bb6315e..1a4e84d92 100644
--- a/vendor/beberlei/assert/lib/Assert/functions.php
+++ b/vendor/beberlei/assert/lib/Assert/functions.php
@@ -20,6 +20,10 @@ namespace Assert;
* The invocation of this method starts an assertion chain
* that is happening on the passed value.
*
+ * @param mixed $value
+ * @param string|callable|null $defaultMessage
+ * @param string $defaultPropertyPath
+ *
* @example
*
* \Assert\that($value)->notEmpty()->integer();
@@ -27,14 +31,8 @@ namespace Assert;
*
* The assertion chain can be stateful, that means be careful when you reuse
* it. You should never pass around the chain.
- *
- * @param mixed $value
- * @param string $defaultMessage
- * @param string $defaultPropertyPath
- *
- * @return \Assert\AssertionChain
*/
-function that($value, $defaultMessage = null, $defaultPropertyPath = null)
+function that($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
{
return Assert::that($value, $defaultMessage, $defaultPropertyPath);
}
@@ -42,13 +40,11 @@ function that($value, $defaultMessage = null, $defaultPropertyPath = null)
/**
* Start validation on a set of values, returns {@link AssertionChain}.
*
- * @param mixed $values
- * @param string $defaultMessage
+ * @param mixed $values
+ * @param string|callable|null $defaultMessage
* @param string $defaultPropertyPath
- *
- * @return \Assert\AssertionChain
*/
-function thatAll($values, $defaultMessage = null, $defaultPropertyPath = null)
+function thatAll($values, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
{
return Assert::thatAll($values, $defaultMessage, $defaultPropertyPath);
}
@@ -56,25 +52,21 @@ function thatAll($values, $defaultMessage = null, $defaultPropertyPath = null)
/**
* Start validation and allow NULL, returns {@link AssertionChain}.
*
- * @param mixed $value
- * @param string $defaultMessage
+ * @param mixed $value
+ * @param string|callable|null $defaultMessage
* @param string $defaultPropertyPath
*
- * @return \Assert\AssertionChain
- *
* @deprecated In favour of Assert::thatNullOr($value, $defaultMessage = null, $defaultPropertyPath = null)
*/
-function thatNullOr($value, $defaultMessage = null, $defaultPropertyPath = null)
+function thatNullOr($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
{
return Assert::thatNullOr($value, $defaultMessage, $defaultPropertyPath);
}
/**
* Create a lazy assertion object.
- *
- * @return \Assert\LazyAssertion
*/
-function lazy()
+function lazy(): LazyAssertion
{
return Assert::lazy();
}