Code Duplication    Length = 18-18 lines in 2 locations

src/Arrayy.php 2 locations

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