diff --git a/CHANGELOG.md b/CHANGELOG.md index 3243f8c..0854f36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Changelog ========= +## 2.1.3 + +### Fixed + +- Corrected `isList` type documentation + ## 2.1.2 ### Fixed diff --git a/bin/src/MixinGenerator.php b/bin/src/MixinGenerator.php index 40b12c0..aa82e65 100644 --- a/bin/src/MixinGenerator.php +++ b/bin/src/MixinGenerator.php @@ -14,6 +14,7 @@ use ReflectionType; use ReflectionUnionType; use RuntimeException; +use Throwable; use Webmozart\Assert\Assert; final class MixinGenerator @@ -77,6 +78,7 @@ private function namespace(): string $namespace = sprintf("namespace %s;\n\n", $assert->getNamespaceName()); $namespace .= sprintf("use %s;\n", ArrayAccess::class); $namespace .= sprintf("use %s;\n", Countable::class); + $namespace .= sprintf("use %s;\n", Throwable::class); $namespace .= "\n"; $namespace .= $this->trait($assert); diff --git a/src/Assert.php b/src/Assert.php index 07cc141..a03e2a2 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -1984,9 +1984,11 @@ public static function countBetween(mixed $array, mixed $min, mixed $max, string /** * @psalm-pure * - * @psalm-assert list $array + * @psalm-assert list $array * - * @psalm-return list + * @psalm-return list + * + * @template T * * @throws InvalidArgumentException */ @@ -2004,9 +2006,11 @@ public static function isList(mixed $array, string $message = ''): array /** * @psalm-pure * - * @psalm-assert non-empty-list $array + * @psalm-assert non-empty-list $array * - * @psalm-return non-empty-list + * @psalm-return non-empty-list + * + * @template T * * @throws InvalidArgumentException */ diff --git a/src/Mixin.php b/src/Mixin.php index 8c475b4..31acc8e 100644 --- a/src/Mixin.php +++ b/src/Mixin.php @@ -6,6 +6,7 @@ use ArrayAccess; use Countable; +use Throwable; /** * This trait provides nullOr*, all* and allNullOr* variants of assertion base methods. @@ -4781,9 +4782,10 @@ public static function allNullOrCountBetween(mixed $array, mixed $min, mixed $ma /** * @psalm-pure * - * @psalm-assert list|null $array + * @psalm-assert list|null $array * - * @return list|null + * @template T + * @return list|null * * @throws InvalidArgumentException */ @@ -4797,9 +4799,10 @@ public static function nullOrIsList(mixed $array, string $message = ''): mixed /** * @psalm-pure * - * @psalm-assert iterable $array + * @psalm-assert iterable> $array * - * @return iterable + * @template T + * @return iterable> * * @throws InvalidArgumentException */ @@ -4817,9 +4820,10 @@ public static function allIsList(mixed $array, string $message = ''): mixed /** * @psalm-pure * - * @psalm-assert iterable $array + * @psalm-assert iterable|null> $array * - * @return iterable + * @template T + * @return iterable|null> * * @throws InvalidArgumentException */ @@ -4837,9 +4841,10 @@ public static function allNullOrIsList(mixed $array, string $message = ''): mixe /** * @psalm-pure * - * @psalm-assert non-empty-list|null $array + * @psalm-assert non-empty-list|null $array * - * @return non-empty-list|null + * @template T + * @return non-empty-list|null * * @throws InvalidArgumentException */ @@ -4853,9 +4858,10 @@ public static function nullOrIsNonEmptyList(mixed $array, string $message = ''): /** * @psalm-pure * - * @psalm-assert iterable $array + * @psalm-assert iterable> $array * - * @return iterable + * @template T + * @return iterable> * * @throws InvalidArgumentException */ @@ -4873,9 +4879,10 @@ public static function allIsNonEmptyList(mixed $array, string $message = ''): mi /** * @psalm-pure * - * @psalm-assert iterable $array + * @psalm-assert iterable|null> $array * - * @return iterable + * @template T + * @return iterable|null> * * @throws InvalidArgumentException */