-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic support for interface-string and trait-string
- Loading branch information
1 parent
b170a4f
commit d0ef5d4
Showing
3 changed files
with
33 additions
and
1 deletion.
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,29 @@ | ||
<?php | ||
|
||
namespace MoreTypeStrings; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
class Foo | ||
{ | ||
|
||
/** | ||
* @param interface-string $interfaceString | ||
* @param trait-string $traitString | ||
* @param interface-string<Foo> $genericInterfaceString | ||
* @param trait-string<Foo> $genericTraitString | ||
*/ | ||
public function doFoo( | ||
string $interfaceString, | ||
string $traitString, | ||
string $genericInterfaceString, | ||
string $genericTraitString | ||
): void | ||
{ | ||
assertType('class-string', $interfaceString); | ||
assertType('class-string', $traitString); | ||
assertType('class-string<MoreTypeStrings\Foo>', $genericInterfaceString); | ||
assertType('string', $genericTraitString); | ||
} | ||
|
||
} |