| @@ 5079-5096 (lines=18) @@ | ||
| 5076 | * @phpstan-param array<TKey,T> ...$args |
|
| 5077 | * @phpstan-return static<TKey,T> |
|
| 5078 | */ |
|
| 5079 | public function push(...$args) |
|
| 5080 | { |
|
| 5081 | $this->generatorToArray(); |
|
| 5082 | ||
| 5083 | if ( |
|
| 5084 | $this->checkPropertyTypes |
|
| 5085 | && |
|
| 5086 | $this->properties !== [] |
|
| 5087 | ) { |
|
| 5088 | foreach ($args as $key => $value) { |
|
| 5089 | $this->checkType($key, $value); |
|
| 5090 | } |
|
| 5091 | } |
|
| 5092 | ||
| 5093 | \array_push($this->array, ...$args); |
|
| 5094 | ||
| 5095 | return $this; |
|
| 5096 | } |
|
| 5097 | ||
| 5098 | /** |
|
| 5099 | * Get a random value from the current array. |
|
| @@ 6949-6966 (lines=18) @@ | ||
| 6946 | * @phpstan-param array<TKey,T> ...$args |
|
| 6947 | * @phpstan-return static<TKey,T> |
|
| 6948 | */ |
|
| 6949 | public function unshift(...$args): self |
|
| 6950 | { |
|
| 6951 | $this->generatorToArray(); |
|
| 6952 | ||
| 6953 | if ( |
|
| 6954 | $this->checkPropertyTypes |
|
| 6955 | && |
|
| 6956 | $this->properties !== [] |
|
| 6957 | ) { |
|
| 6958 | foreach ($args as $key => $value) { |
|
| 6959 | $this->checkType($key, $value); |
|
| 6960 | } |
|
| 6961 | } |
|
| 6962 | ||
| 6963 | \array_unshift($this->array, ...$args); |
|
| 6964 | ||
| 6965 | return $this; |
|
| 6966 | } |
|
| 6967 | ||
| 6968 | /** |
|
| 6969 | * Tests whether the given closure return something valid for all elements of this array. |
|