-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use narrowed conditional type if/else types for subtype checks
- Loading branch information
1 parent
8edfde0
commit 4b978ba
Showing
3 changed files
with
97 additions
and
23 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,30 @@ | ||
<?php | ||
|
||
namespace Bug10622; | ||
|
||
class Model {} | ||
|
||
/** | ||
* @template TKey of array-key | ||
* @template TModel | ||
* | ||
*/ | ||
class SupportCollection {} | ||
|
||
/** | ||
* @template TKey of array-key | ||
* @template TModel of Model | ||
* | ||
*/ | ||
class Collection | ||
{ | ||
/** | ||
* Run a map over each of the items. | ||
* | ||
* @template TMapValue | ||
* | ||
* @param callable(TModel, TKey): TMapValue $callback | ||
* @return (TMapValue is Model ? self<TKey, TMapValue> : SupportCollection<TKey, TMapValue>) | ||
*/ | ||
public function map(callable $callback) {} | ||
} |