Skip to content

Commit

Permalink
feat: make HigherOrderCollectionProxy generic via template types
Browse files Browse the repository at this point in the history
  • Loading branch information
Voltra committed Aug 9, 2024
1 parent 6ce800f commit 439a8ac
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 32 deletions.
11 changes: 8 additions & 3 deletions src/Illuminate/Collections/HigherOrderCollectionProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
namespace Illuminate\Support;

/**
* @mixin \Illuminate\Support\Enumerable
* @template TKey of array-key
*
* @template-covariant TValue of mixed
*
* @mixin \Illuminate\Support\Enumerable<TKey, TValue>
* @mixin TValue
*/
class HigherOrderCollectionProxy
{
/**
* The collection being operated on.
*
* @var \Illuminate\Support\Enumerable
* @var \Illuminate\Support\Enumerable<TKey, TValue>
*/
protected $collection;

Expand All @@ -24,7 +29,7 @@ class HigherOrderCollectionProxy
/**
* Create a new proxy instance.
*
* @param \Illuminate\Support\Enumerable $collection
* @param \Illuminate\Support\Enumerable<TKey, TValue> $collection
* @param string $method
* @return void
*/
Expand Down
58 changes: 29 additions & 29 deletions src/Illuminate/Collections/Traits/EnumeratesValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,35 @@
*
* @template-covariant TValue
*
* @property-read HigherOrderCollectionProxy $average
* @property-read HigherOrderCollectionProxy $avg
* @property-read HigherOrderCollectionProxy $contains
* @property-read HigherOrderCollectionProxy $doesntContain
* @property-read HigherOrderCollectionProxy $each
* @property-read HigherOrderCollectionProxy $every
* @property-read HigherOrderCollectionProxy $filter
* @property-read HigherOrderCollectionProxy $first
* @property-read HigherOrderCollectionProxy $flatMap
* @property-read HigherOrderCollectionProxy $groupBy
* @property-read HigherOrderCollectionProxy $keyBy
* @property-read HigherOrderCollectionProxy $map
* @property-read HigherOrderCollectionProxy $max
* @property-read HigherOrderCollectionProxy $min
* @property-read HigherOrderCollectionProxy $partition
* @property-read HigherOrderCollectionProxy $percentage
* @property-read HigherOrderCollectionProxy $reject
* @property-read HigherOrderCollectionProxy $skipUntil
* @property-read HigherOrderCollectionProxy $skipWhile
* @property-read HigherOrderCollectionProxy $some
* @property-read HigherOrderCollectionProxy $sortBy
* @property-read HigherOrderCollectionProxy $sortByDesc
* @property-read HigherOrderCollectionProxy $sum
* @property-read HigherOrderCollectionProxy $takeUntil
* @property-read HigherOrderCollectionProxy $takeWhile
* @property-read HigherOrderCollectionProxy $unique
* @property-read HigherOrderCollectionProxy $unless
* @property-read HigherOrderCollectionProxy $until
* @property-read HigherOrderCollectionProxy $when
* @property-read HigherOrderCollectionProxy<TKey, TValue> $average
* @property-read HigherOrderCollectionProxy<TKey, TValue> $avg
* @property-read HigherOrderCollectionProxy<TKey, TValue> $contains
* @property-read HigherOrderCollectionProxy<TKey, TValue> $doesntContain
* @property-read HigherOrderCollectionProxy<TKey, TValue> $each
* @property-read HigherOrderCollectionProxy<TKey, TValue> $every
* @property-read HigherOrderCollectionProxy<TKey, TValue> $filter
* @property-read HigherOrderCollectionProxy<TKey, TValue> $first
* @property-read HigherOrderCollectionProxy<TKey, TValue> $flatMap
* @property-read HigherOrderCollectionProxy<TKey, TValue> $groupBy
* @property-read HigherOrderCollectionProxy<TKey, TValue> $keyBy
* @property-read HigherOrderCollectionProxy<TKey, TValue> $map
* @property-read HigherOrderCollectionProxy<TKey, TValue> $max
* @property-read HigherOrderCollectionProxy<TKey, TValue> $min
* @property-read HigherOrderCollectionProxy<TKey, TValue> $partition
* @property-read HigherOrderCollectionProxy<TKey, TValue> $percentage
* @property-read HigherOrderCollectionProxy<TKey, TValue> $reject
* @property-read HigherOrderCollectionProxy<TKey, TValue> $skipUntil
* @property-read HigherOrderCollectionProxy<TKey, TValue> $skipWhile
* @property-read HigherOrderCollectionProxy<TKey, TValue> $some
* @property-read HigherOrderCollectionProxy<TKey, TValue> $sortBy
* @property-read HigherOrderCollectionProxy<TKey, TValue> $sortByDesc
* @property-read HigherOrderCollectionProxy<TKey, TValue> $sum
* @property-read HigherOrderCollectionProxy<TKey, TValue> $takeUntil
* @property-read HigherOrderCollectionProxy<TKey, TValue> $takeWhile
* @property-read HigherOrderCollectionProxy<TKey, TValue> $unique
* @property-read HigherOrderCollectionProxy<TKey, TValue> $unless
* @property-read HigherOrderCollectionProxy<TKey, TValue> $until
* @property-read HigherOrderCollectionProxy<TKey, TValue> $when
*/
trait EnumeratesValues
{
Expand Down

0 comments on commit 439a8ac

Please sign in to comment.