briannesbitt/Carbon · error · BadMethodCallException

->$method() cannot be called on an interval with a step

Error message

->$method() cannot be called on an interval with a step

What it means

Error "->$method() cannot be called on an interval with a step" thrown in briannesbitt/Carbon.

Source

Thrown at src/Carbon/Traits/IntervalStep.php:108

        }

        return Carbon::instance($dateTime);
    }

    private function carbonOrResolve(mixed $dateTime): CarbonInterface
    {
        return $dateTime instanceof CarbonInterface
            ? $dateTime
            : $this->resolveCarbon($dateTime);
    }

    private function checkNoStepIsDefined(string $method): void
    {
        if ($this->step !== null) {
            $chunks = explode('::', $method, 2);
            $method = $chunks[1] ?? $method;

            throw new BadMethodCallException(
                "->$method() cannot be called on an interval with a step",
            );
        }
    }
}

View on GitHub (pinned to b13f05955d)

When it happens

Trigger: Thrown at src/Carbon/Traits/IntervalStep.php:108 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of briannesbitt/Carbon@b13f05955d (2026-08-17). Data as JSON: /api/errors/44a52cbbc8a91a7c. Report an issue: GitHub.