-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support non-empty-array and non-empty-list
- Loading branch information
1 parent
f9a6538
commit a4038b2
Showing
10 changed files
with
126 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
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,37 @@ | ||
<?php | ||
|
||
namespace NonEmptyArray; | ||
|
||
use function PHPStan\Analyser\assertType; | ||
|
||
class Foo | ||
{ | ||
|
||
/** | ||
* @param non-empty-array $array | ||
* @param non-empty-list $list | ||
* @param non-empty-array<int, string> $arrayOfStrings | ||
* @param non-empty-list<\stdClass> $listOfStd | ||
* @param non-empty-list<\stdClass> $listOfStd2 | ||
* @param non-empty-list<string, \stdClass> $invalidList | ||
*/ | ||
public function doFoo( | ||
array $array, | ||
array $list, | ||
array $arrayOfStrings, | ||
array $listOfStd, | ||
$listOfStd2, | ||
array $invalidList, | ||
$invalidList2 | ||
): void | ||
{ | ||
assertType('array&nonEmpty', $array); | ||
assertType('array<int, mixed>&nonEmpty', $list); | ||
assertType('array<int, string>&nonEmpty', $arrayOfStrings); | ||
assertType('array<int, stdClass>&nonEmpty', $listOfStd); | ||
assertType('array<int, stdClass>&nonEmpty', $listOfStd2); | ||
assertType('array', $invalidList); | ||
assertType('mixed', $invalidList2); | ||
} | ||
|
||
} |
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