| @@ 4995-5012 (lines=18) @@ | ||
| 4992 | * @psalm-param array<mixed,mixed>|array<TKey,T> ...$args |
|
| 4993 | * @psalm-return static<TKey,T> |
|
| 4994 | */ |
|
| 4995 | public function push(...$args) |
|
| 4996 | { |
|
| 4997 | $this->generatorToArray(); |
|
| 4998 | ||
| 4999 | if ( |
|
| 5000 | $this->checkPropertyTypes |
|
| 5001 | && |
|
| 5002 | $this->properties !== [] |
|
| 5003 | ) { |
|
| 5004 | foreach ($args as $key => $value) { |
|
| 5005 | $this->checkType($key, $value); |
|
| 5006 | } |
|
| 5007 | } |
|
| 5008 | ||
| 5009 | \array_push($this->array, ...$args); |
|
| 5010 | ||
| 5011 | return $this; |
|
| 5012 | } |
|
| 5013 | ||
| 5014 | /** |
|
| 5015 | * Get a random value from the current array. |
|
| @@ 6851-6868 (lines=18) @@ | ||
| 6848 | * @psalm-param array<TKey,T> ...$args |
|
| 6849 | * @psalm-return static<TKey,T> |
|
| 6850 | */ |
|
| 6851 | public function unshift(...$args): self |
|
| 6852 | { |
|
| 6853 | $this->generatorToArray(); |
|
| 6854 | ||
| 6855 | if ( |
|
| 6856 | $this->checkPropertyTypes |
|
| 6857 | && |
|
| 6858 | $this->properties !== [] |
|
| 6859 | ) { |
|
| 6860 | foreach ($args as $key => $value) { |
|
| 6861 | $this->checkType($key, $value); |
|
| 6862 | } |
|
| 6863 | } |
|
| 6864 | ||
| 6865 | \array_unshift($this->array, ...$args); |
|
| 6866 | ||
| 6867 | return $this; |
|
| 6868 | } |
|
| 6869 | ||
| 6870 | /** |
|
| 6871 | * Tests whether the given closure return something valid for all elements of this array. |
|