@@ 5099-5116 (lines=18) @@ | ||
5096 | * @phpstan-param array<TKey,T> ...$args |
|
5097 | * @phpstan-return static<TKey,T> |
|
5098 | */ |
|
5099 | public function push(...$args) |
|
5100 | { |
|
5101 | $this->generatorToArray(); |
|
5102 | ||
5103 | if ( |
|
5104 | $this->checkPropertyTypes |
|
5105 | && |
|
5106 | $this->properties !== [] |
|
5107 | ) { |
|
5108 | foreach ($args as $key => $value) { |
|
5109 | $this->checkType($key, $value); |
|
5110 | } |
|
5111 | } |
|
5112 | ||
5113 | \array_push($this->array, ...$args); |
|
5114 | ||
5115 | return $this; |
|
5116 | } |
|
5117 | ||
5118 | /** |
|
5119 | * Get a random value from the current array. |
|
@@ 6974-6991 (lines=18) @@ | ||
6971 | * @phpstan-param array<TKey,T> ...$args |
|
6972 | * @phpstan-return static<TKey,T> |
|
6973 | */ |
|
6974 | public function unshift(...$args): self |
|
6975 | { |
|
6976 | $this->generatorToArray(); |
|
6977 | ||
6978 | if ( |
|
6979 | $this->checkPropertyTypes |
|
6980 | && |
|
6981 | $this->properties !== [] |
|
6982 | ) { |
|
6983 | foreach ($args as $key => $value) { |
|
6984 | $this->checkType($key, $value); |
|
6985 | } |
|
6986 | } |
|
6987 | ||
6988 | \array_unshift($this->array, ...$args); |
|
6989 | ||
6990 | return $this; |
|
6991 | } |
|
6992 | ||
6993 | /** |
|
6994 | * Tests whether the given closure return something valid for all elements of this array. |