-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9850ea7
commit 387ebd5
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace MoreTypes; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
class Foo | ||
{ | ||
|
||
/** | ||
* @param pure-callable $pureCallable | ||
* @param callable-array $callableArray | ||
* @param closed-resource $closedResource | ||
* @param enum-string $enumString | ||
* @param non-empty-literal-string $nonEmptyLiteralString | ||
* @param non-empty-scalar $nonEmptyScalar | ||
* @param empty-scalar $emptyScalar | ||
* @param non-empty-mixed $nonEmptyMixed | ||
*/ | ||
public function doFoo( | ||
$pureCallable, | ||
$callableArray, | ||
$closedResource, | ||
$enumString, | ||
$nonEmptyLiteralString, | ||
$nonEmptyScalar, | ||
$emptyScalar, | ||
$nonEmptyMixed | ||
): void | ||
{ | ||
assertType('callable(): mixed', $pureCallable); | ||
assertType('array&callable(): mixed', $callableArray); | ||
assertType('resource', $closedResource); | ||
assertType('class-string', $enumString); | ||
assertType('literal-string&non-empty-string', $nonEmptyLiteralString); | ||
assertType('float|int<min, -1>|int<1, max>|non-falsy-string|true', $nonEmptyScalar); | ||
assertType("0|0.0|''|'0'|false", $emptyScalar); | ||
assertType("mixed~0|0.0|''|'0'|array{}|false|null", $nonEmptyMixed); | ||
} | ||
|
||
} |