Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Illuminate/Collections/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1732,7 +1732,9 @@ public function takeWhile($value)
* @template TMapValue
*
* @param callable(TValue, TKey): TMapValue $callback
* @return $this<TKey, TMapValue>
* @return $this
*
* @phpstan-this-out static<TKey, TMapValue>
*/
public function transform(callable $callback)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Pagination/AbstractCursorPaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ public function items()
* @template TThroughValue
*
* @param callable(TValue, TKey): TThroughValue $callback
* @return $this<TKey, TThroughValue>
* @return $this
*
* @phpstan-this-out static<TKey, TThroughValue>
*/
Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Pagination/AbstractPaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,9 @@ public function lastItem()
* @template TMapValue
*
* @param callable(TValue, TKey): TMapValue $callback
* @return $this<TKey, TMapValue>
* @return $this
*
* @phpstan-this-out static<TKey, TMapValue>
*/
public function through(callable $callback)
{
Expand Down
12 changes: 6 additions & 6 deletions types/Support/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1049,18 +1049,18 @@ function ($collection, $count) {
assertType('Illuminate\Support\Collection<int, User>', $collection->splice(1));
assertType('Illuminate\Support\Collection<int, User>', $collection->splice(1, 1, [new User]));

assertType('mixed', $collection->transform(function ($user, $int) {
assertType('Illuminate\Support\Collection<int, int>', $collection->transform(function ($user, $int): int {
assertType('User', $user);
assertType('int', $int);

return new User;
return $int * 2;
}));

assertType('mixed', $collection->transform(function ($user, $int): int {
assertType('User', $user);
assertType('int', $int);
assertType('Illuminate\Support\Collection<int, User>', $collection->transform(function ($value, $key) {
assertType('int', $value);
assertType('int', $key);

return $int * 2;
return new User;
}));

assertType('Illuminate\Support\Collection<int, User>', $collection->add(new User));
Expand Down