diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index b7c3a752..ad86ccee 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -1,140 +1,113 @@
# https://docs.github.com/en/actions
-name: "CI"
+name: CI
on:
- pull_request: ~
- push:
- branches:
- - "master"
-
-env:
- COMPOSER_ROOT_VERSION: 1.99
+ pull_request: ~
+ push:
+ branches:
+ - master
jobs:
- coding-standards:
- name: "Coding Standards"
-
- runs-on: "ubuntu-latest"
-
- steps:
- - name: "Checkout"
- uses: "actions/checkout@v3"
-
- - name: "Install PHP"
- uses: "shivammathur/setup-php@2.9.0"
- 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/checkout@v3"
-
- - name: "Install PHP"
- uses: "shivammathur/setup-php@2.9.0"
- 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"
-
- roave-bc-check:
- name: "Roave BC Check"
-
- runs-on: "ubuntu-latest"
-
- steps:
- - name: "Checkout code"
- uses: "actions/checkout@v3"
-
- - name: "Install PHP"
- uses: "shivammathur/setup-php@2.9.0"
-
- - name: "Install Roave BC check"
- run: "composer require --dev roave/backward-compatibility-check"
-
- - name: "Run Roave BC check"
- run: "vendor/bin/roave-backward-compatibility-check"
-
- tests:
- name: "Tests"
-
- runs-on: "ubuntu-latest"
-
- strategy:
- matrix:
- php-version:
- - "7.2"
- - "7.3"
- - "7.4"
- - "8.0"
- - "8.1"
- - "8.2"
-
- steps:
- - name: "Checkout"
- uses: "actions/checkout@v3"
-
- - name: "Install PHP"
- uses: "shivammathur/setup-php@2.9.0"
- 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/checkout@v3"
-
- - name: "Install PHP"
- uses: "shivammathur/setup-php@2.9.0"
- 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"
+ static-code-analysis:
+ name: Static Code Analysis
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Install PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: '8.3'
+ coverage: none
+ extensions: mbstring
+
+ - name: Install dependencies
+ run: >-
+ composer install
+
+ - name: Install tools
+ run: >-
+ composer run install-tools
+
+ - name: Run code style check
+ run: >-
+ composer run cs-check
+
+ - name: Run backwards compatibility check
+ run: >-
+ composer run bc-check
+
+ - name: Run static analysis
+ run: >-
+ composer run static-analysis
+
+ tests:
+ name: Tests
+
+ runs-on: ubuntu-latest
+
+ strategy:
+ matrix:
+ php-version:
+ - "7.2"
+ - "7.3"
+ - "7.4"
+ - "8.0"
+ - "8.1"
+ - "8.2"
+ - "8.3"
+ - "8.4"
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Install PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: "${{ matrix.php-version }}"
+ coverage: none
+ extensions: mbstring
+ tools: phpunit:8
+
+ - name: Install dependencies
+ run: composer install
+
+ - name: Run unit tests
+ run: phpunit
+
+ windows-tests:
+ name: Windows tests
+
+ runs-on: windows-latest
+
+ strategy:
+ matrix:
+ php-version:
+ - "7.4"
+ - "8.3"
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Install PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: "${{ matrix.php-version }}"
+ coverage: none
+ extensions: mbstring
+ tools: phpunit:8
+
+ - name: Install dependencies
+ run: composer install
+
+ - name: Run unit tests
+ run: phpunit
diff --git a/.gitignore b/.gitignore
index c2a741aa..6d569d68 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
vendor/
/composer.lock
+.php-cs-fixer.cache
.phpunit.result.cache
-.php_cs.cache
diff --git a/.php_cs b/.php-cs-fixer.php
similarity index 75%
rename from .php_cs
rename to .php-cs-fixer.php
index f7afd3ed..f60f7769 100644
--- a/.php_cs
+++ b/.php-cs-fixer.php
@@ -5,16 +5,19 @@
->in(__DIR__.'/tests')
;
-return PhpCsFixer\Config::create()
+return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'ordered_imports' => true,
'array_syntax' => ['syntax' => 'long'],
+ 'fully_qualified_strict_types' => false,
+ 'global_namespace_import' => true,
'no_superfluous_phpdoc_tags' => false,
'phpdoc_annotation_without_dot' => false,
'phpdoc_types_order' => false,
+ 'phpdoc_separation' => ['skip_unlisted_annotations' => true],
'phpdoc_summary' => false,
'phpdoc_to_comment' => false,
'phpdoc_align' => false,
diff --git a/bin/src/MixinGenerator.php b/bin/src/MixinGenerator.php
index 35de8e94..5fdd475b 100644
--- a/bin/src/MixinGenerator.php
+++ b/bin/src/MixinGenerator.php
@@ -13,6 +13,7 @@
use RuntimeException;
use Throwable;
use Webmozart\Assert\Assert;
+use function rtrim;
final class MixinGenerator
{
@@ -277,7 +278,7 @@ private function assertion(ReflectionMethod $method, string $methodNameTemplate,
$phpdocLines[] = trim($comment);
}
- if ('deprecated' === $key) {
+ if ('deprecated' === $key || 'psalm-pure' === $key) {
$phpdocLines[] = '';
}
}
@@ -428,14 +429,24 @@ private function phpdoc(array $lines, int $indent): string
$indentation = str_repeat(' ', $indent);
$phpdoc = $indentation.'/**';
+ $throws = '';
foreach ($lines as $line) {
- $phpdoc .= "\n".$indentation.rtrim(' * '.$line);
+ if (strpos($line, '@throws') === 0) {
+ $throws .= "\n".$indentation.rtrim(' * '.$line);
+ } else {
+ $phpdoc .= "\n".$indentation.rtrim(' * '.$line);
+ }
+ }
+
+ $phpdoc .= "\n".$indentation.' * @return void';
+
+ if (strlen($throws) > 0) {
+ $phpdoc .= "\n".$indentation.' *';
+ $phpdoc .= $throws;
}
- $phpdoc .= "\n".$indentation.' *'
- . "\n".$indentation.' * @return void'
- . "\n".$indentation.' */';
+ $phpdoc .= "\n".$indentation.' */';
return $phpdoc;
}
diff --git a/ci/composer.json b/ci/composer.json
deleted file mode 100644
index 62224482..00000000
--- a/ci/composer.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "require": {
- "vimeo/psalm": "4.6.1"
- }
-}
diff --git a/composer.json b/composer.json
index 579896e6..c86de744 100644
--- a/composer.json
+++ b/composer.json
@@ -17,13 +17,8 @@
"php": "^7.2 || ^8.0",
"ext-ctype": "*"
},
- "require-dev": {
- "ergebnis/composer-normalize": "^2.44",
- "phpunit/phpunit": "^8.5.13"
- },
- "conflict": {
- "phpstan/phpstan": "<0.12.20",
- "vimeo/psalm": "<4.6.1 || 4.6.2"
+ "suggest": {
+ "ext-simplexml": ""
},
"autoload": {
"psr-4": {
@@ -36,14 +31,22 @@
"Webmozart\\Assert\\Tests\\": "tests/"
}
},
- "config": {
- "allow-plugins": {
- "ergebnis/composer-normalize": true
- }
- },
"extra": {
"branch-alias": {
"dev-master": "1.10-dev"
}
+ },
+ "scripts": {
+ "install-tools": [
+ "composer --working-dir=tools/php-cs-fixer install",
+ "composer --working-dir=tools/phpunit install",
+ "composer --working-dir=tools/psalm install",
+ "composer --working-dir=tools/roave-bc-check install"
+ ],
+ "bc-check": "./tools/roave-bc-check/vendor/bin/roave-backward-compatibility-check",
+ "cs-check" : "./tools/php-cs-fixer/vendor/bin/php-cs-fixer check",
+ "cs-fix": "./tools/php-cs-fixer/vendor/bin/php-cs-fixer fix",
+ "static-analysis": "./tools/psalm/vendor/bin/psalm --threads=4 --root=$(pwd)",
+ "test": "./tools/phpunit/vendor/bin/phpunit"
}
}
diff --git a/psalm.xml b/psalm.xml
index 37a9ccea..c5c24f84 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -1,17 +1,13 @@
-
+
-
-
-
-
diff --git a/src/Assert.php b/src/Assert.php
index db1f3a51..70a29c40 100644
--- a/src/Assert.php
+++ b/src/Assert.php
@@ -36,6 +36,7 @@ class Assert
/**
* @psalm-pure
+ *
* @psalm-assert string $value
*
* @param mixed $value
@@ -55,6 +56,7 @@ public static function string($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert non-empty-string $value
*
* @param mixed $value
@@ -70,6 +72,7 @@ public static function stringNotEmpty($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert int $value
*
* @param mixed $value
@@ -89,6 +92,7 @@ public static function integer($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert numeric $value
*
* @param mixed $value
@@ -108,6 +112,7 @@ public static function integerish($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert positive-int $value
*
* @param mixed $value
@@ -127,6 +132,7 @@ public static function positiveInteger($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert float $value
*
* @param mixed $value
@@ -146,6 +152,7 @@ public static function float($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert numeric $value
*
* @param mixed $value
@@ -165,6 +172,7 @@ public static function numeric($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert positive-int|0 $value
*
* @param mixed $value
@@ -184,6 +192,7 @@ public static function natural($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert bool $value
*
* @param mixed $value
@@ -203,6 +212,7 @@ public static function boolean($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert scalar $value
*
* @param mixed $value
@@ -222,6 +232,7 @@ public static function scalar($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert object $value
*
* @param mixed $value
@@ -241,6 +252,7 @@ public static function object($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert resource $value
*
* @param mixed $value
@@ -269,6 +281,7 @@ public static function resource($value, $type = null, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert callable $value
*
* @param mixed $value
@@ -288,6 +301,7 @@ public static function isCallable($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert array $value
*
* @param mixed $value
@@ -307,6 +321,7 @@ public static function isArray($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @deprecated use "isIterable" or "isInstanceOf" instead
@@ -336,6 +351,7 @@ public static function isTraversable($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert array|ArrayAccess $value
*
* @param mixed $value
@@ -355,6 +371,7 @@ public static function isArrayAccessible($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert countable $value
*
* @param mixed $value
@@ -379,6 +396,7 @@ public static function isCountable($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
@@ -398,8 +416,11 @@ public static function isIterable($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-template ExpectedType of object
+ *
* @psalm-param class-string $class
+ *
* @psalm-assert ExpectedType $value
*
* @param mixed $value
@@ -421,8 +442,11 @@ public static function isInstanceOf($value, $class, $message = '')
/**
* @psalm-pure
+ *
* @psalm-template ExpectedType of object
+ *
* @psalm-param class-string $class
+ *
* @psalm-assert !ExpectedType $value
*
* @param mixed $value
@@ -444,6 +468,7 @@ public static function notInstanceOf($value, $class, $message = '')
/**
* @psalm-pure
+ *
* @psalm-param array $classes
*
* @param mixed $value
@@ -469,8 +494,11 @@ public static function isInstanceOfAny($value, array $classes, $message = '')
/**
* @psalm-pure
+ *
* @psalm-template ExpectedType of object
+ *
* @psalm-param class-string $class
+ *
* @psalm-assert ExpectedType|class-string $value
*
* @param object|string $value
@@ -494,8 +522,11 @@ public static function isAOf($value, $class, $message = '')
/**
* @psalm-pure
+ *
* @psalm-template UnexpectedType of object
+ *
* @psalm-param class-string $class
+ *
* @psalm-assert !UnexpectedType $value
* @psalm-assert !class-string $value
*
@@ -520,6 +551,7 @@ public static function isNotA($value, $class, $message = '')
/**
* @psalm-pure
+ *
* @psalm-param array $classes
*
* @param object|string $value
@@ -547,6 +579,7 @@ public static function isAnyOf($value, array $classes, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert empty $value
*
* @param mixed $value
@@ -566,6 +599,7 @@ public static function isEmpty($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert !empty $value
*
* @param mixed $value
@@ -585,6 +619,7 @@ public static function notEmpty($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert null $value
*
* @param mixed $value
@@ -604,6 +639,7 @@ public static function null($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert !null $value
*
* @param mixed $value
@@ -622,6 +658,7 @@ public static function notNull($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert true $value
*
* @param mixed $value
@@ -641,6 +678,7 @@ public static function true($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert false $value
*
* @param mixed $value
@@ -660,6 +698,7 @@ public static function false($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert !false $value
*
* @param mixed $value
@@ -759,7 +798,7 @@ public static function uniqueValues(array $values, $message = '')
static::reportInvalidArgument(\sprintf(
$message ?: 'Expected an array of unique values, but %s of them %s duplicated',
$difference,
- (1 === $difference ? 'is' : 'are')
+ 1 === $difference ? 'is' : 'are'
));
}
}
@@ -1280,6 +1319,7 @@ public static function alnum($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert lowercase-string $value
*
* @param string $value
@@ -1304,6 +1344,7 @@ public static function lower($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert !lowercase-string $value
*
* @param string $value
@@ -1524,8 +1565,11 @@ public static function classExists($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-template ExpectedType of object
+ *
* @psalm-param class-string $class
+ *
* @psalm-assert class-string|ExpectedType $value
*
* @param mixed $value
@@ -1565,8 +1609,11 @@ public static function interfaceExists($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-template ExpectedType of object
+ *
* @psalm-param class-string $interface
+ *
* @psalm-assert class-string $value
*
* @param mixed $value
@@ -1588,6 +1635,7 @@ public static function implementsInterface($value, $interface, $message = '')
/**
* @psalm-pure
+ *
* @psalm-param class-string|object $classOrObject
*
* @param string|object $classOrObject
@@ -1608,6 +1656,7 @@ public static function propertyExists($classOrObject, $property, $message = '')
/**
* @psalm-pure
+ *
* @psalm-param class-string|object $classOrObject
*
* @param string|object $classOrObject
@@ -1628,6 +1677,7 @@ public static function propertyNotExists($classOrObject, $property, $message = '
/**
* @psalm-pure
+ *
* @psalm-param class-string|object $classOrObject
*
* @param string|object $classOrObject
@@ -1648,6 +1698,7 @@ public static function methodExists($classOrObject, $method, $message = '')
/**
* @psalm-pure
+ *
* @psalm-param class-string|object $classOrObject
*
* @param string|object $classOrObject
@@ -1708,6 +1759,7 @@ public static function keyNotExists($array, $key, $message = '')
* Checks if a value is a valid array key (int or string).
*
* @psalm-pure
+ *
* @psalm-assert array-key $value
*
* @param mixed $value
@@ -1813,6 +1865,7 @@ public static function countBetween($array, $min, $max, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert list $array
*
* @param mixed $array
@@ -1844,6 +1897,7 @@ public static function isList($array, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert non-empty-list $array
*
* @param mixed $array
@@ -1859,8 +1913,11 @@ public static function isNonEmptyList($array, $message = '')
/**
* @psalm-pure
+ *
* @psalm-template T
+ *
* @psalm-param mixed|array $array
+ *
* @psalm-assert array $array
*
* @param mixed $array
@@ -1871,8 +1928,8 @@ public static function isNonEmptyList($array, $message = '')
public static function isMap($array, $message = '')
{
if (
- !\is_array($array) ||
- \array_keys($array) !== \array_filter(\array_keys($array), '\is_string')
+ !\is_array($array)
+ || \array_keys($array) !== \array_filter(\array_keys($array), '\is_string')
) {
static::reportInvalidArgument(
$message ?: 'Expected map - associative array with string keys.'
@@ -1882,8 +1939,11 @@ public static function isMap($array, $message = '')
/**
* @psalm-pure
+ *
* @psalm-template T
+ *
* @psalm-param mixed|array $array
+ *
* @psalm-assert array $array
* @psalm-assert !empty $array
*
@@ -2067,6 +2127,7 @@ protected static function strlen($value)
* @throws InvalidArgumentException
*
* @psalm-pure this method is not supposed to perform side-effects
+ *
* @psalm-return never
*/
protected static function reportInvalidArgument($message)
diff --git a/src/Mixin.php b/src/Mixin.php
index 5670e2ad..ae958ceb 100644
--- a/src/Mixin.php
+++ b/src/Mixin.php
@@ -15,14 +15,15 @@ trait Mixin
{
/**
* @psalm-pure
+ *
* @psalm-assert string|null $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function nullOrString($value, $message = '')
{
@@ -31,14 +32,15 @@ public static function nullOrString($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allString($value, $message = '')
{
@@ -51,14 +53,15 @@ public static function allString($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allNullOrString($value, $message = '')
{
@@ -71,14 +74,15 @@ public static function allNullOrString($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert non-empty-string|null $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function nullOrStringNotEmpty($value, $message = '')
{
@@ -87,14 +91,15 @@ public static function nullOrStringNotEmpty($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allStringNotEmpty($value, $message = '')
{
@@ -107,14 +112,15 @@ public static function allStringNotEmpty($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allNullOrStringNotEmpty($value, $message = '')
{
@@ -127,14 +133,15 @@ public static function allNullOrStringNotEmpty($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert int|null $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function nullOrInteger($value, $message = '')
{
@@ -143,14 +150,15 @@ public static function nullOrInteger($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allInteger($value, $message = '')
{
@@ -163,14 +171,15 @@ public static function allInteger($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allNullOrInteger($value, $message = '')
{
@@ -183,14 +192,15 @@ public static function allNullOrInteger($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert numeric|null $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function nullOrIntegerish($value, $message = '')
{
@@ -199,14 +209,15 @@ public static function nullOrIntegerish($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allIntegerish($value, $message = '')
{
@@ -219,14 +230,15 @@ public static function allIntegerish($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allNullOrIntegerish($value, $message = '')
{
@@ -239,14 +251,15 @@ public static function allNullOrIntegerish($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert positive-int|null $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function nullOrPositiveInteger($value, $message = '')
{
@@ -255,14 +268,15 @@ public static function nullOrPositiveInteger($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allPositiveInteger($value, $message = '')
{
@@ -275,14 +289,15 @@ public static function allPositiveInteger($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allNullOrPositiveInteger($value, $message = '')
{
@@ -295,14 +310,15 @@ public static function allNullOrPositiveInteger($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert float|null $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function nullOrFloat($value, $message = '')
{
@@ -311,14 +327,15 @@ public static function nullOrFloat($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allFloat($value, $message = '')
{
@@ -331,14 +348,15 @@ public static function allFloat($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allNullOrFloat($value, $message = '')
{
@@ -351,14 +369,15 @@ public static function allNullOrFloat($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert numeric|null $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function nullOrNumeric($value, $message = '')
{
@@ -367,14 +386,15 @@ public static function nullOrNumeric($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allNumeric($value, $message = '')
{
@@ -387,14 +407,15 @@ public static function allNumeric($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allNullOrNumeric($value, $message = '')
{
@@ -407,14 +428,15 @@ public static function allNullOrNumeric($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert positive-int|0|null $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function nullOrNatural($value, $message = '')
{
@@ -423,14 +445,15 @@ public static function nullOrNatural($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allNatural($value, $message = '')
{
@@ -443,14 +466,15 @@ public static function allNatural($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allNullOrNatural($value, $message = '')
{
@@ -463,14 +487,15 @@ public static function allNullOrNatural($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert bool|null $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function nullOrBoolean($value, $message = '')
{
@@ -479,14 +504,15 @@ public static function nullOrBoolean($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allBoolean($value, $message = '')
{
@@ -499,14 +525,15 @@ public static function allBoolean($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allNullOrBoolean($value, $message = '')
{
@@ -519,14 +546,15 @@ public static function allNullOrBoolean($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert scalar|null $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function nullOrScalar($value, $message = '')
{
@@ -535,14 +563,15 @@ public static function nullOrScalar($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allScalar($value, $message = '')
{
@@ -555,14 +584,15 @@ public static function allScalar($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function allNullOrScalar($value, $message = '')
{
@@ -575,14 +605,15 @@ public static function allNullOrScalar($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert object|null $value
*
* @param mixed $value
* @param string $message
*
- * @throws InvalidArgumentException
- *
* @return void
+ *
+ * @throws InvalidArgumentException
*/
public static function nullOrObject($value, $message = '')
{
@@ -591,14 +622,15 @@ public static function nullOrObject($value, $message = '')
/**
* @psalm-pure
+ *
* @psalm-assert iterable