| @@ 5040-5057 (lines=18) @@ | ||
| 5037 | * @phpstan-param array<TKey,T> ...$args |
|
| 5038 | * @phpstan-return static<TKey,T> |
|
| 5039 | */ |
|
| 5040 | public function push(...$args) |
|
| 5041 | { |
|
| 5042 | $this->generatorToArray(); |
|
| 5043 | ||
| 5044 | if ( |
|
| 5045 | $this->checkPropertyTypes |
|
| 5046 | && |
|
| 5047 | $this->properties !== [] |
|
| 5048 | ) { |
|
| 5049 | foreach ($args as $key => $value) { |
|
| 5050 | $this->checkType($key, $value); |
|
| 5051 | } |
|
| 5052 | } |
|
| 5053 | ||
| 5054 | \array_push($this->array, ...$args); |
|
| 5055 | ||
| 5056 | return $this; |
|
| 5057 | } |
|
| 5058 | ||
| 5059 | /** |
|
| 5060 | * Get a random value from the current array. |
|
| @@ 6902-6919 (lines=18) @@ | ||
| 6899 | * @phpstan-param array<TKey,T> ...$args |
|
| 6900 | * @phpstan-return static<TKey,T> |
|
| 6901 | */ |
|
| 6902 | public function unshift(...$args): self |
|
| 6903 | { |
|
| 6904 | $this->generatorToArray(); |
|
| 6905 | ||
| 6906 | if ( |
|
| 6907 | $this->checkPropertyTypes |
|
| 6908 | && |
|
| 6909 | $this->properties !== [] |
|
| 6910 | ) { |
|
| 6911 | foreach ($args as $key => $value) { |
|
| 6912 | $this->checkType($key, $value); |
|
| 6913 | } |
|
| 6914 | } |
|
| 6915 | ||
| 6916 | \array_unshift($this->array, ...$args); |
|
| 6917 | ||
| 6918 | return $this; |
|
| 6919 | } |
|
| 6920 | ||
| 6921 | /** |
|
| 6922 | * Tests whether the given closure return something valid for all elements of this array. |
|