Skip to content

Commit 4c8bfe4

Browse files
Add tests
1 parent cca1d2b commit 4c8bfe4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/PHPStan/Analyser/nsrt/trim.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ class Foo
1010
/**
1111
* @param 'foo' $foo
1212
* @param 'foo'|'bar' $fooOrBar
13+
* @param 'constant'|class-string<Foo> $constantOrFooClass
1314
* @param string $string
1415
*/
15-
public function doTrim($foo, $fooOrBar, $string): void
16+
public function doTrim($foo, $fooOrBar, $constantOrFooClass, $string): void
1617
{
1718
assertType('string', trim($string, $foo));
1819
assertType('string', ltrim($string, $foo));
@@ -31,6 +32,13 @@ public function doTrim($foo, $fooOrBar, $string): void
3132
assertType('\'\'|\'bar\'', trim($fooOrBar, $foo));
3233
assertType('\'\'|\'bar\'', ltrim($fooOrBar, $foo));
3334
assertType('\'\'|\'bar\'', rtrim($fooOrBar, $foo));
35+
36+
assertType('string', trim($constantOrFooClass, '\\'));
37+
assertType('string', ltrim($constantOrFooClass, '\\'));
38+
assertType('string', rtrim($constantOrFooClass, '\\'));
39+
assertType('string', trim($constantOrFooClass, '\\'));
40+
assertType('string', ltrim($constantOrFooClass, '\\'));
41+
assertType('string', rtrim($constantOrFooClass, '\\'));
3442
}
3543

3644
}

0 commit comments

Comments
 (0)