Code Duplication    Length = 18-18 lines in 2 locations

src/Arrayy.php 2 locations

@@ 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.
@@ 6948-6965 (lines=18) @@
6945
     * @phpstan-param  array<TKey,T> ...$args
6946
     * @phpstan-return static<TKey,T>
6947
     */
6948
    public function unshift(...$args): self
6949
    {
6950
        $this->generatorToArray();
6951
6952
        if (
6953
            $this->checkPropertyTypes
6954
            &&
6955
            $this->properties !== []
6956
        ) {
6957
            foreach ($args as $key => $value) {
6958
                $this->checkType($key, $value);
6959
            }
6960
        }
6961
6962
        \array_unshift($this->array, ...$args);
6963
6964
        return $this;
6965
    }
6966
6967
    /**
6968
     * Tests whether the given closure return something valid for all elements of this array.