| @@ 4932-4949 (lines=18) @@ | ||
| 4929 | * @psalm-param array<mixed,mixed>|array<TKey,T> ...$args |
|
| 4930 | * @psalm-return static<TKey,T> |
|
| 4931 | */ |
|
| 4932 | public function push(...$args) |
|
| 4933 | { |
|
| 4934 | $this->generatorToArray(); |
|
| 4935 | ||
| 4936 | if ( |
|
| 4937 | $this->checkPropertyTypes |
|
| 4938 | && |
|
| 4939 | $this->properties !== [] |
|
| 4940 | ) { |
|
| 4941 | foreach ($args as $key => $value) { |
|
| 4942 | $this->checkType($key, $value); |
|
| 4943 | } |
|
| 4944 | } |
|
| 4945 | ||
| 4946 | \array_push($this->array, ...$args); |
|
| 4947 | ||
| 4948 | return $this; |
|
| 4949 | } |
|
| 4950 | ||
| 4951 | /** |
|
| 4952 | * Get a random value from the current array. |
|
| @@ 6771-6788 (lines=18) @@ | ||
| 6768 | * @psalm-param array<mixed,mixed>|array<TKey,T> ...$args |
|
| 6769 | * @psalm-return static<TKey,T> |
|
| 6770 | */ |
|
| 6771 | public function unshift(...$args): self |
|
| 6772 | { |
|
| 6773 | $this->generatorToArray(); |
|
| 6774 | ||
| 6775 | if ( |
|
| 6776 | $this->checkPropertyTypes |
|
| 6777 | && |
|
| 6778 | $this->properties !== [] |
|
| 6779 | ) { |
|
| 6780 | foreach ($args as $key => $value) { |
|
| 6781 | $this->checkType($key, $value); |
|
| 6782 | } |
|
| 6783 | } |
|
| 6784 | ||
| 6785 | \array_unshift($this->array, ...$args); |
|
| 6786 | ||
| 6787 | return $this; |
|
| 6788 | } |
|
| 6789 | ||
| 6790 | /** |
|
| 6791 | * Tests whether the given closure return something valid for all elements of this array. |
|