Skip to content

Commit

Permalink
Adds work in progress regarding generic collections
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Aug 25, 2021
1 parent b93207f commit f409bbb
Show file tree
Hide file tree
Showing 8 changed files with 252 additions and 79 deletions.
12 changes: 6 additions & 6 deletions src/Illuminate/Collections/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ public function collapse()
* Determine if an item exists in the collection.
*
* @param (callable(TValue): bool)|TValue|string $key
* @param TValue|string|null $operator
* @param TValue|null $value
* @param mixed $operator
* @param mixed $value
* @return bool
*/
public function contains($key, $operator = null, $value = null)
Expand Down Expand Up @@ -378,7 +378,7 @@ public function first(callable $callback = null, $default = null)
* Get a flattened array of the items in the collection.
*
* @param int $depth
* @return static<TKey, TValue>
* @return static<int, mixed>
*/
public function flatten($depth = INF)
{
Expand Down Expand Up @@ -637,7 +637,7 @@ public function last(callable $callback = null, $default = null)
/**
* Get the values of a given key.
*
* @param string|array<int, string> $value
* @param string|array<array-key, string> $value
* @param string|null $key
* @return static<int, mixed>
*/
Expand Down Expand Up @@ -1135,8 +1135,8 @@ public function splitIn($numberOfGroups)
* Get the first item in the collection, but only if exactly one item exists. Otherwise, throw an exception.
*
* @param (callable(TValue, TKey): bool)|string $key
* @param TValue|string|null $operator
* @param TValue|null $value
* @param mixed $operator
* @param mixed $value
* @return TValue
*
* @throws \Illuminate\Support\ItemNotFoundException
Expand Down
26 changes: 13 additions & 13 deletions src/Illuminate/Collections/Enumerable.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ public function collapse();
/**
* Alias for the "contains" method.
*
* @param (callable(TValue): bool)|TValue|string $key
* @param TValue|string|null $operator
* @param TValue|null $value
* @param (callable(TValue, TKey): bool)|TValue|string $key
* @param mixed $operator
* @param mixed $value
* @return bool
*/
public function some($key, $operator = null, $value = null);
Expand All @@ -143,9 +143,9 @@ public function avg($callback = null);
/**
* Determine if an item exists in the enumerable.
*
* @param (callable(TValue): bool)|TValue|string $key
* @param TValue|string|null $operator
* @param TValue|null $value
* @param (callable(TValue, TKey): bool)|TValue|string $key
* @param mixed $operator
* @param mixed $value
* @return bool
*/
public function contains($key, $operator = null, $value = null);
Expand Down Expand Up @@ -264,8 +264,8 @@ public function eachSpread(callable $callback);
* Determine if all items pass the given truth test.
*
* @param (callable(TValue, TKey): bool)|TValue|string $key
* @param TValue|string|null $operator
* @param TValue|null $value
* @param mixed $operator
* @param mixed $value
* @return bool
*/
public function every($key, $operator = null, $value = null);
Expand Down Expand Up @@ -746,8 +746,8 @@ public function forPage($page, $perPage);
* Partition the collection into two arrays using the given callback or key.
*
* @param (callable(TValue, TKey): bool)|TValue|string $key
* @param TValue|string|null $operator
* @param TValue|null $value
* @param mixed $operator
* @param mixed $value
* @return array<int, static<TKey, TValue>>
*/
public function partition($key, $operator = null, $value = null);
Expand Down Expand Up @@ -867,8 +867,8 @@ public function split($numberOfGroups);
* Get the first item in the collection, but only if exactly one item exists. Otherwise, throw an exception.
*
* @param (callable(TValue, TKey): bool)|string $key
* @param TValue|string|null $operator
* @param TValue|null $value
* @param mixed $operator
* @param mixed $value
* @return TValue
*
* @throws \Illuminate\Support\ItemNotFoundException
Expand Down Expand Up @@ -997,7 +997,7 @@ public function pipe(callable $callback);
/**
* Get the values of a given key.
*
* @param string|array<int, string> $value
* @param string|array<array-key, string> $value
* @param string|null $key
* @return static<int, mixed>
*/
Expand Down
10 changes: 5 additions & 5 deletions src/Illuminate/Collections/Traits/EnumeratesValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ public function average($callback = null)
/**
* Alias for the "contains" method.
*
* @param (callable(TValue): bool)|TValue|string $key
* @param TValue|string|null $operator
* @param TValue|null $value
* @param (callable(TValue, TKey): bool)|TValue|string $key
* @param mixed $operator
* @param mixed $value
* @return bool
*/
public function some($key, $operator = null, $value = null)
Expand Down Expand Up @@ -277,8 +277,8 @@ public function eachSpread(callable $callback)
* Determine if all items pass the given truth test.
*
* @param (callable(TValue, TKey): bool)|TValue|string $key
* @param TValue|string|null $operator
* @param TValue|null $value
* @param mixed $operator
* @param mixed $value
* @return bool
*/
public function every($key, $operator = null, $value = null)
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Contracts/Queue/QueueableCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ public function getQueueableClass();
/**
* Get the identifiers for all of the entities.
*
* @return array
* @return array<int, mixed>
*/
public function getQueueableIds();

/**
* Get the relationships of the entities being queued.
*
* @return array
* @return array<int, string>
*/
public function getQueueableRelations();

Expand Down
Loading

0 comments on commit f409bbb

Please sign in to comment.