Skip to content

Commit

Permalink
Fix incorrect PHPDoc for KeyBy and GroupBy (#52918)
Browse files Browse the repository at this point in the history
  • Loading branch information
kayw-geek authored Sep 25, 2024
1 parent 86fa45e commit 6a3a8b2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 0 additions & 2 deletions phpstan.types.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ parameters:
level: max
paths:
- types
ignoreErrors:
- identifier: argument.templateType
4 changes: 2 additions & 2 deletions src/Illuminate/Collections/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ public function getOrPut($key, $value)
*
* @param (callable(TValue, TKey): TGroupKey)|array|string $groupBy
* @param bool $preserveKeys
* @return static<TGroupKey, static<($preserveKeys is true ? TKey : int), TValue>>
* @return static<($groupBy is string ? array-key : ($groupBy is array ? array-key : TGroupKey)), static<($preserveKeys is true ? TKey : int), TValue>>
*/
public function groupBy($groupBy, $preserveKeys = false)
{
Expand Down Expand Up @@ -542,7 +542,7 @@ public function groupBy($groupBy, $preserveKeys = false)
* @template TNewKey of array-key
*
* @param (callable(TValue, TKey): TNewKey)|array|string $keyBy
* @return static<TNewKey, TValue>
* @return static<($keyBy is string ? array-key : ($keyBy is array ? array-key : TNewKey)), TValue>
*/
public function keyBy($keyBy)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Collections/Enumerable.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ public function get($key, $default = null);
*
* @param (callable(TValue, TKey): TGroupKey)|array|string $groupBy
* @param bool $preserveKeys
* @return static<TGroupKey, static<($preserveKeys is true ? TKey : int), TValue>>
* @return static<($groupBy is string ? array-key : ($groupBy is array ? array-key : TGroupKey)), static<($preserveKeys is true ? TKey : int), TValue>>
*/
public function groupBy($groupBy, $preserveKeys = false);

Expand All @@ -532,7 +532,7 @@ public function groupBy($groupBy, $preserveKeys = false);
* @template TNewKey of array-key
*
* @param (callable(TValue, TKey): TNewKey)|array|string $keyBy
* @return static<TNewKey, TValue>
* @return static<($keyBy is string ? array-key : ($keyBy is array ? array-key : TNewKey)), TValue>
*/
public function keyBy($keyBy);

Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Collections/LazyCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ public function get($key, $default = null)
*
* @param (callable(TValue, TKey): TGroupKey)|array|string $groupBy
* @param bool $preserveKeys
* @return static<TGroupKey, static<($preserveKeys is true ? TKey : int), TValue>>
* @return static<($groupBy is string ? array-key : ($groupBy is array ? array-key : TGroupKey)), static<($preserveKeys is true ? TKey : int), TValue>>
*/
public function groupBy($groupBy, $preserveKeys = false)
{
Expand All @@ -561,7 +561,7 @@ public function groupBy($groupBy, $preserveKeys = false)
* @template TNewKey of array-key
*
* @param (callable(TValue, TKey): TNewKey)|array|string $keyBy
* @return static<TNewKey, TValue>
* @return static<($keyBy is string ? array-key : ($keyBy is array ? array-key : TNewKey)), TValue>
*/
public function keyBy($keyBy)
{
Expand Down

0 comments on commit 6a3a8b2

Please sign in to comment.