8000 [9.x] Improves `Support\Collection` and `Database\Eloquent\Collection` type definitions by nunomaduro · Pull Request #38538 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

[9.x] Improves Support\Collection and Database\Eloquent\Collection type definitions #38538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Aug 27, 2021
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3ad9429
Adds CI workflow
nunomaduro Aug 11, 2021
b13559b
Adds phpstan
nunomaduro Aug 11, 2021
4a17695
Adds work in progress regarding generic collections
nunomaduro Aug 11, 2021
0d92200
Fixes missing template
nunomaduro Aug 11, 2021
c47728b
Renames template
nunomaduro Aug 11, 2021
d56156c
Updates test
nunomaduro Aug 11, 2021
ab0058a
Apply fixes from StyleCI
taylorotwell Aug 11, 2021
97b71ac
Adds work in progress regarding generic collections
nunomaduro Aug 12, 2021
09b77c3
Adds work in progress regarding generic collections
nunomaduro Aug 13, 2021
acf574e
Adds work in progress regarding generic collections
nunomaduro Aug 13, 2021
338110d
Adds work in progress regarding generic collections
nunomaduro Aug 21, 2021
36ab22b
Adds work in progress regarding generic collections
nunomaduro Aug 23, 2021
a35ddcb
Styling
nunomaduro Aug 23, 2021
e249f05
Apply fixes from StyleCI
taylorotwell Aug 23, 2021
b93207f
Apply fixes from StyleCI
taylorotwell Aug 23, 2021
f409bbb
Adds work in progress regarding generic collections
nunomaduro Aug 24, 2021
d6c4291
Remove work on Models
nunomaduro Aug 25, 2021
dfcadb6
Revert "Remove work on Models"
nunomaduro Aug 25, 2021
449a374
Removes `prefer-lowest`
nunomaduro Aug 25, 2021
4aa15ab
Removes non needed code on CI job
nunomaduro Aug 25, 2021
8c14725
Fixes `Eloquent\Collection::load` types
nunomaduro Aug 25, 2021
f7430a9
Adds work in progress regarding generic collections
nunomaduro Aug 25, 2021
1c4f459
Fixes `Eloquent\Collection::load` related methods
nunomaduro Aug 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adds work in progress regarding generic collections
  • Loading branch information
nunomaduro committed Aug 25, 2021
commit 338110d868f557656aad4f29d0111fa66b78c4b9
36 changes: 18 additions & 18 deletions src/Illuminate/Collections/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ public function flip()
* @param string|array $keys
* @return $this
*/
public function forget($keys)
public function forget($keys) // TODO
{
foreach ((array) $keys as $key) {
$this->offsetUnset($key);
Expand Down Expand Up @@ -817,7 +817,7 @@ public function only($keys)
* @param int $count
* @return mixed
*/
public function pop($count = 1)
public function pop($count = 1) // TODO
{
if ($count === 1) {
return array_pop($this->items);
Expand Down Expand Up @@ -845,7 +845,7 @@ public function pop($count = 1)
* @param mixed $key
* @return $this
*/
public function prepend($value, $key = null)
public function prepend($value, $key = null) // TODO
{
$this->items = Arr::prepend($this->items, ...func_get_args());

Expand All @@ -858,7 +858,7 @@ public function prepend($value, $key = null)
* @param ...TValue $values
* @return $this
*/
public function push(...$values)
public function push(...$values) // TODO
{
foreach ($values as $value) {
$this->items[] = $value;
Expand Down Expand Up @@ -891,7 +891,7 @@ public function concat($source)
* @param mixed $default
* @return mixed
*/
public function pull($key, $default = null)
public function pull($key, $default = null) // TODO
{
return Arr::pull($this->items, $key, $default);
}
Expand All @@ -903,7 +903,7 @@ public function pull($key, $default = null)
* @param mixed $value
* @return $this
*/
public function put($key, $value)
public function put($key, $value) // TODO
{
$this->offsetSet($key, $value);

Expand Down Expand Up @@ -987,7 +987,7 @@ public function search($value, $strict = false)
* @param int $count
* @return mixed
*/
public function shift($count = 1)
public function shift($count = 1) // TODO
{
if ($count === 1) {
return array_shift($this->items);
Expand Down Expand Up @@ -1026,7 +1026,7 @@ public function shuffle($seed = null)
* @param int $step
* @return static
*/
public function sliding($size = 2, $step = 1)
public function sliding($size = 2, $step = 1) // TODO
{
$chunks = floor(($this->count() - $size) / $step) + 1;

Expand Down Expand Up @@ -1123,7 +1123,7 @@ public function split($numberOfGroups)
* @param int $numberOfGroups
* @return static
*/
public function splitIn($numberOfGroups)
public function splitIn($numberOfGroups) // TODO
{
return $this->chunk(ceil($this->count() / $numberOfGroups));
}
Expand Down Expand Up @@ -1378,7 +1378,7 @@ public function sortKeysDesc($options = SORT_REGULAR)
* @param mixed $replacement
* @return static
*/
public function splice($offset, $length = null, $replacement = [])
public function splice($offset, $length = null, $replacement = []) // TODO
{
if (func_num_args() === 1) {
return new static(array_splice($this->items, $offset));
Expand Down Expand Up @@ -1430,7 +1430,7 @@ public function takeWhile($value)
* @param callable $callback
* @return $this
*/
public function transform(callable $callback)
public function transform(callable $callback) // TODO
{
$this->items = $this->map($callback)->all();

Expand Down Expand Up @@ -1491,7 +1491,7 @@ public function pad($size, $value)
* @return \ArrayIterator
*/
#[\ReturnTypeWillChange]
public function getIterator()
public function getIterator() // TODO
{
return new ArrayIterator($this->items);
}
Expand Down Expand Up @@ -1524,7 +1524,7 @@ public function countBy($countBy = null)
* @param mixed $item
* @return $this
*/
public function add($item)
public function add($item) // TODO
{
$this->items[] = $item;

Expand All @@ -1536,7 +1536,7 @@ public function add($item)
*
* @return \Illuminate\Support\Collection
*/
public function toBase()
public function toBase() // TODO
{
return new self($this);
}
Expand All @@ -1548,7 +1548,7 @@ public function toBase()
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($key)
public function offsetExists($key) // TODO
{
return isset($this->items[$key]);
}
Expand All @@ -1560,7 +1560,7 @@ public function offsetExists($key)
* @return mixed
*/
#[\ReturnTypeWillChange]
public function offsetGet($key)
public function offsetGet($key) // TODO
{
return $this->items[$key];
}
Expand All @@ -1573,7 +1573,7 @@ public function offsetGet($key)
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetSet($key, $value)
public function offsetSet($key, $value) // TODO
{
if (is_null($key)) {
$this->items[] = $value;
Expand All @@ -1589,7 +1589,7 @@ public function offsetSet($key, $value)
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetUnset($key)
public function offsetUnset($key) // TODO
{
unset($this->items[$key]);
}
Expand Down
0