Code Duplication    Length = 18-18 lines in 2 locations

src/Arrayy.php 2 locations

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