diff --git a/src/Type/IntegerRangeType.php b/src/Type/IntegerRangeType.php index 8a9414fbee..3db816aeca 100644 --- a/src/Type/IntegerRangeType.php +++ b/src/Type/IntegerRangeType.php @@ -10,6 +10,7 @@ use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\Reflection\InitializerExprTypeResolver; use PHPStan\TrinaryLogic; +use PHPStan\Type\Accessory\AccessoryLowercaseStringType; use PHPStan\Type\Accessory\AccessoryNonFalsyStringType; use PHPStan\Type\Accessory\AccessoryNumericStringType; use PHPStan\Type\Constant\ConstantBooleanType; @@ -474,6 +475,7 @@ public function toString(): Type if ($isZero->no()) { return new IntersectionType([ new StringType(), + new AccessoryLowercaseStringType(), new AccessoryNumericStringType(), new AccessoryNonFalsyStringType(), ]); @@ -481,6 +483,7 @@ public function toString(): Type return new IntersectionType([ new StringType(), + new AccessoryLowercaseStringType(), new AccessoryNumericStringType(), ]); } diff --git a/src/Type/IntegerType.php b/src/Type/IntegerType.php index f91a646c9d..354067f0a9 100644 --- a/src/Type/IntegerType.php +++ b/src/Type/IntegerType.php @@ -6,6 +6,7 @@ use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\TrinaryLogic; +use PHPStan\Type\Accessory\AccessoryLowercaseStringType; use PHPStan\Type\Accessory\AccessoryNumericStringType; use PHPStan\Type\Constant\ConstantArrayType; use PHPStan\Type\Constant\ConstantIntegerType; @@ -81,6 +82,7 @@ public function toString(): Type { return new IntersectionType([ new StringType(), + new AccessoryLowercaseStringType(), new AccessoryNumericStringType(), ]); } diff --git a/tests/PHPStan/Analyser/nsrt/array-key-exists.php b/tests/PHPStan/Analyser/nsrt/array-key-exists.php index ed6f552d15..3ae615b2d9 100644 --- a/tests/PHPStan/Analyser/nsrt/array-key-exists.php +++ b/tests/PHPStan/Analyser/nsrt/array-key-exists.php @@ -50,16 +50,16 @@ public function doBar(array $a, array $b, array $c, int $key1, string $key2, int assertType('int', $key1); } if (array_key_exists($key2, $a)) { - assertType('numeric-string', $key2); + assertType('lowercase-string&numeric-string', $key2); } if (array_key_exists($key3, $a)) { - assertType('int|numeric-string', $key3); + assertType('int|(lowercase-string&numeric-string)', $key3); } if (array_key_exists($key4, $a)) { - assertType('(int|numeric-string)', $key4); + assertType('(int|(lowercase-string&numeric-string))', $key4); } if (array_key_exists($key5, $a)) { - assertType('int|numeric-string', $key5); + assertType('int|(lowercase-string&numeric-string)', $key5); } if (array_key_exists($key1, $b)) { diff --git a/tests/PHPStan/Analyser/nsrt/bug-10863.php b/tests/PHPStan/Analyser/nsrt/bug-10863.php index ecad48736e..275bc3774e 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-10863.php +++ b/tests/PHPStan/Analyser/nsrt/bug-10863.php @@ -12,7 +12,7 @@ class Foo */ public function doFoo($b): void { - assertType('non-falsy-string', '@' . $b); + assertType('lowercase-string&non-falsy-string', '@' . $b); } /** @@ -20,7 +20,7 @@ public function doFoo($b): void */ public function doFoo2($b): void { - assertType('non-falsy-string', '@' . $b); + assertType('lowercase-string&non-falsy-string', '@' . $b); } } diff --git a/tests/PHPStan/Analyser/nsrt/bug-11129.php b/tests/PHPStan/Analyser/nsrt/bug-11129.php index 8637ad7c4a..1f60b4089f 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-11129.php +++ b/tests/PHPStan/Analyser/nsrt/bug-11129.php @@ -21,14 +21,14 @@ public function foo( $maybeNegativeConstStrings, $maybeNonNumericConstStrings, $maybeFloatConstStrings, bool $bool, float $float ): void { - assertType('non-falsy-string', '0'.$i); - assertType('non-falsy-string&numeric-string', $i.'0'); + assertType('lowercase-string&non-falsy-string', '0'.$i); + assertType('lowercase-string&non-falsy-string&numeric-string', $i.'0'); - assertType('non-falsy-string&numeric-string', '0'.$positiveInt); - assertType('non-falsy-string&numeric-string', $positiveInt.'0'); + assertType('lowercase-string&non-falsy-string&numeric-string', '0'.$positiveInt); + assertType('lowercase-string&non-falsy-string&numeric-string', $positiveInt.'0'); - assertType('non-falsy-string', '0'.$negativeInt); - assertType('non-falsy-string&numeric-string', $negativeInt.'0'); + assertType('lowercase-string&non-falsy-string', '0'.$negativeInt); + assertType('lowercase-string&non-falsy-string&numeric-string', $negativeInt.'0'); assertType("'00'|'01'|'02'", '0'.$positiveConstStrings); assertType( "'00'|'10'|'20'", $positiveConstStrings.'0'); @@ -39,29 +39,29 @@ public function foo( assertType("'00'|'01'|'0a'", '0'.$maybeNonNumericConstStrings); assertType("'00'|'10'|'a0'", $maybeNonNumericConstStrings.'0'); - assertType('non-falsy-string&numeric-string', $i.$positiveConstStrings); - assertType( 'non-falsy-string', $positiveConstStrings.$i); + assertType('lowercase-string&non-falsy-string&numeric-string', $i.$positiveConstStrings); + assertType('lowercase-string&non-falsy-string', $positiveConstStrings.$i); - assertType('non-falsy-string', $i.$maybeNegativeConstStrings); - assertType('non-falsy-string', $maybeNegativeConstStrings.$i); + assertType('lowercase-string&non-falsy-string', $i.$maybeNegativeConstStrings); + assertType('lowercase-string&non-falsy-string', $maybeNegativeConstStrings.$i); - assertType('non-falsy-string', $i.$maybeNonNumericConstStrings); - assertType('non-falsy-string', $maybeNonNumericConstStrings.$i); + assertType('lowercase-string&non-falsy-string', $i.$maybeNonNumericConstStrings); + assertType('lowercase-string&non-falsy-string', $maybeNonNumericConstStrings.$i); - assertType('non-falsy-string', $i.$maybeFloatConstStrings); // could be 'non-falsy-string&numeric-string' - assertType('non-falsy-string', $maybeFloatConstStrings.$i); + assertType('lowercase-string&non-falsy-string', $i.$maybeFloatConstStrings); // could be 'lowercase-string&non-falsy-string&numeric-string' + assertType('lowercase-string&non-falsy-string', $maybeFloatConstStrings.$i); - assertType('non-empty-string&numeric-string', $i.$bool); - assertType('non-empty-string', $bool.$i); - assertType('non-falsy-string&numeric-string', $positiveInt.$bool); - assertType('non-falsy-string&numeric-string', $bool.$positiveInt); - assertType('non-falsy-string&numeric-string', $negativeInt.$bool); - assertType('non-falsy-string', $bool.$negativeInt); + assertType('lowercase-string&non-empty-string&numeric-string', $i.$bool); + assertType('lowercase-string&non-empty-string', $bool.$i); + assertType('lowercase-string&non-falsy-string&numeric-string', $positiveInt.$bool); + assertType('lowercase-string&non-falsy-string&numeric-string', $bool.$positiveInt); + assertType('lowercase-string&non-falsy-string&numeric-string', $negativeInt.$bool); + assertType('lowercase-string&non-falsy-string', $bool.$negativeInt); - assertType('non-falsy-string', $i.$i); - assertType('non-falsy-string', $negativeInt.$negativeInt); - assertType('non-falsy-string', $maybeNegativeConstStrings.$negativeInt); - assertType('non-falsy-string', $negativeInt.$maybeNegativeConstStrings); + assertType('lowercase-string&non-falsy-string', $i.$i); + assertType('lowercase-string&non-falsy-string', $negativeInt.$negativeInt); + assertType('lowercase-string&non-falsy-string', $maybeNegativeConstStrings.$negativeInt); + assertType('lowercase-string&non-falsy-string', $negativeInt.$maybeNegativeConstStrings); // https://3v4l.org/BCS2K assertType('non-falsy-string', $float.$float); @@ -75,9 +75,9 @@ public function foo( // https://3v4l.org/Ia4r0 $scientificFloatAsString = '3e4'; assertType('non-falsy-string', $numericString.$scientificFloatAsString); - assertType('non-falsy-string', $i.$scientificFloatAsString); + assertType('lowercase-string&non-falsy-string', $i.$scientificFloatAsString); assertType('non-falsy-string', $scientificFloatAsString.$numericString); - assertType('non-falsy-string', $scientificFloatAsString.$i); + assertType('lowercase-string&non-falsy-string', $scientificFloatAsString.$i); } } diff --git a/tests/PHPStan/Analyser/nsrt/bug-11716.php b/tests/PHPStan/Analyser/nsrt/bug-11716.php index e637669483..83c10f3225 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-11716.php +++ b/tests/PHPStan/Analyser/nsrt/bug-11716.php @@ -75,7 +75,7 @@ function narrowKey($mixed, string $s, int $i, array $generalArr, array $intKeyed assertType('int', $i); if (isset($intKeyedArr[$s])) { - assertType("numeric-string", $s); + assertType("lowercase-string&numeric-string", $s); } else { assertType('string', $s); } diff --git a/tests/PHPStan/Analyser/nsrt/bug-4587.php b/tests/PHPStan/Analyser/nsrt/bug-4587.php index 644b9d7b79..623fea93af 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-4587.php +++ b/tests/PHPStan/Analyser/nsrt/bug-4587.php @@ -27,11 +27,11 @@ public function b(): void $type = array_map(static function (array $result): array { assertType('array{a: int}', $result); $result['a'] = (string) $result['a']; - assertType('array{a: numeric-string}', $result); + assertType('array{a: lowercase-string&numeric-string}', $result); return $result; }, $results); - assertType('list', $type); + assertType('list', $type); } } diff --git a/tests/PHPStan/Analyser/nsrt/bug-7387.php b/tests/PHPStan/Analyser/nsrt/bug-7387.php index cfb1a97642..814513ac97 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-7387.php +++ b/tests/PHPStan/Analyser/nsrt/bug-7387.php @@ -29,7 +29,7 @@ public function inputTypes(int $i, float $f, string $s, int $intRange) { public function specifiers(int $i) { // https://3v4l.org/fmVIg - assertType('numeric-string', sprintf('%14s', $i)); + assertType('lowercase-string&numeric-string', sprintf('%14s', $i)); assertType('numeric-string', sprintf('%d', $i)); @@ -59,9 +59,9 @@ public function specifiers(int $i) { */ public function positionalArgs($mixed, int $i, float $f, string $s, int $posInt, int $negInt, int $nonZeroIntRange, int $intRange) { // https://3v4l.org/vVL0c - assertType('numeric-string', sprintf('%2$6s', $mixed, $i)); - assertType('non-falsy-string&numeric-string', sprintf('%2$6s', $mixed, $posInt)); - assertType('non-falsy-string&numeric-string', sprintf('%2$6s', $mixed, $negInt)); + assertType('lowercase-string&numeric-string', sprintf('%2$6s', $mixed, $i)); + assertType('lowercase-string&non-falsy-string&numeric-string', sprintf('%2$6s', $mixed, $posInt)); + assertType('lowercase-string&non-falsy-string&numeric-string', sprintf('%2$6s', $mixed, $negInt)); assertType("' 1'|' 2'|' 3'|' 4'|' 5'", sprintf('%2$6s', $mixed, $nonZeroIntRange)); // https://3v4l.org/1ECIq diff --git a/tests/PHPStan/Analyser/nsrt/bug-8568.php b/tests/PHPStan/Analyser/nsrt/bug-8568.php index 71db7a6c98..9236447acf 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-8568.php +++ b/tests/PHPStan/Analyser/nsrt/bug-8568.php @@ -8,7 +8,7 @@ class HelloWorld { public function sayHello(): void { - assertType('non-falsy-string', 'a' . $this->get()); + assertType('lowercase-string&non-falsy-string', 'a' . $this->get()); } public function get(): ?int diff --git a/tests/PHPStan/Analyser/nsrt/bug-8635.php b/tests/PHPStan/Analyser/nsrt/bug-8635.php index 1895254579..fe49aa8a2d 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-8635.php +++ b/tests/PHPStan/Analyser/nsrt/bug-8635.php @@ -8,6 +8,6 @@ class HelloWorld { public function EchoInt(int $value): void { - assertType('numeric-string', "$value"); + assertType('lowercase-string&numeric-string', "$value"); } } diff --git a/tests/PHPStan/Analyser/nsrt/cast-to-numeric-string.php b/tests/PHPStan/Analyser/nsrt/cast-to-numeric-string.php index c7d6fcb84c..7c13500af2 100644 --- a/tests/PHPStan/Analyser/nsrt/cast-to-numeric-string.php +++ b/tests/PHPStan/Analyser/nsrt/cast-to-numeric-string.php @@ -13,13 +13,13 @@ * @param 1 $constantInt */ function foo(int $a, float $b, $numeric, $numeric2, $number, $positive, $negative, $constantInt): void { - assertType('numeric-string', (string)$a); + assertType('lowercase-string&numeric-string', (string)$a); assertType('numeric-string', (string)$b); assertType('numeric-string', (string)$numeric); assertType('numeric-string', (string)$numeric2); assertType('numeric-string', (string)$number); - assertType('non-falsy-string&numeric-string', (string)$positive); - assertType('non-falsy-string&numeric-string', (string)$negative); + assertType('lowercase-string&non-falsy-string&numeric-string', (string)$positive); + assertType('lowercase-string&non-falsy-string&numeric-string', (string)$negative); assertType("'1'", (string)$constantInt); } @@ -32,28 +32,28 @@ function foo(int $a, float $b, $numeric, $numeric2, $number, $positive, $negativ * @param 1 $constantInt */ function concatEmptyString(int $a, float $b, $numeric, $numeric2, $number, $positive, $negative, $constantInt): void { - assertType('numeric-string', '' . $a); + assertType('lowercase-string&numeric-string', '' . $a); assertType('numeric-string', '' . $b); assertType('numeric-string', '' . $numeric); assertType('numeric-string', '' . $numeric2); assertType('numeric-string', '' . $number); - assertType('non-falsy-string&numeric-string', '' . $positive); - assertType('non-falsy-string&numeric-string', '' . $negative); + assertType('lowercase-string&non-falsy-string&numeric-string', '' . $positive); + assertType('lowercase-string&non-falsy-string&numeric-string', '' . $negative); assertType("'1'", '' . $constantInt); - assertType('numeric-string', $a . ''); + assertType('lowercase-string&numeric-string', $a . ''); assertType('numeric-string', $b . ''); assertType('numeric-string', $numeric . ''); assertType('numeric-string', $numeric2 . ''); assertType('numeric-string', $number . ''); - assertType('non-falsy-string&numeric-string', $positive . ''); - assertType('non-falsy-string&numeric-string', $negative . ''); + assertType('lowercase-string&non-falsy-string&numeric-string', $positive . ''); + assertType('lowercase-string&non-falsy-string&numeric-string', $negative . ''); assertType("'1'", $constantInt . ''); } function concatAssignEmptyString(int $i, float $f) { $i .= ''; - assertType('numeric-string', $i); + assertType('lowercase-string&numeric-string', $i); $s = ''; $s .= $f; @@ -66,13 +66,13 @@ function concatAssignEmptyString(int $i, float $f) { */ function integerRangeToString($positive, $negative) { - assertType('numeric-string', (string) $positive); - assertType('numeric-string', (string) $negative); + assertType('lowercase-string&numeric-string', (string) $positive); + assertType('lowercase-string&numeric-string', (string) $negative); if ($positive !== 0) { - assertType('non-falsy-string&numeric-string', (string) $positive); + assertType('lowercase-string&non-falsy-string&numeric-string', (string) $positive); } if ($negative !== 0) { - assertType('non-falsy-string&numeric-string', (string) $negative); + assertType('lowercase-string&non-falsy-string&numeric-string', (string) $negative); } } diff --git a/tests/PHPStan/Analyser/nsrt/filter-var.php b/tests/PHPStan/Analyser/nsrt/filter-var.php index e726c77d75..28580c448c 100644 --- a/tests/PHPStan/Analyser/nsrt/filter-var.php +++ b/tests/PHPStan/Analyser/nsrt/filter-var.php @@ -158,7 +158,7 @@ public function scalars(bool $bool, float $float, int $int, string $string, int assertType("'17'", filter_var(17.0)); assertType("'17.1'", filter_var(17.1)); assertType("'1.0E-50'", filter_var(1e-50)); - assertType('numeric-string', filter_var($int)); + assertType('lowercase-string&numeric-string', filter_var($int)); assertType("'0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'", filter_var($intRange)); assertType("'17'", filter_var(17)); assertType('string', filter_var($string)); diff --git a/tests/PHPStan/Analyser/nsrt/generics.php b/tests/PHPStan/Analyser/nsrt/generics.php index bcd7ecf616..873ad66b6d 100644 --- a/tests/PHPStan/Analyser/nsrt/generics.php +++ b/tests/PHPStan/Analyser/nsrt/generics.php @@ -147,10 +147,10 @@ function f($a, $b) */ function testF($arrayOfInt, $callableOrNull) { - assertType('Closure(int): numeric-string', function (int $a): string { + assertType('Closure(int): (lowercase-string&numeric-string)', function (int $a): string { return (string)$a; }); - assertType('array', f($arrayOfInt, function (int $a): string { + assertType('array', f($arrayOfInt, function (int $a): string { return (string)$a; })); assertType('Closure(mixed): string', function ($a): string { @@ -224,7 +224,7 @@ function testArrayMap(array $listOfIntegers) return (string) $int; }, $listOfIntegers); - assertType('array', $strings); + assertType('array', $strings); } /** diff --git a/tests/PHPStan/Analyser/nsrt/key-exists.php b/tests/PHPStan/Analyser/nsrt/key-exists.php index 11c2ed6a2a..3c85802e73 100644 --- a/tests/PHPStan/Analyser/nsrt/key-exists.php +++ b/tests/PHPStan/Analyser/nsrt/key-exists.php @@ -49,16 +49,16 @@ public function doBar(array $a, array $b, array $c, int $key1, string $key2, int assertType('int', $key1); } if (key_exists($key2, $a)) { - assertType('numeric-string', $key2); + assertType('lowercase-string&numeric-string', $key2); } if (key_exists($key3, $a)) { - assertType('int|numeric-string', $key3); + assertType('int|(lowercase-string&numeric-string)', $key3); } if (key_exists($key4, $a)) { - assertType('(int|numeric-string)', $key4); + assertType('(int|(lowercase-string&numeric-string))', $key4); } if (key_exists($key5, $a)) { - assertType('int|numeric-string', $key5); + assertType('int|(lowercase-string&numeric-string)', $key5); } if (key_exists($key1, $b)) { diff --git a/tests/PHPStan/Analyser/nsrt/range-to-string.php b/tests/PHPStan/Analyser/nsrt/range-to-string.php index 494c135d95..2d70eb4bab 100644 --- a/tests/PHPStan/Analyser/nsrt/range-to-string.php +++ b/tests/PHPStan/Analyser/nsrt/range-to-string.php @@ -17,6 +17,6 @@ public function sayHello($i, $ii, $maxlong, $toolong): void assertType("'10'|'5'|'6'|'7'|'8'|'9'", (string) $i); assertType("'-1'|'-10'|'-2'|'-3'|'-4'|'-5'|'-6'|'-7'|'-8'|'-9'|'0'|'1'|'10'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'", (string) $ii); assertType("'0'|'1'|'10'|'100'|'101'|'102'|'103'|'104'|'105'|'106'|'107'|'108'|'109'|'11'|'110'|'111'|'112'|'113'|'114'|'115'|'116'|'117'|'118'|'119'|'12'|'120'|'121'|'122'|'123'|'124'|'125'|'126'|'127'|'128'|'13'|'14'|'15'|'16'|'17'|'18'|'19'|'2'|'20'|'21'|'22'|'23'|'24'|'25'|'26'|'27'|'28'|'29'|'3'|'30'|'31'|'32'|'33'|'34'|'35'|'36'|'37'|'38'|'39'|'4'|'40'|'41'|'42'|'43'|'44'|'45'|'46'|'47'|'48'|'49'|'5'|'50'|'51'|'52'|'53'|'54'|'55'|'56'|'57'|'58'|'59'|'6'|'60'|'61'|'62'|'63'|'64'|'65'|'66'|'67'|'68'|'69'|'7'|'70'|'71'|'72'|'73'|'74'|'75'|'76'|'77'|'78'|'79'|'8'|'80'|'81'|'82'|'83'|'84'|'85'|'86'|'87'|'88'|'89'|'9'|'90'|'91'|'92'|'93'|'94'|'95'|'96'|'97'|'98'|'99'", (string) $maxlong); - assertType("numeric-string", (string) $toolong); + assertType("lowercase-string&numeric-string", (string) $toolong); } } diff --git a/tests/PHPStan/Analyser/nsrt/set-type-type-specifying.php b/tests/PHPStan/Analyser/nsrt/set-type-type-specifying.php index 11869c0623..1ab4badbe5 100644 --- a/tests/PHPStan/Analyser/nsrt/set-type-type-specifying.php +++ b/tests/PHPStan/Analyser/nsrt/set-type-type-specifying.php @@ -11,7 +11,7 @@ function doString(string $s, int $i, float $f, array $a, object $o) assertType('string', $s); settype($i, 'string'); - assertType('numeric-string', $i); + assertType('lowercase-string&numeric-string', $i); settype($f, 'string'); assertType('numeric-string', $f); diff --git a/tests/PHPStan/Analyser/nsrt/strval.php b/tests/PHPStan/Analyser/nsrt/strval.php index 870aafd6b8..a6c4397893 100644 --- a/tests/PHPStan/Analyser/nsrt/strval.php +++ b/tests/PHPStan/Analyser/nsrt/strval.php @@ -17,9 +17,9 @@ function strvalTest(string $string, string $class): void assertType('\'1\'', strval(true)); assertType('\'\'|\'1\'', strval(rand(0, 1) === 0)); assertType('\'42\'', strval(42)); - assertType('numeric-string', strval(rand())); + assertType('lowercase-string&numeric-string', strval(rand())); assertType('numeric-string', strval(rand() * 0.1)); - assertType('numeric-string', strval(strval(rand()))); + assertType('lowercase-string&numeric-string', strval(strval(rand()))); assertType('class-string', strval($class)); assertType('string', strval(new \Exception())); assertType('*ERROR*', strval(new \stdClass())); diff --git a/tests/PHPStan/Rules/DeadCode/data/bug-8620.php b/tests/PHPStan/Rules/DeadCode/data/bug-8620.php index cad6d811c2..44bc78cd45 100644 --- a/tests/PHPStan/Rules/DeadCode/data/bug-8620.php +++ b/tests/PHPStan/Rules/DeadCode/data/bug-8620.php @@ -9,7 +9,7 @@ class HelloWorld public function nullCoalesceAndConcatenation (?int $a = null): int { $key = ($a ?? "x") . "-"; - assertType('non-falsy-string', $key); + assertType('lowercase-string&non-falsy-string', $key); if ($key === "x-") { return 0; } return 1; diff --git a/tests/PHPStan/Rules/Generics/data/bug-6301.php b/tests/PHPStan/Rules/Generics/data/bug-6301.php index 9811b63253..73dff935f2 100644 --- a/tests/PHPStan/Rules/Generics/data/bug-6301.php +++ b/tests/PHPStan/Rules/Generics/data/bug-6301.php @@ -22,7 +22,7 @@ public function str($s) * @param literal-string $literalString */ public function foo(int $i, $nonEmpty, $numericString, $literalString):void { - assertType('numeric-string', $this->str((string) $i)); + assertType('lowercase-string&numeric-string', $this->str((string) $i)); assertType('non-empty-string', $this->str($nonEmpty)); assertType('numeric-string', $this->str($numericString)); assertType('literal-string', $this->str($literalString));