Repository: laravel/framework
File: src/Illuminate/Database/Query/Builder.php (PHP)

Code before:
    {
        $type = 'between';

        if ($this->isQueryable($column)) {
            [$sub, $bindings] = $this->createSub($column);

            return $this->addBinding($bindings, 'where')
                ->whereBetween(new Expression('('.$sub.')'), $values, $boolean, $not);
        }

        if ($values instanceof \DatePeriod) {
            $values = $this->resolveDatePeriodBounds($values);
        }

        $this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not');

        $this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'where');

        return $this;
    }

    /**
     * Resolve the start and end dates from a DatePeriod.
     *
     * @param  \DatePeriod  $period
     * @return array
     */
    protected function resolveDatePeriodBounds(\DatePeriod $period)
    {
        $start = $period->getStartDate();
        $end = $period->getEndDate();

        if ($end === null) {
            $end = clone $start;

            for ($i = 0; $i < $period->getRecurrences(); $i++) {
                $end = $end->add($period->getDateInterval());
            }
        }

        return [$start, $end];
    }

    /**
     * Add a "where between" statement using columns to the query.
     *
     * @param  \Illuminate\Contracts\Database\Query\Expression|string  $column
     * @param  string  $boolean
     * @param  bool  $not
     * @return $this
     */

Review comment (suggestion):
You could define a tuple here:

```suggestion
     * @return array{\DateTimeInterface, \DateTimeInterface}
```

Code after:
    public function whereBetween($column, iterable $values, $boolean = 'and', $not = false)
    {
        $type = 'between';

        if ($this->isQueryable($column)) {
            [$sub, $bindings] = $this->createSub($column);

            return $this->addBinding($bindings, 'where')
                ->whereBetween(new Expression('('.$sub.')'), $values, $boolean, $not);
        }

        if ($values instanceof DatePeriod) {
            $values = $this->resolveDatePeriodBounds($values);
        }

        $this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not');

        $this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'where');

        return $this;
    }

    /**
     * Add a "where between" statement using columns to the query.
     *
     * @param  \Illuminate\Contracts\Database\Query\Expression|string  $column
     * @param  string  $boolean
     * @param  bool  $not
     * @return $this
     */
    public function whereBetweenColumns($column, array $values, $boolean = 'and', $not = false)
    {
        $type = 'betweenColumns';

        if ($this->isQueryable($column)) {
            [$sub, $bindings] = $this->createSub($column);

            return $this->addBinding($bindings, 'where')
                ->whereBetweenColumns(new Expression('('.$sub.')'), $values, $boolean, $not);
        }

        $this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not');

        return $this;
    }

    /**
     * Add an "or where between" statement to the query.
     *
     * @param  \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder<*>|\Illuminate\Contracts\Database\Query\Expression|string  $column
     * @return $this