From e2ee76a509ed7f935fd513dd92a8e637b8d21334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=BD=C3=A1=C4=8Dek?= Date: Mon, 5 Aug 2024 15:36:42 +0200 Subject: [PATCH] More precise assert type for Assert::integerish methods --- stubs/Assert.stub | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/stubs/Assert.stub b/stubs/Assert.stub index 4a1933f..6d7ad9f 100644 --- a/stubs/Assert.stub +++ b/stubs/Assert.stub @@ -23,4 +23,44 @@ class Assert */ public static function isNonEmptyMap($array, $message = ''): void; + /** + * @phpstan-assert int|numeric-string $value + * + * @param mixed $value + * @param string $message + * + * @throws InvalidArgumentException + */ + public static function integerish($value, $message = ''): void; + + /** + * @phpstan-assert int|numeric-string|null $value + * + * @param mixed $value + * @param string $message + * + * @throws InvalidArgumentException + */ + public static function nullOrIntegerish($value, $message = ''): void; + + /** + * @phpstan-assert iterable $value + * + * @param mixed $value + * @param string $message + * + * @throws InvalidArgumentException + */ + public static function allIntegerish($value, $message = ''): void; + + /** + * @phpstan-assert iterable $value + * + * @param mixed $value + * @param string $message + * + * @throws InvalidArgumentException + */ + public static function allNullOrIntegerish($value, $message = ''): void; + }