-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support unions of scalars in
sprintf()
arguments
- Loading branch information
1 parent
2a8d675
commit 1f95570
Showing
4 changed files
with
67 additions
and
19 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
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,21 @@ | ||
<?php | ||
|
||
namespace DynamicSprintf; | ||
|
||
use function PHPStan\Testing\assertType; | ||
use function sprintf; | ||
|
||
class Foo | ||
{ | ||
|
||
/** | ||
* @param 'a'|'aa' $a | ||
* @param 'b'|'bb' $b | ||
* @param 'c'|'cc' $c | ||
*/ | ||
public function doFoo(string $a, string $b, string $c): void | ||
{ | ||
assertType("'a b c'|'a b cc'|'a bb c'|'a bb cc'|'aa b c'|'aa b cc'|'aa bb c'|'aa bb cc'", sprintf('%s %s %s', $a, $b, $c)); | ||
} | ||
|
||
} |