-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix accepting BenevolentUnionType as part of GenericObjectType
- Loading branch information
1 parent
92994d6
commit d29d098
Showing
3 changed files
with
38 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,32 @@ | ||
<?php | ||
|
||
namespace Bug4605; | ||
|
||
/** | ||
* @phpstan-template TKey | ||
* @psalm-template TKey of array-key | ||
* @psalm-template T | ||
* @template-extends IteratorAggregate<TKey, T> | ||
* @template-extends ArrayAccess<TKey|null, T> | ||
*/ | ||
interface Collection extends \Countable, \IteratorAggregate, \ArrayAccess {} | ||
|
||
class Boo { | ||
/** | ||
* @param Collection<array-key, string> $collection | ||
* @return Collection<array-key, string> | ||
*/ | ||
public function foo(Collection $collection): Collection | ||
{ | ||
return $collection; | ||
} | ||
|
||
/** | ||
* @param Collection<int, string> $collection | ||
* @return Collection<int, string> | ||
*/ | ||
public function boo(Collection $collection): Collection | ||
{ | ||
return $collection; | ||
} | ||
} |