@@ 4913-4930 (lines=18) @@ | ||
4910 | * @psalm-param array<mixed,mixed>|array<TKey,T> ...$args |
|
4911 | * @psalm-return static<TKey,T> |
|
4912 | */ |
|
4913 | public function push(...$args) |
|
4914 | { |
|
4915 | $this->generatorToArray(); |
|
4916 | ||
4917 | if ( |
|
4918 | $this->checkPropertyTypes |
|
4919 | && |
|
4920 | $this->properties !== [] |
|
4921 | ) { |
|
4922 | foreach ($args as $key => $value) { |
|
4923 | $this->checkType($key, $value); |
|
4924 | } |
|
4925 | } |
|
4926 | ||
4927 | \array_push($this->array, ...$args); |
|
4928 | ||
4929 | return $this; |
|
4930 | } |
|
4931 | ||
4932 | /** |
|
4933 | * Get a random value from the current array. |
|
@@ 6752-6769 (lines=18) @@ | ||
6749 | * @psalm-param array<mixed,mixed>|array<TKey,T> ...$args |
|
6750 | * @psalm-return static<TKey,T> |
|
6751 | */ |
|
6752 | public function unshift(...$args): self |
|
6753 | { |
|
6754 | $this->generatorToArray(); |
|
6755 | ||
6756 | if ( |
|
6757 | $this->checkPropertyTypes |
|
6758 | && |
|
6759 | $this->properties !== [] |
|
6760 | ) { |
|
6761 | foreach ($args as $key => $value) { |
|
6762 | $this->checkType($key, $value); |
|
6763 | } |
|
6764 | } |
|
6765 | ||
6766 | \array_unshift($this->array, ...$args); |
|
6767 | ||
6768 | return $this; |
|
6769 | } |
|
6770 | ||
6771 | /** |
|
6772 | * Tests whether the given closure return something valid for all elements of this array. |