-
-
Notifications
You must be signed in to change notification settings - Fork 860
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support literals and class constants as PHPDoc types
- Loading branch information
1 parent
90b1186
commit 730a902
Showing
6 changed files
with
168 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
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,45 @@ | ||
<?php | ||
|
||
namespace ConstExprPhpDocType; | ||
|
||
use RecursiveIteratorIterator as Rec; | ||
use function PHPStan\Analyser\assertType; | ||
|
||
class Foo | ||
{ | ||
|
||
public const SOME_CONSTANT = 1; | ||
public const SOME_OTHER_CONSTANT = 2; | ||
|
||
/** | ||
* @param 'foo'|'bar' $one | ||
* @param self::SOME_* $two | ||
* @param self::SOME_OTHER_CONSTANT $three | ||
* @param \ConstExprPhpDocType\Foo::SOME_CONSTANT $four | ||
* @param Rec::LEAVES_ONLY $five | ||
* @param 1.0 $six | ||
* @param 234 $seven | ||
* @param self::SOME_OTHER_* $eight | ||
*/ | ||
public function doFoo( | ||
$one, | ||
$two, | ||
$three, | ||
$four, | ||
$five, | ||
$six, | ||
$seven, | ||
$eight | ||
) | ||
{ | ||
assertType("'bar'|'foo'", $one); | ||
assertType('1|2', $two); | ||
assertType('2', $three); | ||
assertType('1', $four); | ||
assertType('0', $five); | ||
assertType('1.0', $six); | ||
assertType('234', $seven); | ||
assertType('2', $eight); | ||
} | ||
|
||
} |
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