From b0020f745cded45446a59299b4a8932333d217df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A1=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= Date: Fri, 12 Dec 2025 00:46:12 +0400 Subject: [PATCH 1/8] Add support for `non-falsy-string` --- src/PseudoTypes/NonFalsyString.php | 36 +++++++++++++++++++ src/TypeResolver.php | 2 ++ tests/unit/PseudoTypes/NonFalsyStringTest.php | 32 +++++++++++++++++ tests/unit/TypeResolverTest.php | 2 ++ 4 files changed, 72 insertions(+) create mode 100644 src/PseudoTypes/NonFalsyString.php create mode 100644 tests/unit/PseudoTypes/NonFalsyStringTest.php diff --git a/src/PseudoTypes/NonFalsyString.php b/src/PseudoTypes/NonFalsyString.php new file mode 100644 index 0000000..9063f74 --- /dev/null +++ b/src/PseudoTypes/NonFalsyString.php @@ -0,0 +1,36 @@ + Never_::class, 'list' => List_::class, 'non-empty-list' => NonEmptyList::class, + 'non-falsy-string' => NonFalsyString::class, ]; /** diff --git a/tests/unit/PseudoTypes/NonFalsyStringTest.php b/tests/unit/PseudoTypes/NonFalsyStringTest.php new file mode 100644 index 0000000..ada455e --- /dev/null +++ b/tests/unit/PseudoTypes/NonFalsyStringTest.php @@ -0,0 +1,32 @@ +assertEquals(new String_(), $type->underlyingType()); + } + + public function testToString(): void + { + $this->assertSame('non-falsy-string', (string) (new NonFalsyString())); + } +} diff --git a/tests/unit/TypeResolverTest.php b/tests/unit/TypeResolverTest.php index 4919aa1..1569995 100644 --- a/tests/unit/TypeResolverTest.php +++ b/tests/unit/TypeResolverTest.php @@ -44,6 +44,7 @@ use phpDocumentor\Reflection\PseudoTypes\NonEmptyList; use phpDocumentor\Reflection\PseudoTypes\NonEmptyLowercaseString; use phpDocumentor\Reflection\PseudoTypes\NonEmptyString; +use phpDocumentor\Reflection\PseudoTypes\NonFalsyString; use phpDocumentor\Reflection\PseudoTypes\Numeric_; use phpDocumentor\Reflection\PseudoTypes\NumericString; use phpDocumentor\Reflection\PseudoTypes\ObjectShape; @@ -675,6 +676,7 @@ public function provideKeywords(): array ['list', List_::class], ['non-empty-list', NonEmptyList::class], ['non-empty-array', NonEmptyArray::class], + ['non-falsy-string', NonFalsyString::class], ]; } From fe34f8664300affdf82d66bcd2b85beb4acc33f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A1=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= Date: Fri, 12 Dec 2025 00:52:12 +0400 Subject: [PATCH 2/8] Add support for `truthy-string` --- src/PseudoTypes/TruthyString.php | 36 +++++++++++++++++++++ src/TypeResolver.php | 2 ++ tests/unit/PseudoTypes/TruthyStringTest.php | 32 ++++++++++++++++++ tests/unit/TypeResolverTest.php | 2 ++ 4 files changed, 72 insertions(+) create mode 100644 src/PseudoTypes/TruthyString.php create mode 100644 tests/unit/PseudoTypes/TruthyStringTest.php diff --git a/src/PseudoTypes/TruthyString.php b/src/PseudoTypes/TruthyString.php new file mode 100644 index 0000000..4cb8687 --- /dev/null +++ b/src/PseudoTypes/TruthyString.php @@ -0,0 +1,36 @@ + List_::class, 'non-empty-list' => NonEmptyList::class, 'non-falsy-string' => NonFalsyString::class, + 'truthy-string' => TruthyString::class, ]; /** diff --git a/tests/unit/PseudoTypes/TruthyStringTest.php b/tests/unit/PseudoTypes/TruthyStringTest.php new file mode 100644 index 0000000..5bf781c --- /dev/null +++ b/tests/unit/PseudoTypes/TruthyStringTest.php @@ -0,0 +1,32 @@ +assertEquals(new String_(), $type->underlyingType()); + } + + public function testToString(): void + { + $this->assertSame('truthy-string', (string) (new TruthyString())); + } +} diff --git a/tests/unit/TypeResolverTest.php b/tests/unit/TypeResolverTest.php index 1569995..b6111fc 100644 --- a/tests/unit/TypeResolverTest.php +++ b/tests/unit/TypeResolverTest.php @@ -59,6 +59,7 @@ use phpDocumentor\Reflection\PseudoTypes\StringValue; use phpDocumentor\Reflection\PseudoTypes\TraitString; use phpDocumentor\Reflection\PseudoTypes\True_; +use phpDocumentor\Reflection\PseudoTypes\TruthyString; use phpDocumentor\Reflection\PseudoTypes\ValueOf; use phpDocumentor\Reflection\Types\Array_; use phpDocumentor\Reflection\Types\Boolean; @@ -677,6 +678,7 @@ public function provideKeywords(): array ['non-empty-list', NonEmptyList::class], ['non-empty-array', NonEmptyArray::class], ['non-falsy-string', NonFalsyString::class], + ['truthy-string', TruthyString::class], ]; } From 6305d5bfd0610e6e2f694a15d2c286e390787bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A1=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= Date: Fri, 12 Dec 2025 00:54:35 +0400 Subject: [PATCH 3/8] Fix description for `NegativeInteger` and `PositiveInteger` --- src/PseudoTypes/NegativeInteger.php | 2 +- src/PseudoTypes/PositiveInteger.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PseudoTypes/NegativeInteger.php b/src/PseudoTypes/NegativeInteger.php index c51d3fe..ebcab6f 100644 --- a/src/PseudoTypes/NegativeInteger.php +++ b/src/PseudoTypes/NegativeInteger.php @@ -18,7 +18,7 @@ use phpDocumentor\Reflection\Types\Integer; /** - * Value Object representing the type 'int'. + * Value Object representing the type 'negative-int'. * * @psalm-immutable */ diff --git a/src/PseudoTypes/PositiveInteger.php b/src/PseudoTypes/PositiveInteger.php index c52184d..3980544 100644 --- a/src/PseudoTypes/PositiveInteger.php +++ b/src/PseudoTypes/PositiveInteger.php @@ -18,7 +18,7 @@ use phpDocumentor\Reflection\Types\Integer; /** - * Value Object representing the type 'int'. + * Value Object representing the type 'positive-int'. * * @psalm-immutable */ From 6d470b59d639679186bbdd10afac5bb3395cd9fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A1=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= Date: Fri, 12 Dec 2025 00:57:11 +0400 Subject: [PATCH 4/8] Add support for `non-positive-int` --- src/PseudoTypes/NonPositiveInteger.php | 36 +++++++++++++++++++ src/TypeResolver.php | 2 ++ .../PseudoTypes/NonPositiveIntegerTest.php | 32 +++++++++++++++++ tests/unit/TypeResolverTest.php | 2 ++ 4 files changed, 72 insertions(+) create mode 100644 src/PseudoTypes/NonPositiveInteger.php create mode 100644 tests/unit/PseudoTypes/NonPositiveIntegerTest.php diff --git a/src/PseudoTypes/NonPositiveInteger.php b/src/PseudoTypes/NonPositiveInteger.php new file mode 100644 index 0000000..a66125c --- /dev/null +++ b/src/PseudoTypes/NonPositiveInteger.php @@ -0,0 +1,36 @@ + NonEmptyList::class, 'non-falsy-string' => NonFalsyString::class, 'truthy-string' => TruthyString::class, + 'non-positive-int' => NonPositiveInteger::class, ]; /** diff --git a/tests/unit/PseudoTypes/NonPositiveIntegerTest.php b/tests/unit/PseudoTypes/NonPositiveIntegerTest.php new file mode 100644 index 0000000..dcdf085 --- /dev/null +++ b/tests/unit/PseudoTypes/NonPositiveIntegerTest.php @@ -0,0 +1,32 @@ +assertEquals(new Integer(), $type->underlyingType()); + } + + public function testToString(): void + { + $this->assertSame('non-positive-int', (string) (new NonPositiveInteger())); + } +} diff --git a/tests/unit/TypeResolverTest.php b/tests/unit/TypeResolverTest.php index b6111fc..4b8ebed 100644 --- a/tests/unit/TypeResolverTest.php +++ b/tests/unit/TypeResolverTest.php @@ -45,6 +45,7 @@ use phpDocumentor\Reflection\PseudoTypes\NonEmptyLowercaseString; use phpDocumentor\Reflection\PseudoTypes\NonEmptyString; use phpDocumentor\Reflection\PseudoTypes\NonFalsyString; +use phpDocumentor\Reflection\PseudoTypes\NonPositiveInteger; use phpDocumentor\Reflection\PseudoTypes\Numeric_; use phpDocumentor\Reflection\PseudoTypes\NumericString; use phpDocumentor\Reflection\PseudoTypes\ObjectShape; @@ -679,6 +680,7 @@ public function provideKeywords(): array ['non-empty-array', NonEmptyArray::class], ['non-falsy-string', NonFalsyString::class], ['truthy-string', TruthyString::class], + ['non-positive-int', NonPositiveInteger::class], ]; } From 2adb62596c474e2d048fc95c5fb46b3ad1cfee7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A1=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= Date: Fri, 12 Dec 2025 01:00:04 +0400 Subject: [PATCH 5/8] Add support for `non-negative-int` --- src/PseudoTypes/NonNegativeInteger.php | 39 +++++++++++++++++++ src/TypeResolver.php | 2 + .../PseudoTypes/NonNegativeIntegerTest.php | 32 +++++++++++++++ tests/unit/TypeResolverTest.php | 2 + 4 files changed, 75 insertions(+) create mode 100644 src/PseudoTypes/NonNegativeInteger.php create mode 100644 tests/unit/PseudoTypes/NonNegativeIntegerTest.php diff --git a/src/PseudoTypes/NonNegativeInteger.php b/src/PseudoTypes/NonNegativeInteger.php new file mode 100644 index 0000000..3b941a0 --- /dev/null +++ b/src/PseudoTypes/NonNegativeInteger.php @@ -0,0 +1,39 @@ + NonFalsyString::class, 'truthy-string' => TruthyString::class, 'non-positive-int' => NonPositiveInteger::class, + 'non-negative-int' => NonNegativeInteger::class, ]; /** diff --git a/tests/unit/PseudoTypes/NonNegativeIntegerTest.php b/tests/unit/PseudoTypes/NonNegativeIntegerTest.php new file mode 100644 index 0000000..5ccf66e --- /dev/null +++ b/tests/unit/PseudoTypes/NonNegativeIntegerTest.php @@ -0,0 +1,32 @@ +assertEquals(new Integer(), $type->underlyingType()); + } + + public function testToString(): void + { + $this->assertSame('non-negative-int', (string) (new NonNegativeInteger())); + } +} diff --git a/tests/unit/TypeResolverTest.php b/tests/unit/TypeResolverTest.php index 4b8ebed..8b5fb4e 100644 --- a/tests/unit/TypeResolverTest.php +++ b/tests/unit/TypeResolverTest.php @@ -45,6 +45,7 @@ use phpDocumentor\Reflection\PseudoTypes\NonEmptyLowercaseString; use phpDocumentor\Reflection\PseudoTypes\NonEmptyString; use phpDocumentor\Reflection\PseudoTypes\NonFalsyString; +use phpDocumentor\Reflection\PseudoTypes\NonNegativeInteger; use phpDocumentor\Reflection\PseudoTypes\NonPositiveInteger; use phpDocumentor\Reflection\PseudoTypes\Numeric_; use phpDocumentor\Reflection\PseudoTypes\NumericString; @@ -681,6 +682,7 @@ public function provideKeywords(): array ['non-falsy-string', NonFalsyString::class], ['truthy-string', TruthyString::class], ['non-positive-int', NonPositiveInteger::class], + ['non-negative-int', NonNegativeInteger::class], ]; } From 88688ccfa7bc9a02f320a473b1ab8eb0bcbbc43d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A1=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= Date: Fri, 12 Dec 2025 01:01:47 +0400 Subject: [PATCH 6/8] Add tests for `pure-callable` --- tests/unit/Types/CallableTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/unit/Types/CallableTest.php b/tests/unit/Types/CallableTest.php index 6eca238..7ee9c8a 100644 --- a/tests/unit/Types/CallableTest.php +++ b/tests/unit/Types/CallableTest.php @@ -72,6 +72,10 @@ public static function provideToStringData(): array 'callable', new Callable_(), ], + 'pure' => [ + 'pure-callable', + new Callable_('pure-callable'), + ], 'closure' => [ '\Closure', new Callable_('\Closure'), From 837c1dd852390617c115925368cad662211353c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A1=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= Date: Fri, 12 Dec 2025 01:05:09 +0400 Subject: [PATCH 7/8] Add support for `non-zero-int` --- src/PseudoTypes/NonZeroInteger.php | 39 +++++++++++++++++++ src/TypeResolver.php | 2 + tests/unit/PseudoTypes/NonZeroIntegerTest.php | 32 +++++++++++++++ tests/unit/TypeResolverTest.php | 2 + 4 files changed, 75 insertions(+) create mode 100644 src/PseudoTypes/NonZeroInteger.php create mode 100644 tests/unit/PseudoTypes/NonZeroIntegerTest.php diff --git a/src/PseudoTypes/NonZeroInteger.php b/src/PseudoTypes/NonZeroInteger.php new file mode 100644 index 0000000..41e0c4c --- /dev/null +++ b/src/PseudoTypes/NonZeroInteger.php @@ -0,0 +1,39 @@ + TruthyString::class, 'non-positive-int' => NonPositiveInteger::class, 'non-negative-int' => NonNegativeInteger::class, + 'non-zero-int' => NonZeroInteger::class, ]; /** diff --git a/tests/unit/PseudoTypes/NonZeroIntegerTest.php b/tests/unit/PseudoTypes/NonZeroIntegerTest.php new file mode 100644 index 0000000..4ed3bf3 --- /dev/null +++ b/tests/unit/PseudoTypes/NonZeroIntegerTest.php @@ -0,0 +1,32 @@ +assertEquals(new Integer(), $type->underlyingType()); + } + + public function testToString(): void + { + $this->assertSame('non-zero-int', (string) (new NonZeroInteger())); + } +} diff --git a/tests/unit/TypeResolverTest.php b/tests/unit/TypeResolverTest.php index 8b5fb4e..67244a3 100644 --- a/tests/unit/TypeResolverTest.php +++ b/tests/unit/TypeResolverTest.php @@ -47,6 +47,7 @@ use phpDocumentor\Reflection\PseudoTypes\NonFalsyString; use phpDocumentor\Reflection\PseudoTypes\NonNegativeInteger; use phpDocumentor\Reflection\PseudoTypes\NonPositiveInteger; +use phpDocumentor\Reflection\PseudoTypes\NonZeroInteger; use phpDocumentor\Reflection\PseudoTypes\Numeric_; use phpDocumentor\Reflection\PseudoTypes\NumericString; use phpDocumentor\Reflection\PseudoTypes\ObjectShape; @@ -683,6 +684,7 @@ public function provideKeywords(): array ['truthy-string', TruthyString::class], ['non-positive-int', NonPositiveInteger::class], ['non-negative-int', NonNegativeInteger::class], + ['non-zero-int', NonZeroInteger::class], ]; } From 965a9963fe51960dce119791d85857f9590f239c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A1=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= Date: Fri, 12 Dec 2025 01:12:37 +0400 Subject: [PATCH 8/8] Add tests for `pure-callable` --- tests/unit/TypeResolverTest.php | 8 ++++++++ tests/unit/Types/CallableTest.php | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/unit/TypeResolverTest.php b/tests/unit/TypeResolverTest.php index 67244a3..287688f 100644 --- a/tests/unit/TypeResolverTest.php +++ b/tests/unit/TypeResolverTest.php @@ -1165,6 +1165,14 @@ public function callableProvider(): array 'callable', new Callable_(), ], + [ + 'pure-callable(int): int', + new Callable_( + 'pure-callable', + [new CallableParameter(new Integer())], + new Integer() + ), + ], [ 'callable()', new Callable_(), diff --git a/tests/unit/Types/CallableTest.php b/tests/unit/Types/CallableTest.php index 7ee9c8a..a99e048 100644 --- a/tests/unit/Types/CallableTest.php +++ b/tests/unit/Types/CallableTest.php @@ -73,8 +73,12 @@ public static function provideToStringData(): array new Callable_(), ], 'pure' => [ - 'pure-callable', - new Callable_('pure-callable'), + 'pure-callable(int): int', + new Callable_( + 'pure-callable', + [new CallableParameter(new Integer())], + new Integer() + ), ], 'closure' => [ '\Closure',