summaryrefslogtreecommitdiff
path: root/vendor/webmozart
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2022-07-12 22:26:21 +0300
committerAndrew Dolgov <[email protected]>2022-07-12 22:26:21 +0300
commit80d3db1dcf8fe9ca66d4e3f2e2116d3bc39ae2b4 (patch)
tree04b33bfb9c9368c4a31e287153abec690b9014e0 /vendor/webmozart
parent4b6161892000cb2b8392dce92a9cf2cabdf2d20e (diff)
upgrade idiorm to php8.1-patched version (aaronpk/idiorm)
Diffstat (limited to 'vendor/webmozart')
-rw-r--r--vendor/webmozart/assert/.editorconfig12
-rw-r--r--vendor/webmozart/assert/.github/workflows/ci.yaml120
-rw-r--r--vendor/webmozart/assert/.php_cs24
-rw-r--r--vendor/webmozart/assert/CHANGELOG.md17
-rw-r--r--vendor/webmozart/assert/README.md4
-rw-r--r--vendor/webmozart/assert/composer.json20
-rw-r--r--vendor/webmozart/assert/psalm.xml14
-rw-r--r--vendor/webmozart/assert/src/Assert.php38
-rw-r--r--vendor/webmozart/assert/src/Mixin.php2551
9 files changed, 2417 insertions, 383 deletions
diff --git a/vendor/webmozart/assert/.editorconfig b/vendor/webmozart/assert/.editorconfig
deleted file mode 100644
index 384453bfb..000000000
--- a/vendor/webmozart/assert/.editorconfig
+++ /dev/null
@@ -1,12 +0,0 @@
-root = true
-
-[*]
-charset=utf-8
-end_of_line=lf
-trim_trailing_whitespace=true
-insert_final_newline=true
-indent_style=space
-indent_size=4
-
-[*.yml]
-indent_size=2
diff --git a/vendor/webmozart/assert/.github/workflows/ci.yaml b/vendor/webmozart/assert/.github/workflows/ci.yaml
deleted file mode 100644
index 636fc5ab5..000000000
--- a/vendor/webmozart/assert/.github/workflows/ci.yaml
+++ /dev/null
@@ -1,120 +0,0 @@
-# https://docs.github.com/en/actions
-
-name: "CI"
-
-on:
- pull_request: ~
- push:
- branches:
- - "master"
-
-env:
- COMPOSER_ROOT_VERSION: 1.99
-
-jobs:
- coding-standards:
- name: "Coding Standards"
-
- runs-on: "ubuntu-latest"
-
- steps:
- - name: "Checkout"
- uses: "actions/[email protected]"
-
- - name: "Install PHP"
- uses: "shivammathur/[email protected]"
- with:
- coverage: "none"
- extensions: "mbstring"
- php-version: "7.4"
- tools: "composer-normalize"
-
- - name: "Validate composer.json"
- run: "composer validate --strict"
-
- - name: "Normalize composer.json"
- run: "composer-normalize --dry-run"
-
- - name: "PHP-CS-Fixer"
- uses: "docker://oskarstark/php-cs-fixer-ga:2.18.0"
- with:
- args: "--dry-run --diff-format udiff"
-
- static-code-analysis:
- name: "Static Code Analysis"
-
- runs-on: "ubuntu-latest"
-
- steps:
- - name: "Checkout"
- uses: "actions/[email protected]"
-
- - name: "Install PHP"
- uses: "shivammathur/[email protected]"
- with:
- coverage: "none"
- extensions: "mbstring"
- php-version: "7.4"
-
- - name: "Install dependencies with composer"
- run: "composer update --no-interaction --no-progress && composer i --working-dir=ci"
-
- - name: "Run vimeo/psalm"
- run: "ci/vendor/bin/psalm --threads=4"
-
- tests:
- name: "Tests"
-
- runs-on: "ubuntu-latest"
-
- strategy:
- matrix:
- php-version:
- - "7.2"
- - "7.3"
- - "7.4"
- - "8.0"
-
- steps:
- - name: "Checkout"
- uses: "actions/[email protected]"
-
- - name: "Install PHP"
- uses: "shivammathur/[email protected]"
- with:
- coverage: "none"
- extensions: "mbstring"
- php-version: "${{ matrix.php-version }}"
-
- - name: "Install dependencies with composer"
- run: "composer update --no-interaction --no-progress"
-
- - name: "Run unit tests"
- run: "vendor/bin/phpunit"
-
- windows-tests:
- name: "Windows tests"
-
- runs-on: "windows-latest"
-
- strategy:
- matrix:
- php-version:
- - "7.4"
-
- steps:
- - name: "Checkout"
- uses: "actions/[email protected]"
-
- - name: "Install PHP"
- uses: "shivammathur/[email protected]"
- with:
- coverage: "none"
- extensions: "mbstring"
- php-version: "${{ matrix.php-version }}"
-
- - name: "Install dependencies with composer"
- run: "composer update --no-interaction --no-progress"
-
- - name: "Run unit tests"
- run: "vendor/bin/phpunit tests/AssertTest.php"
diff --git a/vendor/webmozart/assert/.php_cs b/vendor/webmozart/assert/.php_cs
deleted file mode 100644
index f7afd3ed7..000000000
--- a/vendor/webmozart/assert/.php_cs
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-$finder = PhpCsFixer\Finder::create()
- ->in(__DIR__.'/src')
- ->in(__DIR__.'/tests')
-;
-
-return PhpCsFixer\Config::create()
- ->setRiskyAllowed(true)
- ->setRules([
- '@PSR2' => true,
- '@Symfony' => true,
- 'ordered_imports' => true,
- 'array_syntax' => ['syntax' => 'long'],
- 'no_superfluous_phpdoc_tags' => false,
- 'phpdoc_annotation_without_dot' => false,
- 'phpdoc_types_order' => false,
- 'phpdoc_summary' => false,
- 'phpdoc_to_comment' => false,
- 'phpdoc_align' => false,
- 'yoda_style' => false,
- ])
- ->setFinder($finder)
-;
diff --git a/vendor/webmozart/assert/CHANGELOG.md b/vendor/webmozart/assert/CHANGELOG.md
index 8629248bb..56c8011de 100644
--- a/vendor/webmozart/assert/CHANGELOG.md
+++ b/vendor/webmozart/assert/CHANGELOG.md
@@ -3,6 +3,23 @@ Changelog
## UNRELEASED
+## 1.11.0
+
+### Added
+
+* Added explicit (non magic) `allNullOr*` methods, with `@psalm-assert` annotations, for better Psalm support.
+
+### Changed
+
+* Trait methods will now check the assertion themselves, instead of using `__callStatic`
+* `isList` will now deal correctly with (modified) lists that contain `NaN`
+* `reportInvalidArgument` now has a return type of `never`.
+
+### Removed
+
+* Removed `symfony/polyfill-ctype` as a dependency, and require `ext-cytpe` instead.
+ * You can still require the `symfony/polyfill-ctype` in your project if you need it, as it provides `ext-ctype`
+
## 1.10.0
### Added
diff --git a/vendor/webmozart/assert/README.md b/vendor/webmozart/assert/README.md
index b85d59817..3b2397a1a 100644
--- a/vendor/webmozart/assert/README.md
+++ b/vendor/webmozart/assert/README.md
@@ -43,8 +43,8 @@ Installation
Use [Composer] to install the package:
-```
-$ composer require webmozart/assert
+```bash
+composer require webmozart/assert
```
Example
diff --git a/vendor/webmozart/assert/composer.json b/vendor/webmozart/assert/composer.json
index cfae60e5c..b340452c7 100644
--- a/vendor/webmozart/assert/composer.json
+++ b/vendor/webmozart/assert/composer.json
@@ -1,12 +1,12 @@
{
"name": "webmozart/assert",
"description": "Assertions to validate method input/output with nice error messages.",
+ "license": "MIT",
"keywords": [
"assert",
"check",
"validate"
],
- "license": "MIT",
"authors": [
{
"name": "Bernhard Schussek",
@@ -15,19 +15,14 @@
],
"require": {
"php": "^7.2 || ^8.0",
- "symfony/polyfill-ctype": "^1.8"
- },
- "conflict": {
- "phpstan/phpstan": "<0.12.20",
- "vimeo/psalm": "<4.6.1 || 4.6.2"
+ "ext-ctype": "*"
},
"require-dev": {
"phpunit/phpunit": "^8.5.13"
},
- "extra": {
- "branch-alias": {
- "dev-master": "1.10-dev"
- }
+ "conflict": {
+ "phpstan/phpstan": "<0.12.20",
+ "vimeo/psalm": "<4.6.1 || 4.6.2"
},
"autoload": {
"psr-4": {
@@ -39,5 +34,10 @@
"Webmozart\\Assert\\Tests\\": "tests/",
"Webmozart\\Assert\\Bin\\": "bin/src"
}
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.10-dev"
+ }
}
}
diff --git a/vendor/webmozart/assert/psalm.xml b/vendor/webmozart/assert/psalm.xml
deleted file mode 100644
index 9a4300819..000000000
--- a/vendor/webmozart/assert/psalm.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0"?>
-<psalm
- totallyTyped="true"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="https://getpsalm.org/schema/config"
- xsi:schemaLocation="https://getpsalm.org/schema/config ci/vendor/vimeo/psalm/config.xsd"
- phpVersion="7.3"
->
- <projectFiles>
- <directory name="bin" />
- <directory name="tests/static-analysis" />
- </projectFiles>
-
-</psalm>
diff --git a/vendor/webmozart/assert/src/Assert.php b/vendor/webmozart/assert/src/Assert.php
index e0fbabc86..db1f3a51a 100644
--- a/vendor/webmozart/assert/src/Assert.php
+++ b/vendor/webmozart/assert/src/Assert.php
@@ -463,7 +463,7 @@ class Assert
static::reportInvalidArgument(\sprintf(
$message ?: 'Expected an instance of any of %2$s. Got: %s',
static::typeToString($value),
- \implode(', ', \array_map(array('static', 'valueToString'), $classes))
+ \implode(', ', \array_map(array(static::class, 'valueToString'), $classes))
));
}
@@ -485,8 +485,8 @@ class Assert
if (!\is_a($value, $class, \is_string($value))) {
static::reportInvalidArgument(sprintf(
- $message ?: 'Expected an instance of this class or to this class among his parents %2$s. Got: %s',
- static::typeToString($value),
+ $message ?: 'Expected an instance of this class or to this class among its parents "%2$s". Got: %s',
+ static::valueToString($value),
$class
));
}
@@ -511,8 +511,8 @@ class Assert
if (\is_a($value, $class, \is_string($value))) {
static::reportInvalidArgument(sprintf(
- $message ?: 'Expected an instance of this class or to this class among his parents other than %2$s. Got: %s',
- static::typeToString($value),
+ $message ?: 'Expected an instance of this class or to this class among its parents other than "%2$s". Got: %s',
+ static::valueToString($value),
$class
));
}
@@ -539,9 +539,9 @@ class Assert
}
static::reportInvalidArgument(sprintf(
- $message ?: 'Expected an any of instance of this class or to this class among his parents other than %2$s. Got: %s',
- static::typeToString($value),
- \implode(', ', \array_map(array('static', 'valueToString'), $classes))
+ $message ?: 'Expected an instance of any of this classes or any of those classes among their parents "%2$s". Got: %s',
+ static::valueToString($value),
+ \implode(', ', $classes)
));
}
@@ -975,7 +975,7 @@ class Assert
static::reportInvalidArgument(\sprintf(
$message ?: 'Expected one of: %2$s. Got: %s',
static::valueToString($value),
- \implode(', ', \array_map(array('static', 'valueToString'), $values))
+ \implode(', ', \array_map(array(static::class, 'valueToString'), $values))
));
}
}
@@ -1822,11 +1822,24 @@ class Assert
*/
public static function isList($array, $message = '')
{
- if (!\is_array($array) || $array !== \array_values($array)) {
+ if (!\is_array($array)) {
static::reportInvalidArgument(
$message ?: 'Expected list - non-associative array.'
);
}
+
+ if ($array === \array_values($array)) {
+ return;
+ }
+
+ $nextKey = -1;
+ foreach ($array as $k => $v) {
+ if ($k !== ++$nextKey) {
+ static::reportInvalidArgument(
+ $message ?: 'Expected list - non-associative array.'
+ );
+ }
+ }
}
/**
@@ -1955,7 +1968,7 @@ class Assert
if ('nullOr' === \substr($name, 0, 6)) {
if (null !== $arguments[0]) {
$method = \lcfirst(\substr($name, 6));
- \call_user_func_array(array('static', $method), $arguments);
+ \call_user_func_array(array(static::class, $method), $arguments);
}
return;
@@ -1970,7 +1983,7 @@ class Assert
foreach ($arguments[0] as $entry) {
$args[0] = $entry;
- \call_user_func_array(array('static', $method), $args);
+ \call_user_func_array(array(static::class, $method), $args);
}
return;
@@ -2054,6 +2067,7 @@ class Assert
* @throws InvalidArgumentException
*
* @psalm-pure this method is not supposed to perform side-effects
+ * @psalm-return never
*/
protected static function reportInvalidArgument($message)
{
diff --git a/vendor/webmozart/assert/src/Mixin.php b/vendor/webmozart/assert/src/Mixin.php
index 5e98823d4..0f0a75e33 100644
--- a/vendor/webmozart/assert/src/Mixin.php
+++ b/vendor/webmozart/assert/src/Mixin.php
@@ -1,9 +1,5 @@
<?php
-/**
- * provides type inference and auto-completion for magic static methods of Assert.
- */
-
namespace Webmozart\Assert;
use ArrayAccess;
@@ -12,7 +8,7 @@ use Countable;
use Throwable;
/**
- * This trait aids static analysis tooling in introspecting assertion magic methods.
+ * This trait provides nurllOr*, all* and allNullOr* variants of assertion base methods.
* Do not use this trait directly: it will change, and is not designed for reuse.
*/
trait Mixin
@@ -30,7 +26,7 @@ trait Mixin
*/
public static function nullOrString($value, $message = '')
{
- static::__callStatic('nullOrString', array($value, $message));
+ null === $value || static::string($value, $message);
}
/**
@@ -46,7 +42,31 @@ trait Mixin
*/
public static function allString($value, $message = '')
{
- static::__callStatic('allString', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::string($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<string|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrString($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::string($entry, $message);
+ }
}
/**
@@ -62,7 +82,7 @@ trait Mixin
*/
public static function nullOrStringNotEmpty($value, $message = '')
{
- static::__callStatic('nullOrStringNotEmpty', array($value, $message));
+ null === $value || static::stringNotEmpty($value, $message);
}
/**
@@ -78,7 +98,31 @@ trait Mixin
*/
public static function allStringNotEmpty($value, $message = '')
{
- static::__callStatic('allStringNotEmpty', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::stringNotEmpty($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<non-empty-string|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrStringNotEmpty($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::stringNotEmpty($entry, $message);
+ }
}
/**
@@ -94,7 +138,7 @@ trait Mixin
*/
public static function nullOrInteger($value, $message = '')
{
- static::__callStatic('nullOrInteger', array($value, $message));
+ null === $value || static::integer($value, $message);
}
/**
@@ -110,7 +154,31 @@ trait Mixin
*/
public static function allInteger($value, $message = '')
{
- static::__callStatic('allInteger', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::integer($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<int|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrInteger($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::integer($entry, $message);
+ }
}
/**
@@ -126,7 +194,7 @@ trait Mixin
*/
public static function nullOrIntegerish($value, $message = '')
{
- static::__callStatic('nullOrIntegerish', array($value, $message));
+ null === $value || static::integerish($value, $message);
}
/**
@@ -142,7 +210,31 @@ trait Mixin
*/
public static function allIntegerish($value, $message = '')
{
- static::__callStatic('allIntegerish', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::integerish($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<numeric|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIntegerish($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::integerish($entry, $message);
+ }
}
/**
@@ -158,7 +250,7 @@ trait Mixin
*/
public static function nullOrPositiveInteger($value, $message = '')
{
- static::__callStatic('nullOrPositiveInteger', array($value, $message));
+ null === $value || static::positiveInteger($value, $message);
}
/**
@@ -174,7 +266,31 @@ trait Mixin
*/
public static function allPositiveInteger($value, $message = '')
{
- static::__callStatic('allPositiveInteger', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::positiveInteger($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<positive-int|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrPositiveInteger($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::positiveInteger($entry, $message);
+ }
}
/**
@@ -190,7 +306,7 @@ trait Mixin
*/
public static function nullOrFloat($value, $message = '')
{
- static::__callStatic('nullOrFloat', array($value, $message));
+ null === $value || static::float($value, $message);
}
/**
@@ -206,7 +322,31 @@ trait Mixin
*/
public static function allFloat($value, $message = '')
{
- static::__callStatic('allFloat', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::float($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<float|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrFloat($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::float($entry, $message);
+ }
}
/**
@@ -222,7 +362,7 @@ trait Mixin
*/
public static function nullOrNumeric($value, $message = '')
{
- static::__callStatic('nullOrNumeric', array($value, $message));
+ null === $value || static::numeric($value, $message);
}
/**
@@ -238,7 +378,31 @@ trait Mixin
*/
public static function allNumeric($value, $message = '')
{
- static::__callStatic('allNumeric', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::numeric($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<numeric|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrNumeric($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::numeric($entry, $message);
+ }
}
/**
@@ -254,7 +418,7 @@ trait Mixin
*/
public static function nullOrNatural($value, $message = '')
{
- static::__callStatic('nullOrNatural', array($value, $message));
+ null === $value || static::natural($value, $message);
}
/**
@@ -270,7 +434,31 @@ trait Mixin
*/
public static function allNatural($value, $message = '')
{
- static::__callStatic('allNatural', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::natural($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<positive-int|0|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrNatural($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::natural($entry, $message);
+ }
}
/**
@@ -286,7 +474,7 @@ trait Mixin
*/
public static function nullOrBoolean($value, $message = '')
{
- static::__callStatic('nullOrBoolean', array($value, $message));
+ null === $value || static::boolean($value, $message);
}
/**
@@ -302,7 +490,31 @@ trait Mixin
*/
public static function allBoolean($value, $message = '')
{
- static::__callStatic('allBoolean', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::boolean($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<bool|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrBoolean($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::boolean($entry, $message);
+ }
}
/**
@@ -318,7 +530,7 @@ trait Mixin
*/
public static function nullOrScalar($value, $message = '')
{
- static::__callStatic('nullOrScalar', array($value, $message));
+ null === $value || static::scalar($value, $message);
}
/**
@@ -334,7 +546,31 @@ trait Mixin
*/
public static function allScalar($value, $message = '')
{
- static::__callStatic('allScalar', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::scalar($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<scalar|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrScalar($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::scalar($entry, $message);
+ }
}
/**
@@ -350,7 +586,7 @@ trait Mixin
*/
public static function nullOrObject($value, $message = '')
{
- static::__callStatic('nullOrObject', array($value, $message));
+ null === $value || static::object($value, $message);
}
/**
@@ -366,7 +602,31 @@ trait Mixin
*/
public static function allObject($value, $message = '')
{
- static::__callStatic('allObject', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::object($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<object|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrObject($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::object($entry, $message);
+ }
}
/**
@@ -383,7 +643,7 @@ trait Mixin
*/
public static function nullOrResource($value, $type = null, $message = '')
{
- static::__callStatic('nullOrResource', array($value, $type, $message));
+ null === $value || static::resource($value, $type, $message);
}
/**
@@ -400,7 +660,32 @@ trait Mixin
*/
public static function allResource($value, $type = null, $message = '')
{
- static::__callStatic('allResource', array($value, $type, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::resource($entry, $type, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<resource|null> $value
+ *
+ * @param mixed $value
+ * @param string|null $type type of resource this should be. @see https://www.php.net/manual/en/function.get-resource-type.php
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrResource($value, $type = null, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::resource($entry, $type, $message);
+ }
}
/**
@@ -416,7 +701,7 @@ trait Mixin
*/
public static function nullOrIsCallable($value, $message = '')
{
- static::__callStatic('nullOrIsCallable', array($value, $message));
+ null === $value || static::isCallable($value, $message);
}
/**
@@ -432,7 +717,31 @@ trait Mixin
*/
public static function allIsCallable($value, $message = '')
{
- static::__callStatic('allIsCallable', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::isCallable($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<callable|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsCallable($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::isCallable($entry, $message);
+ }
}
/**
@@ -448,7 +757,7 @@ trait Mixin
*/
public static function nullOrIsArray($value, $message = '')
{
- static::__callStatic('nullOrIsArray', array($value, $message));
+ null === $value || static::isArray($value, $message);
}
/**
@@ -464,7 +773,31 @@ trait Mixin
*/
public static function allIsArray($value, $message = '')
{
- static::__callStatic('allIsArray', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::isArray($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<array|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsArray($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::isArray($entry, $message);
+ }
}
/**
@@ -482,7 +815,7 @@ trait Mixin
*/
public static function nullOrIsTraversable($value, $message = '')
{
- static::__callStatic('nullOrIsTraversable', array($value, $message));
+ null === $value || static::isTraversable($value, $message);
}
/**
@@ -500,7 +833,33 @@ trait Mixin
*/
public static function allIsTraversable($value, $message = '')
{
- static::__callStatic('allIsTraversable', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::isTraversable($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<iterable|null> $value
+ *
+ * @deprecated use "isIterable" or "isInstanceOf" instead
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsTraversable($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::isTraversable($entry, $message);
+ }
}
/**
@@ -516,7 +875,7 @@ trait Mixin
*/
public static function nullOrIsArrayAccessible($value, $message = '')
{
- static::__callStatic('nullOrIsArrayAccessible', array($value, $message));
+ null === $value || static::isArrayAccessible($value, $message);
}
/**
@@ -532,7 +891,31 @@ trait Mixin
*/
public static function allIsArrayAccessible($value, $message = '')
{
- static::__callStatic('allIsArrayAccessible', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::isArrayAccessible($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<array|ArrayAccess|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsArrayAccessible($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::isArrayAccessible($entry, $message);
+ }
}
/**
@@ -548,7 +931,7 @@ trait Mixin
*/
public static function nullOrIsCountable($value, $message = '')
{
- static::__callStatic('nullOrIsCountable', array($value, $message));
+ null === $value || static::isCountable($value, $message);
}
/**
@@ -564,7 +947,31 @@ trait Mixin
*/
public static function allIsCountable($value, $message = '')
{
- static::__callStatic('allIsCountable', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::isCountable($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<countable|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsCountable($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::isCountable($entry, $message);
+ }
}
/**
@@ -580,7 +987,7 @@ trait Mixin
*/
public static function nullOrIsIterable($value, $message = '')
{
- static::__callStatic('nullOrIsIterable', array($value, $message));
+ null === $value || static::isIterable($value, $message);
}
/**
@@ -596,7 +1003,31 @@ trait Mixin
*/
public static function allIsIterable($value, $message = '')
{
- static::__callStatic('allIsIterable', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::isIterable($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<iterable|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsIterable($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::isIterable($entry, $message);
+ }
}
/**
@@ -615,7 +1046,7 @@ trait Mixin
*/
public static function nullOrIsInstanceOf($value, $class, $message = '')
{
- static::__callStatic('nullOrIsInstanceOf', array($value, $class, $message));
+ null === $value || static::isInstanceOf($value, $class, $message);
}
/**
@@ -634,7 +1065,34 @@ trait Mixin
*/
public static function allIsInstanceOf($value, $class, $message = '')
{
- static::__callStatic('allIsInstanceOf', array($value, $class, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::isInstanceOf($entry, $class, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-template ExpectedType of object
+ * @psalm-param class-string<ExpectedType> $class
+ * @psalm-assert iterable<ExpectedType|null> $value
+ *
+ * @param mixed $value
+ * @param string|object $class
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsInstanceOf($value, $class, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::isInstanceOf($entry, $class, $message);
+ }
}
/**
@@ -652,7 +1110,7 @@ trait Mixin
*/
public static function nullOrNotInstanceOf($value, $class, $message = '')
{
- static::__callStatic('nullOrNotInstanceOf', array($value, $class, $message));
+ null === $value || static::notInstanceOf($value, $class, $message);
}
/**
@@ -670,7 +1128,34 @@ trait Mixin
*/
public static function allNotInstanceOf($value, $class, $message = '')
{
- static::__callStatic('allNotInstanceOf', array($value, $class, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::notInstanceOf($entry, $class, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-template ExpectedType of object
+ * @psalm-param class-string<ExpectedType> $class
+ * @psalm-assert iterable<!ExpectedType|null> $value
+ *
+ * @param mixed $value
+ * @param string|object $class
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrNotInstanceOf($value, $class, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::notInstanceOf($entry, $class, $message);
+ }
}
/**
@@ -687,7 +1172,7 @@ trait Mixin
*/
public static function nullOrIsInstanceOfAny($value, $classes, $message = '')
{
- static::__callStatic('nullOrIsInstanceOfAny', array($value, $classes, $message));
+ null === $value || static::isInstanceOfAny($value, $classes, $message);
}
/**
@@ -704,7 +1189,32 @@ trait Mixin
*/
public static function allIsInstanceOfAny($value, $classes, $message = '')
{
- static::__callStatic('allIsInstanceOfAny', array($value, $classes, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::isInstanceOfAny($entry, $classes, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-param array<class-string> $classes
+ *
+ * @param mixed $value
+ * @param array<object|string> $classes
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsInstanceOfAny($value, $classes, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::isInstanceOfAny($entry, $classes, $message);
+ }
}
/**
@@ -723,7 +1233,7 @@ trait Mixin
*/
public static function nullOrIsAOf($value, $class, $message = '')
{
- static::__callStatic('nullOrIsAOf', array($value, $class, $message));
+ null === $value || static::isAOf($value, $class, $message);
}
/**
@@ -742,7 +1252,34 @@ trait Mixin
*/
public static function allIsAOf($value, $class, $message = '')
{
- static::__callStatic('allIsAOf', array($value, $class, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::isAOf($entry, $class, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-template ExpectedType of object
+ * @psalm-param class-string<ExpectedType> $class
+ * @psalm-assert iterable<ExpectedType|class-string<ExpectedType>|null> $value
+ *
+ * @param iterable<object|string|null> $value
+ * @param string $class
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsAOf($value, $class, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::isAOf($entry, $class, $message);
+ }
}
/**
@@ -760,7 +1297,7 @@ trait Mixin
*/
public static function nullOrIsNotA($value, $class, $message = '')
{
- static::__callStatic('nullOrIsNotA', array($value, $class, $message));
+ null === $value || static::isNotA($value, $class, $message);
}
/**
@@ -778,7 +1315,35 @@ trait Mixin
*/
public static function allIsNotA($value, $class, $message = '')
{
- static::__callStatic('allIsNotA', array($value, $class, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::isNotA($entry, $class, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-template UnexpectedType of object
+ * @psalm-param class-string<UnexpectedType> $class
+ * @psalm-assert iterable<!UnexpectedType|null> $value
+ * @psalm-assert iterable<!class-string<UnexpectedType>|null> $value
+ *
+ * @param iterable<object|string|null> $value
+ * @param string $class
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsNotA($value, $class, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::isNotA($entry, $class, $message);
+ }
}
/**
@@ -795,7 +1360,7 @@ trait Mixin
*/
public static function nullOrIsAnyOf($value, $classes, $message = '')
{
- static::__callStatic('nullOrIsAnyOf', array($value, $classes, $message));
+ null === $value || static::isAnyOf($value, $classes, $message);
}
/**
@@ -812,7 +1377,32 @@ trait Mixin
*/
public static function allIsAnyOf($value, $classes, $message = '')
{
- static::__callStatic('allIsAnyOf', array($value, $classes, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::isAnyOf($entry, $classes, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-param array<class-string> $classes
+ *
+ * @param iterable<object|string|null> $value
+ * @param string[] $classes
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsAnyOf($value, $classes, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::isAnyOf($entry, $classes, $message);
+ }
}
/**
@@ -828,7 +1418,7 @@ trait Mixin
*/
public static function nullOrIsEmpty($value, $message = '')
{
- static::__callStatic('nullOrIsEmpty', array($value, $message));
+ null === $value || static::isEmpty($value, $message);
}
/**
@@ -844,7 +1434,31 @@ trait Mixin
*/
public static function allIsEmpty($value, $message = '')
{
- static::__callStatic('allIsEmpty', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::isEmpty($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<empty|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsEmpty($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::isEmpty($entry, $message);
+ }
}
/**
@@ -859,7 +1473,7 @@ trait Mixin
*/
public static function nullOrNotEmpty($value, $message = '')
{
- static::__callStatic('nullOrNotEmpty', array($value, $message));
+ null === $value || static::notEmpty($value, $message);
}
/**
@@ -874,7 +1488,31 @@ trait Mixin
*/
public static function allNotEmpty($value, $message = '')
{
- static::__callStatic('allNotEmpty', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::notEmpty($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<!empty|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrNotEmpty($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::notEmpty($entry, $message);
+ }
}
/**
@@ -890,7 +1528,11 @@ trait Mixin
*/
public static function allNull($value, $message = '')
{
- static::__callStatic('allNull', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::null($entry, $message);
+ }
}
/**
@@ -905,7 +1547,11 @@ trait Mixin
*/
public static function allNotNull($value, $message = '')
{
- static::__callStatic('allNotNull', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::notNull($entry, $message);
+ }
}
/**
@@ -921,7 +1567,7 @@ trait Mixin
*/
public static function nullOrTrue($value, $message = '')
{
- static::__callStatic('nullOrTrue', array($value, $message));
+ null === $value || static::true($value, $message);
}
/**
@@ -937,7 +1583,31 @@ trait Mixin
*/
public static function allTrue($value, $message = '')
{
- static::__callStatic('allTrue', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::true($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<true|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrTrue($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::true($entry, $message);
+ }
}
/**
@@ -953,7 +1623,7 @@ trait Mixin
*/
public static function nullOrFalse($value, $message = '')
{
- static::__callStatic('nullOrFalse', array($value, $message));
+ null === $value || static::false($value, $message);
}
/**
@@ -969,7 +1639,31 @@ trait Mixin
*/
public static function allFalse($value, $message = '')
{
- static::__callStatic('allFalse', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::false($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<false|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrFalse($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::false($entry, $message);
+ }
}
/**
@@ -984,7 +1678,7 @@ trait Mixin
*/
public static function nullOrNotFalse($value, $message = '')
{
- static::__callStatic('nullOrNotFalse', array($value, $message));
+ null === $value || static::notFalse($value, $message);
}
/**
@@ -999,7 +1693,31 @@ trait Mixin
*/
public static function allNotFalse($value, $message = '')
{
- static::__callStatic('allNotFalse', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::notFalse($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<!false|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrNotFalse($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::notFalse($entry, $message);
+ }
}
/**
@@ -1012,7 +1730,7 @@ trait Mixin
*/
public static function nullOrIp($value, $message = '')
{
- static::__callStatic('nullOrIp', array($value, $message));
+ null === $value || static::ip($value, $message);
}
/**
@@ -1025,7 +1743,28 @@ trait Mixin
*/
public static function allIp($value, $message = '')
{
- static::__callStatic('allIp', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::ip($entry, $message);
+ }
+ }
+
+ /**
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIp($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::ip($entry, $message);
+ }
}
/**
@@ -1038,7 +1777,7 @@ trait Mixin
*/
public static function nullOrIpv4($value, $message = '')
{
- static::__callStatic('nullOrIpv4', array($value, $message));
+ null === $value || static::ipv4($value, $message);
}
/**
@@ -1051,7 +1790,28 @@ trait Mixin
*/
public static function allIpv4($value, $message = '')
{
- static::__callStatic('allIpv4', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::ipv4($entry, $message);
+ }
+ }
+
+ /**
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIpv4($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::ipv4($entry, $message);
+ }
}
/**
@@ -1064,7 +1824,7 @@ trait Mixin
*/
public static function nullOrIpv6($value, $message = '')
{
- static::__callStatic('nullOrIpv6', array($value, $message));
+ null === $value || static::ipv6($value, $message);
}
/**
@@ -1077,7 +1837,28 @@ trait Mixin
*/
public static function allIpv6($value, $message = '')
{
- static::__callStatic('allIpv6', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::ipv6($entry, $message);
+ }
+ }
+
+ /**
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIpv6($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::ipv6($entry, $message);
+ }
}
/**
@@ -1090,7 +1871,7 @@ trait Mixin
*/
public static function nullOrEmail($value, $message = '')
{
- static::__callStatic('nullOrEmail', array($value, $message));
+ null === $value || static::email($value, $message);
}
/**
@@ -1103,7 +1884,28 @@ trait Mixin
*/
public static function allEmail($value, $message = '')
{
- static::__callStatic('allEmail', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::email($entry, $message);
+ }
+ }
+
+ /**
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrEmail($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::email($entry, $message);
+ }
}
/**
@@ -1116,7 +1918,7 @@ trait Mixin
*/
public static function nullOrUniqueValues($values, $message = '')
{
- static::__callStatic('nullOrUniqueValues', array($values, $message));
+ null === $values || static::uniqueValues($values, $message);
}
/**
@@ -1129,7 +1931,28 @@ trait Mixin
*/
public static function allUniqueValues($values, $message = '')
{
- static::__callStatic('allUniqueValues', array($values, $message));
+ static::isIterable($values);
+
+ foreach ($values as $entry) {
+ static::uniqueValues($entry, $message);
+ }
+ }
+
+ /**
+ * @param iterable<array|null> $values
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrUniqueValues($values, $message = '')
+ {
+ static::isIterable($values);
+
+ foreach ($values as $entry) {
+ null === $entry || static::uniqueValues($entry, $message);
+ }
}
/**
@@ -1143,7 +1966,7 @@ trait Mixin
*/
public static function nullOrEq($value, $expect, $message = '')
{
- static::__callStatic('nullOrEq', array($value, $expect, $message));
+ null === $value || static::eq($value, $expect, $message);
}
/**
@@ -1157,7 +1980,29 @@ trait Mixin
*/
public static function allEq($value, $expect, $message = '')
{
- static::__callStatic('allEq', array($value, $expect, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::eq($entry, $expect, $message);
+ }
+ }
+
+ /**
+ * @param mixed $value
+ * @param mixed $expect
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrEq($value, $expect, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::eq($entry, $expect, $message);
+ }
}
/**
@@ -1171,7 +2016,7 @@ trait Mixin
*/
public static function nullOrNotEq($value, $expect, $message = '')
{
- static::__callStatic('nullOrNotEq', array($value, $expect, $message));
+ null === $value || static::notEq($value, $expect, $message);
}
/**
@@ -1185,7 +2030,29 @@ trait Mixin
*/
public static function allNotEq($value, $expect, $message = '')
{
- static::__callStatic('allNotEq', array($value, $expect, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::notEq($entry, $expect, $message);
+ }
+ }
+
+ /**
+ * @param mixed $value
+ * @param mixed $expect
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrNotEq($value, $expect, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::notEq($entry, $expect, $message);
+ }
}
/**
@@ -1201,7 +2068,7 @@ trait Mixin
*/
public static function nullOrSame($value, $expect, $message = '')
{
- static::__callStatic('nullOrSame', array($value, $expect, $message));
+ null === $value || static::same($value, $expect, $message);
}
/**
@@ -1217,7 +2084,31 @@ trait Mixin
*/
public static function allSame($value, $expect, $message = '')
{
- static::__callStatic('allSame', array($value, $expect, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::same($entry, $expect, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param mixed $value
+ * @param mixed $expect
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrSame($value, $expect, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::same($entry, $expect, $message);
+ }
}
/**
@@ -1233,7 +2124,7 @@ trait Mixin
*/
public static function nullOrNotSame($value, $expect, $message = '')
{
- static::__callStatic('nullOrNotSame', array($value, $expect, $message));
+ null === $value || static::notSame($value, $expect, $message);
}
/**
@@ -1249,7 +2140,31 @@ trait Mixin
*/
public static function allNotSame($value, $expect, $message = '')
{
- static::__callStatic('allNotSame', array($value, $expect, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::notSame($entry, $expect, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param mixed $value
+ * @param mixed $expect
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrNotSame($value, $expect, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::notSame($entry, $expect, $message);
+ }
}
/**
@@ -1265,7 +2180,7 @@ trait Mixin
*/
public static function nullOrGreaterThan($value, $limit, $message = '')
{
- static::__callStatic('nullOrGreaterThan', array($value, $limit, $message));
+ null === $value || static::greaterThan($value, $limit, $message);
}
/**
@@ -1281,7 +2196,31 @@ trait Mixin
*/
public static function allGreaterThan($value, $limit, $message = '')
{
- static::__callStatic('allGreaterThan', array($value, $limit, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::greaterThan($entry, $limit, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param mixed $value
+ * @param mixed $limit
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrGreaterThan($value, $limit, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::greaterThan($entry, $limit, $message);
+ }
}
/**
@@ -1297,7 +2236,7 @@ trait Mixin
*/
public static function nullOrGreaterThanEq($value, $limit, $message = '')
{
- static::__callStatic('nullOrGreaterThanEq', array($value, $limit, $message));
+ null === $value || static::greaterThanEq($value, $limit, $message);
}
/**
@@ -1313,7 +2252,31 @@ trait Mixin
*/
public static function allGreaterThanEq($value, $limit, $message = '')
{
- static::__callStatic('allGreaterThanEq', array($value, $limit, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::greaterThanEq($entry, $limit, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param mixed $value
+ * @param mixed $limit
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrGreaterThanEq($value, $limit, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::greaterThanEq($entry, $limit, $message);
+ }
}
/**
@@ -1329,7 +2292,7 @@ trait Mixin
*/
public static function nullOrLessThan($value, $limit, $message = '')
{
- static::__callStatic('nullOrLessThan', array($value, $limit, $message));
+ null === $value || static::lessThan($value, $limit, $message);
}
/**
@@ -1345,7 +2308,31 @@ trait Mixin
*/
public static function allLessThan($value, $limit, $message = '')
{
- static::__callStatic('allLessThan', array($value, $limit, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::lessThan($entry, $limit, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param mixed $value
+ * @param mixed $limit
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrLessThan($value, $limit, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::lessThan($entry, $limit, $message);
+ }
}
/**
@@ -1361,7 +2348,7 @@ trait Mixin
*/
public static function nullOrLessThanEq($value, $limit, $message = '')
{
- static::__callStatic('nullOrLessThanEq', array($value, $limit, $message));
+ null === $value || static::lessThanEq($value, $limit, $message);
}
/**
@@ -1377,7 +2364,31 @@ trait Mixin
*/
public static function allLessThanEq($value, $limit, $message = '')
{
- static::__callStatic('allLessThanEq', array($value, $limit, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::lessThanEq($entry, $limit, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param mixed $value
+ * @param mixed $limit
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrLessThanEq($value, $limit, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::lessThanEq($entry, $limit, $message);
+ }
}
/**
@@ -1394,7 +2405,7 @@ trait Mixin
*/
public static function nullOrRange($value, $min, $max, $message = '')
{
- static::__callStatic('nullOrRange', array($value, $min, $max, $message));
+ null === $value || static::range($value, $min, $max, $message);
}
/**
@@ -1411,7 +2422,32 @@ trait Mixin
*/
public static function allRange($value, $min, $max, $message = '')
{
- static::__callStatic('allRange', array($value, $min, $max, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::range($entry, $min, $max, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param mixed $value
+ * @param mixed $min
+ * @param mixed $max
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrRange($value, $min, $max, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::range($entry, $min, $max, $message);
+ }
}
/**
@@ -1427,7 +2463,7 @@ trait Mixin
*/
public static function nullOrOneOf($value, $values, $message = '')
{
- static::__callStatic('nullOrOneOf', array($value, $values, $message));
+ null === $value || static::oneOf($value, $values, $message);
}
/**
@@ -1443,7 +2479,31 @@ trait Mixin
*/
public static function allOneOf($value, $values, $message = '')
{
- static::__callStatic('allOneOf', array($value, $values, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::oneOf($entry, $values, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param mixed $value
+ * @param array $values
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrOneOf($value, $values, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::oneOf($entry, $values, $message);
+ }
}
/**
@@ -1459,7 +2519,7 @@ trait Mixin
*/
public static function nullOrInArray($value, $values, $message = '')
{
- static::__callStatic('nullOrInArray', array($value, $values, $message));
+ null === $value || static::inArray($value, $values, $message);
}
/**
@@ -1475,7 +2535,31 @@ trait Mixin
*/
public static function allInArray($value, $values, $message = '')
{
- static::__callStatic('allInArray', array($value, $values, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::inArray($entry, $values, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param mixed $value
+ * @param array $values
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrInArray($value, $values, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::inArray($entry, $values, $message);
+ }
}
/**
@@ -1491,7 +2575,7 @@ trait Mixin
*/
public static function nullOrContains($value, $subString, $message = '')
{
- static::__callStatic('nullOrContains', array($value, $subString, $message));
+ null === $value || static::contains($value, $subString, $message);
}
/**
@@ -1507,7 +2591,31 @@ trait Mixin
*/
public static function allContains($value, $subString, $message = '')
{
- static::__callStatic('allContains', array($value, $subString, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::contains($entry, $subString, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param string $subString
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrContains($value, $subString, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::contains($entry, $subString, $message);
+ }
}
/**
@@ -1523,7 +2631,7 @@ trait Mixin
*/
public static function nullOrNotContains($value, $subString, $message = '')
{
- static::__callStatic('nullOrNotContains', array($value, $subString, $message));
+ null === $value || static::notContains($value, $subString, $message);
}
/**
@@ -1539,7 +2647,31 @@ trait Mixin
*/
public static function allNotContains($value, $subString, $message = '')
{
- static::__callStatic('allNotContains', array($value, $subString, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::notContains($entry, $subString, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param string $subString
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrNotContains($value, $subString, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::notContains($entry, $subString, $message);
+ }
}
/**
@@ -1554,7 +2686,7 @@ trait Mixin
*/
public static function nullOrNotWhitespaceOnly($value, $message = '')
{
- static::__callStatic('nullOrNotWhitespaceOnly', array($value, $message));
+ null === $value || static::notWhitespaceOnly($value, $message);
}
/**
@@ -1569,7 +2701,30 @@ trait Mixin
*/
public static function allNotWhitespaceOnly($value, $message = '')
{
- static::__callStatic('allNotWhitespaceOnly', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::notWhitespaceOnly($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrNotWhitespaceOnly($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::notWhitespaceOnly($entry, $message);
+ }
}
/**
@@ -1585,7 +2740,7 @@ trait Mixin
*/
public static function nullOrStartsWith($value, $prefix, $message = '')
{
- static::__callStatic('nullOrStartsWith', array($value, $prefix, $message));
+ null === $value || static::startsWith($value, $prefix, $message);
}
/**
@@ -1601,7 +2756,31 @@ trait Mixin
*/
public static function allStartsWith($value, $prefix, $message = '')
{
- static::__callStatic('allStartsWith', array($value, $prefix, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::startsWith($entry, $prefix, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param string $prefix
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrStartsWith($value, $prefix, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::startsWith($entry, $prefix, $message);
+ }
}
/**
@@ -1617,7 +2796,7 @@ trait Mixin
*/
public static function nullOrNotStartsWith($value, $prefix, $message = '')
{
- static::__callStatic('nullOrNotStartsWith', array($value, $prefix, $message));
+ null === $value || static::notStartsWith($value, $prefix, $message);
}
/**
@@ -1633,7 +2812,31 @@ trait Mixin
*/
public static function allNotStartsWith($value, $prefix, $message = '')
{
- static::__callStatic('allNotStartsWith', array($value, $prefix, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::notStartsWith($entry, $prefix, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param string $prefix
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrNotStartsWith($value, $prefix, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::notStartsWith($entry, $prefix, $message);
+ }
}
/**
@@ -1648,7 +2851,7 @@ trait Mixin
*/
public static function nullOrStartsWithLetter($value, $message = '')
{
- static::__callStatic('nullOrStartsWithLetter', array($value, $message));
+ null === $value || static::startsWithLetter($value, $message);
}
/**
@@ -1663,7 +2866,30 @@ trait Mixin
*/
public static function allStartsWithLetter($value, $message = '')
{
- static::__callStatic('allStartsWithLetter', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::startsWithLetter($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrStartsWithLetter($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::startsWithLetter($entry, $message);
+ }
}
/**
@@ -1679,7 +2905,7 @@ trait Mixin
*/
public static function nullOrEndsWith($value, $suffix, $message = '')
{
- static::__callStatic('nullOrEndsWith', array($value, $suffix, $message));
+ null === $value || static::endsWith($value, $suffix, $message);
}
/**
@@ -1695,7 +2921,31 @@ trait Mixin
*/
public static function allEndsWith($value, $suffix, $message = '')
{
- static::__callStatic('allEndsWith', array($value, $suffix, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::endsWith($entry, $suffix, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param string $suffix
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrEndsWith($value, $suffix, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::endsWith($entry, $suffix, $message);
+ }
}
/**
@@ -1711,7 +2961,7 @@ trait Mixin
*/
public static function nullOrNotEndsWith($value, $suffix, $message = '')
{
- static::__callStatic('nullOrNotEndsWith', array($value, $suffix, $message));
+ null === $value || static::notEndsWith($value, $suffix, $message);
}
/**
@@ -1727,7 +2977,31 @@ trait Mixin
*/
public static function allNotEndsWith($value, $suffix, $message = '')
{
- static::__callStatic('allNotEndsWith', array($value, $suffix, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::notEndsWith($entry, $suffix, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param string $suffix
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrNotEndsWith($value, $suffix, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::notEndsWith($entry, $suffix, $message);
+ }
}
/**
@@ -1743,7 +3017,7 @@ trait Mixin
*/
public static function nullOrRegex($value, $pattern, $message = '')
{
- static::__callStatic('nullOrRegex', array($value, $pattern, $message));
+ null === $value || static::regex($value, $pattern, $message);
}
/**
@@ -1759,7 +3033,31 @@ trait Mixin
*/
public static function allRegex($value, $pattern, $message = '')
{
- static::__callStatic('allRegex', array($value, $pattern, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::regex($entry, $pattern, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param string $pattern
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrRegex($value, $pattern, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::regex($entry, $pattern, $message);
+ }
}
/**
@@ -1775,7 +3073,7 @@ trait Mixin
*/
public static function nullOrNotRegex($value, $pattern, $message = '')
{
- static::__callStatic('nullOrNotRegex', array($value, $pattern, $message));
+ null === $value || static::notRegex($value, $pattern, $message);
}
/**
@@ -1791,7 +3089,31 @@ trait Mixin
*/
public static function allNotRegex($value, $pattern, $message = '')
{
- static::__callStatic('allNotRegex', array($value, $pattern, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::notRegex($entry, $pattern, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param string $pattern
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrNotRegex($value, $pattern, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::notRegex($entry, $pattern, $message);
+ }
}
/**
@@ -1806,7 +3128,7 @@ trait Mixin
*/
public static function nullOrUnicodeLetters($value, $message = '')
{
- static::__callStatic('nullOrUnicodeLetters', array($value, $message));
+ null === $value || static::unicodeLetters($value, $message);
}
/**
@@ -1821,7 +3143,30 @@ trait Mixin
*/
public static function allUnicodeLetters($value, $message = '')
{
- static::__callStatic('allUnicodeLetters', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::unicodeLetters($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrUnicodeLetters($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::unicodeLetters($entry, $message);
+ }
}
/**
@@ -1836,7 +3181,7 @@ trait Mixin
*/
public static function nullOrAlpha($value, $message = '')
{
- static::__callStatic('nullOrAlpha', array($value, $message));
+ null === $value || static::alpha($value, $message);
}
/**
@@ -1851,7 +3196,30 @@ trait Mixin
*/
public static function allAlpha($value, $message = '')
{
- static::__callStatic('allAlpha', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::alpha($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrAlpha($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::alpha($entry, $message);
+ }
}
/**
@@ -1866,7 +3234,7 @@ trait Mixin
*/
public static function nullOrDigits($value, $message = '')
{
- static::__callStatic('nullOrDigits', array($value, $message));
+ null === $value || static::digits($value, $message);
}
/**
@@ -1881,7 +3249,30 @@ trait Mixin
*/
public static function allDigits($value, $message = '')
{
- static::__callStatic('allDigits', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::digits($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrDigits($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::digits($entry, $message);
+ }
}
/**
@@ -1896,7 +3287,7 @@ trait Mixin
*/
public static function nullOrAlnum($value, $message = '')
{
- static::__callStatic('nullOrAlnum', array($value, $message));
+ null === $value || static::alnum($value, $message);
}
/**
@@ -1911,7 +3302,30 @@ trait Mixin
*/
public static function allAlnum($value, $message = '')
{
- static::__callStatic('allAlnum', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::alnum($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrAlnum($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::alnum($entry, $message);
+ }
}
/**
@@ -1927,7 +3341,7 @@ trait Mixin
*/
public static function nullOrLower($value, $message = '')
{
- static::__callStatic('nullOrLower', array($value, $message));
+ null === $value || static::lower($value, $message);
}
/**
@@ -1943,7 +3357,31 @@ trait Mixin
*/
public static function allLower($value, $message = '')
{
- static::__callStatic('allLower', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::lower($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<lowercase-string|null> $value
+ *
+ * @param iterable<string|null> $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrLower($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::lower($entry, $message);
+ }
}
/**
@@ -1958,7 +3396,7 @@ trait Mixin
*/
public static function nullOrUpper($value, $message = '')
{
- static::__callStatic('nullOrUpper', array($value, $message));
+ null === $value || static::upper($value, $message);
}
/**
@@ -1973,7 +3411,31 @@ trait Mixin
*/
public static function allUpper($value, $message = '')
{
- static::__callStatic('allUpper', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::upper($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<!lowercase-string|null> $value
+ *
+ * @param iterable<string|null> $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrUpper($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::upper($entry, $message);
+ }
}
/**
@@ -1989,7 +3451,7 @@ trait Mixin
*/
public static function nullOrLength($value, $length, $message = '')
{
- static::__callStatic('nullOrLength', array($value, $length, $message));
+ null === $value || static::length($value, $length, $message);
}
/**
@@ -2005,7 +3467,31 @@ trait Mixin
*/
public static function allLength($value, $length, $message = '')
{
- static::__callStatic('allLength', array($value, $length, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::length($entry, $length, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param int $length
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrLength($value, $length, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::length($entry, $length, $message);
+ }
}
/**
@@ -2021,7 +3507,7 @@ trait Mixin
*/
public static function nullOrMinLength($value, $min, $message = '')
{
- static::__callStatic('nullOrMinLength', array($value, $min, $message));
+ null === $value || static::minLength($value, $min, $message);
}
/**
@@ -2037,7 +3523,31 @@ trait Mixin
*/
public static function allMinLength($value, $min, $message = '')
{
- static::__callStatic('allMinLength', array($value, $min, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::minLength($entry, $min, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param int|float $min
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrMinLength($value, $min, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::minLength($entry, $min, $message);
+ }
}
/**
@@ -2053,7 +3563,7 @@ trait Mixin
*/
public static function nullOrMaxLength($value, $max, $message = '')
{
- static::__callStatic('nullOrMaxLength', array($value, $max, $message));
+ null === $value || static::maxLength($value, $max, $message);
}
/**
@@ -2069,7 +3579,31 @@ trait Mixin
*/
public static function allMaxLength($value, $max, $message = '')
{
- static::__callStatic('allMaxLength', array($value, $max, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::maxLength($entry, $max, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param int|float $max
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrMaxLength($value, $max, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::maxLength($entry, $max, $message);
+ }
}
/**
@@ -2086,7 +3620,7 @@ trait Mixin
*/
public static function nullOrLengthBetween($value, $min, $max, $message = '')
{
- static::__callStatic('nullOrLengthBetween', array($value, $min, $max, $message));
+ null === $value || static::lengthBetween($value, $min, $max, $message);
}
/**
@@ -2103,7 +3637,32 @@ trait Mixin
*/
public static function allLengthBetween($value, $min, $max, $message = '')
{
- static::__callStatic('allLengthBetween', array($value, $min, $max, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::lengthBetween($entry, $min, $max, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param int|float $min
+ * @param int|float $max
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrLengthBetween($value, $min, $max, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::lengthBetween($entry, $min, $max, $message);
+ }
}
/**
@@ -2116,7 +3675,7 @@ trait Mixin
*/
public static function nullOrFileExists($value, $message = '')
{
- static::__callStatic('nullOrFileExists', array($value, $message));
+ null === $value || static::fileExists($value, $message);
}
/**
@@ -2129,7 +3688,28 @@ trait Mixin
*/
public static function allFileExists($value, $message = '')
{
- static::__callStatic('allFileExists', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::fileExists($entry, $message);
+ }
+ }
+
+ /**
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrFileExists($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::fileExists($entry, $message);
+ }
}
/**
@@ -2142,7 +3722,7 @@ trait Mixin
*/
public static function nullOrFile($value, $message = '')
{
- static::__callStatic('nullOrFile', array($value, $message));
+ null === $value || static::file($value, $message);
}
/**
@@ -2155,7 +3735,28 @@ trait Mixin
*/
public static function allFile($value, $message = '')
{
- static::__callStatic('allFile', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::file($entry, $message);
+ }
+ }
+
+ /**
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrFile($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::file($entry, $message);
+ }
}
/**
@@ -2168,7 +3769,7 @@ trait Mixin
*/
public static function nullOrDirectory($value, $message = '')
{
- static::__callStatic('nullOrDirectory', array($value, $message));
+ null === $value || static::directory($value, $message);
}
/**
@@ -2181,7 +3782,28 @@ trait Mixin
*/
public static function allDirectory($value, $message = '')
{
- static::__callStatic('allDirectory', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::directory($entry, $message);
+ }
+ }
+
+ /**
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrDirectory($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::directory($entry, $message);
+ }
}
/**
@@ -2194,7 +3816,7 @@ trait Mixin
*/
public static function nullOrReadable($value, $message = '')
{
- static::__callStatic('nullOrReadable', array($value, $message));
+ null === $value || static::readable($value, $message);
}
/**
@@ -2207,7 +3829,28 @@ trait Mixin
*/
public static function allReadable($value, $message = '')
{
- static::__callStatic('allReadable', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::readable($entry, $message);
+ }
+ }
+
+ /**
+ * @param iterable<string|null> $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrReadable($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::readable($entry, $message);
+ }
}
/**
@@ -2220,7 +3863,7 @@ trait Mixin
*/
public static function nullOrWritable($value, $message = '')
{
- static::__callStatic('nullOrWritable', array($value, $message));
+ null === $value || static::writable($value, $message);
}
/**
@@ -2233,7 +3876,28 @@ trait Mixin
*/
public static function allWritable($value, $message = '')
{
- static::__callStatic('allWritable', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::writable($entry, $message);
+ }
+ }
+
+ /**
+ * @param iterable<string|null> $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrWritable($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::writable($entry, $message);
+ }
}
/**
@@ -2248,7 +3912,7 @@ trait Mixin
*/
public static function nullOrClassExists($value, $message = '')
{
- static::__callStatic('nullOrClassExists', array($value, $message));
+ null === $value || static::classExists($value, $message);
}
/**
@@ -2263,7 +3927,30 @@ trait Mixin
*/
public static function allClassExists($value, $message = '')
{
- static::__callStatic('allClassExists', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::classExists($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-assert iterable<class-string|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrClassExists($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::classExists($entry, $message);
+ }
}
/**
@@ -2282,7 +3969,7 @@ trait Mixin
*/
public static function nullOrSubclassOf($value, $class, $message = '')
{
- static::__callStatic('nullOrSubclassOf', array($value, $class, $message));
+ null === $value || static::subclassOf($value, $class, $message);
}
/**
@@ -2301,7 +3988,34 @@ trait Mixin
*/
public static function allSubclassOf($value, $class, $message = '')
{
- static::__callStatic('allSubclassOf', array($value, $class, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::subclassOf($entry, $class, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-template ExpectedType of object
+ * @psalm-param class-string<ExpectedType> $class
+ * @psalm-assert iterable<class-string<ExpectedType>|ExpectedType|null> $value
+ *
+ * @param mixed $value
+ * @param string|object $class
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrSubclassOf($value, $class, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::subclassOf($entry, $class, $message);
+ }
}
/**
@@ -2316,7 +4030,7 @@ trait Mixin
*/
public static function nullOrInterfaceExists($value, $message = '')
{
- static::__callStatic('nullOrInterfaceExists', array($value, $message));
+ null === $value || static::interfaceExists($value, $message);
}
/**
@@ -2331,7 +4045,30 @@ trait Mixin
*/
public static function allInterfaceExists($value, $message = '')
{
- static::__callStatic('allInterfaceExists', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::interfaceExists($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-assert iterable<class-string|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrInterfaceExists($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::interfaceExists($entry, $message);
+ }
}
/**
@@ -2350,7 +4087,7 @@ trait Mixin
*/
public static function nullOrImplementsInterface($value, $interface, $message = '')
{
- static::__callStatic('nullOrImplementsInterface', array($value, $interface, $message));
+ null === $value || static::implementsInterface($value, $interface, $message);
}
/**
@@ -2369,7 +4106,34 @@ trait Mixin
*/
public static function allImplementsInterface($value, $interface, $message = '')
{
- static::__callStatic('allImplementsInterface', array($value, $interface, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::implementsInterface($entry, $interface, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-template ExpectedType of object
+ * @psalm-param class-string<ExpectedType> $interface
+ * @psalm-assert iterable<class-string<ExpectedType>|null> $value
+ *
+ * @param mixed $value
+ * @param mixed $interface
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrImplementsInterface($value, $interface, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::implementsInterface($entry, $interface, $message);
+ }
}
/**
@@ -2386,7 +4150,7 @@ trait Mixin
*/
public static function nullOrPropertyExists($classOrObject, $property, $message = '')
{
- static::__callStatic('nullOrPropertyExists', array($classOrObject, $property, $message));
+ null === $classOrObject || static::propertyExists($classOrObject, $property, $message);
}
/**
@@ -2403,7 +4167,32 @@ trait Mixin
*/
public static function allPropertyExists($classOrObject, $property, $message = '')
{
- static::__callStatic('allPropertyExists', array($classOrObject, $property, $message));
+ static::isIterable($classOrObject);
+
+ foreach ($classOrObject as $entry) {
+ static::propertyExists($entry, $property, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-param iterable<class-string|object|null> $classOrObject
+ *
+ * @param iterable<string|object|null> $classOrObject
+ * @param mixed $property
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrPropertyExists($classOrObject, $property, $message = '')
+ {
+ static::isIterable($classOrObject);
+
+ foreach ($classOrObject as $entry) {
+ null === $entry || static::propertyExists($entry, $property, $message);
+ }
}
/**
@@ -2420,7 +4209,7 @@ trait Mixin
*/
public static function nullOrPropertyNotExists($classOrObject, $property, $message = '')
{
- static::__callStatic('nullOrPropertyNotExists', array($classOrObject, $property, $message));
+ null === $classOrObject || static::propertyNotExists($classOrObject, $property, $message);
}
/**
@@ -2437,7 +4226,32 @@ trait Mixin
*/
public static function allPropertyNotExists($classOrObject, $property, $message = '')
{
- static::__callStatic('allPropertyNotExists', array($classOrObject, $property, $message));
+ static::isIterable($classOrObject);
+
+ foreach ($classOrObject as $entry) {
+ static::propertyNotExists($entry, $property, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-param iterable<class-string|object|null> $classOrObject
+ *
+ * @param iterable<string|object|null> $classOrObject
+ * @param mixed $property
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrPropertyNotExists($classOrObject, $property, $message = '')
+ {
+ static::isIterable($classOrObject);
+
+ foreach ($classOrObject as $entry) {
+ null === $entry || static::propertyNotExists($entry, $property, $message);
+ }
}
/**
@@ -2454,7 +4268,7 @@ trait Mixin
*/
public static function nullOrMethodExists($classOrObject, $method, $message = '')
{
- static::__callStatic('nullOrMethodExists', array($classOrObject, $method, $message));
+ null === $classOrObject || static::methodExists($classOrObject, $method, $message);
}
/**
@@ -2471,7 +4285,32 @@ trait Mixin
*/
public static function allMethodExists($classOrObject, $method, $message = '')
{
- static::__callStatic('allMethodExists', array($classOrObject, $method, $message));
+ static::isIterable($classOrObject);
+
+ foreach ($classOrObject as $entry) {
+ static::methodExists($entry, $method, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-param iterable<class-string|object|null> $classOrObject
+ *
+ * @param iterable<string|object|null> $classOrObject
+ * @param mixed $method
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrMethodExists($classOrObject, $method, $message = '')
+ {
+ static::isIterable($classOrObject);
+
+ foreach ($classOrObject as $entry) {
+ null === $entry || static::methodExists($entry, $method, $message);
+ }
}
/**
@@ -2488,7 +4327,7 @@ trait Mixin
*/
public static function nullOrMethodNotExists($classOrObject, $method, $message = '')
{
- static::__callStatic('nullOrMethodNotExists', array($classOrObject, $method, $message));
+ null === $classOrObject || static::methodNotExists($classOrObject, $method, $message);
}
/**
@@ -2505,7 +4344,32 @@ trait Mixin
*/
public static function allMethodNotExists($classOrObject, $method, $message = '')
{
- static::__callStatic('allMethodNotExists', array($classOrObject, $method, $message));
+ static::isIterable($classOrObject);
+
+ foreach ($classOrObject as $entry) {
+ static::methodNotExists($entry, $method, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-param iterable<class-string|object|null> $classOrObject
+ *
+ * @param iterable<string|object|null> $classOrObject
+ * @param mixed $method
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrMethodNotExists($classOrObject, $method, $message = '')
+ {
+ static::isIterable($classOrObject);
+
+ foreach ($classOrObject as $entry) {
+ null === $entry || static::methodNotExists($entry, $method, $message);
+ }
}
/**
@@ -2521,7 +4385,7 @@ trait Mixin
*/
public static function nullOrKeyExists($array, $key, $message = '')
{
- static::__callStatic('nullOrKeyExists', array($array, $key, $message));
+ null === $array || static::keyExists($array, $key, $message);
}
/**
@@ -2537,7 +4401,31 @@ trait Mixin
*/
public static function allKeyExists($array, $key, $message = '')
{
- static::__callStatic('allKeyExists', array($array, $key, $message));
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ static::keyExists($entry, $key, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<array|null> $array
+ * @param string|int $key
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrKeyExists($array, $key, $message = '')
+ {
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ null === $entry || static::keyExists($entry, $key, $message);
+ }
}
/**
@@ -2553,7 +4441,7 @@ trait Mixin
*/
public static function nullOrKeyNotExists($array, $key, $message = '')
{
- static::__callStatic('nullOrKeyNotExists', array($array, $key, $message));
+ null === $array || static::keyNotExists($array, $key, $message);
}
/**
@@ -2569,7 +4457,31 @@ trait Mixin
*/
public static function allKeyNotExists($array, $key, $message = '')
{
- static::__callStatic('allKeyNotExists', array($array, $key, $message));
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ static::keyNotExists($entry, $key, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<array|null> $array
+ * @param string|int $key
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrKeyNotExists($array, $key, $message = '')
+ {
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ null === $entry || static::keyNotExists($entry, $key, $message);
+ }
}
/**
@@ -2585,7 +4497,7 @@ trait Mixin
*/
public static function nullOrValidArrayKey($value, $message = '')
{
- static::__callStatic('nullOrValidArrayKey', array($value, $message));
+ null === $value || static::validArrayKey($value, $message);
}
/**
@@ -2601,7 +4513,31 @@ trait Mixin
*/
public static function allValidArrayKey($value, $message = '')
{
- static::__callStatic('allValidArrayKey', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::validArrayKey($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<array-key|null> $value
+ *
+ * @param mixed $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrValidArrayKey($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::validArrayKey($entry, $message);
+ }
}
/**
@@ -2615,7 +4551,7 @@ trait Mixin
*/
public static function nullOrCount($array, $number, $message = '')
{
- static::__callStatic('nullOrCount', array($array, $number, $message));
+ null === $array || static::count($array, $number, $message);
}
/**
@@ -2629,7 +4565,29 @@ trait Mixin
*/
public static function allCount($array, $number, $message = '')
{
- static::__callStatic('allCount', array($array, $number, $message));
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ static::count($entry, $number, $message);
+ }
+ }
+
+ /**
+ * @param iterable<Countable|array|null> $array
+ * @param int $number
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrCount($array, $number, $message = '')
+ {
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ null === $entry || static::count($entry, $number, $message);
+ }
}
/**
@@ -2643,7 +4601,7 @@ trait Mixin
*/
public static function nullOrMinCount($array, $min, $message = '')
{
- static::__callStatic('nullOrMinCount', array($array, $min, $message));
+ null === $array || static::minCount($array, $min, $message);
}
/**
@@ -2657,7 +4615,29 @@ trait Mixin
*/
public static function allMinCount($array, $min, $message = '')
{
- static::__callStatic('allMinCount', array($array, $min, $message));
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ static::minCount($entry, $min, $message);
+ }
+ }
+
+ /**
+ * @param iterable<Countable|array|null> $array
+ * @param int|float $min
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrMinCount($array, $min, $message = '')
+ {
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ null === $entry || static::minCount($entry, $min, $message);
+ }
}
/**
@@ -2671,7 +4651,7 @@ trait Mixin
*/
public static function nullOrMaxCount($array, $max, $message = '')
{
- static::__callStatic('nullOrMaxCount', array($array, $max, $message));
+ null === $array || static::maxCount($array, $max, $message);
}
/**
@@ -2685,7 +4665,29 @@ trait Mixin
*/
public static function allMaxCount($array, $max, $message = '')
{
- static::__callStatic('allMaxCount', array($array, $max, $message));
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ static::maxCount($entry, $max, $message);
+ }
+ }
+
+ /**
+ * @param iterable<Countable|array|null> $array
+ * @param int|float $max
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrMaxCount($array, $max, $message = '')
+ {
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ null === $entry || static::maxCount($entry, $max, $message);
+ }
}
/**
@@ -2700,7 +4702,7 @@ trait Mixin
*/
public static function nullOrCountBetween($array, $min, $max, $message = '')
{
- static::__callStatic('nullOrCountBetween', array($array, $min, $max, $message));
+ null === $array || static::countBetween($array, $min, $max, $message);
}
/**
@@ -2715,7 +4717,30 @@ trait Mixin
*/
public static function allCountBetween($array, $min, $max, $message = '')
{
- static::__callStatic('allCountBetween', array($array, $min, $max, $message));
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ static::countBetween($entry, $min, $max, $message);
+ }
+ }
+
+ /**
+ * @param iterable<Countable|array|null> $array
+ * @param int|float $min
+ * @param int|float $max
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrCountBetween($array, $min, $max, $message = '')
+ {
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ null === $entry || static::countBetween($entry, $min, $max, $message);
+ }
}
/**
@@ -2731,7 +4756,7 @@ trait Mixin
*/
public static function nullOrIsList($array, $message = '')
{
- static::__callStatic('nullOrIsList', array($array, $message));
+ null === $array || static::isList($array, $message);
}
/**
@@ -2747,7 +4772,31 @@ trait Mixin
*/
public static function allIsList($array, $message = '')
{
- static::__callStatic('allIsList', array($array, $message));
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ static::isList($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<list|null> $array
+ *
+ * @param mixed $array
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsList($array, $message = '')
+ {
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ null === $entry || static::isList($entry, $message);
+ }
}
/**
@@ -2763,7 +4812,7 @@ trait Mixin
*/
public static function nullOrIsNonEmptyList($array, $message = '')
{
- static::__callStatic('nullOrIsNonEmptyList', array($array, $message));
+ null === $array || static::isNonEmptyList($array, $message);
}
/**
@@ -2779,7 +4828,31 @@ trait Mixin
*/
public static function allIsNonEmptyList($array, $message = '')
{
- static::__callStatic('allIsNonEmptyList', array($array, $message));
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ static::isNonEmptyList($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-assert iterable<non-empty-list|null> $array
+ *
+ * @param mixed $array
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsNonEmptyList($array, $message = '')
+ {
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ null === $entry || static::isNonEmptyList($entry, $message);
+ }
}
/**
@@ -2797,7 +4870,7 @@ trait Mixin
*/
public static function nullOrIsMap($array, $message = '')
{
- static::__callStatic('nullOrIsMap', array($array, $message));
+ null === $array || static::isMap($array, $message);
}
/**
@@ -2815,7 +4888,33 @@ trait Mixin
*/
public static function allIsMap($array, $message = '')
{
- static::__callStatic('allIsMap', array($array, $message));
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ static::isMap($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-template T
+ * @psalm-param iterable<mixed|array<T>|null> $array
+ * @psalm-assert iterable<array<string, T>|null> $array
+ *
+ * @param mixed $array
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsMap($array, $message = '')
+ {
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ null === $entry || static::isMap($entry, $message);
+ }
}
/**
@@ -2832,7 +4931,7 @@ trait Mixin
*/
public static function nullOrIsNonEmptyMap($array, $message = '')
{
- static::__callStatic('nullOrIsNonEmptyMap', array($array, $message));
+ null === $array || static::isNonEmptyMap($array, $message);
}
/**
@@ -2849,7 +4948,34 @@ trait Mixin
*/
public static function allIsNonEmptyMap($array, $message = '')
{
- static::__callStatic('allIsNonEmptyMap', array($array, $message));
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ static::isNonEmptyMap($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ * @psalm-template T
+ * @psalm-param iterable<mixed|array<T>|null> $array
+ * @psalm-assert iterable<array<string, T>|null> $array
+ * @psalm-assert iterable<!empty|null> $array
+ *
+ * @param mixed $array
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrIsNonEmptyMap($array, $message = '')
+ {
+ static::isIterable($array);
+
+ foreach ($array as $entry) {
+ null === $entry || static::isNonEmptyMap($entry, $message);
+ }
}
/**
@@ -2864,7 +4990,7 @@ trait Mixin
*/
public static function nullOrUuid($value, $message = '')
{
- static::__callStatic('nullOrUuid', array($value, $message));
+ null === $value || static::uuid($value, $message);
}
/**
@@ -2879,7 +5005,30 @@ trait Mixin
*/
public static function allUuid($value, $message = '')
{
- static::__callStatic('allUuid', array($value, $message));
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ static::uuid($entry, $message);
+ }
+ }
+
+ /**
+ * @psalm-pure
+ *
+ * @param iterable<string|null> $value
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrUuid($value, $message = '')
+ {
+ static::isIterable($value);
+
+ foreach ($value as $entry) {
+ null === $entry || static::uuid($entry, $message);
+ }
}
/**
@@ -2895,7 +5044,7 @@ trait Mixin
*/
public static function nullOrThrows($expression, $class = 'Exception', $message = '')
{
- static::__callStatic('nullOrThrows', array($expression, $class, $message));
+ null === $expression || static::throws($expression, $class, $message);
}
/**
@@ -2911,6 +5060,30 @@ trait Mixin
*/
public static function allThrows($expression, $class = 'Exception', $message = '')
{
- static::__callStatic('allThrows', array($expression, $class, $message));
+ static::isIterable($expression);
+
+ foreach ($expression as $entry) {
+ static::throws($entry, $class, $message);
+ }
+ }
+
+ /**
+ * @psalm-param class-string<Throwable> $class
+ *
+ * @param iterable<Closure|null> $expression
+ * @param string $class
+ * @param string $message
+ *
+ * @throws InvalidArgumentException
+ *
+ * @return void
+ */
+ public static function allNullOrThrows($expression, $class = 'Exception', $message = '')
+ {
+ static::isIterable($expression);
+
+ foreach ($expression as $entry) {
+ null === $entry || static::throws($entry, $class, $message);
+ }
}
}