{"record":{"id":"722b1ac1ef438e9b","repo":"briannesbitt/Carbon","slug":"rounding-is-only-possible-with-single-unit-interva","errorCode":null,"errorMessage":"Rounding is only possible with single unit intervals.","messagePattern":"Rounding is only possible with single unit intervals\\.","errorType":"exception","errorClass":"Carbon\\Exceptions\\InvalidIntervalException","httpStatus":null,"severity":"error","filePath":"src/Carbon/Traits/IntervalRounding.php","lineNumber":50,"sourceCode":"\n        if (\\in_array($action, ['round', 'floor', 'ceil'])) {\n            return $this->{$action.'Unit'}(substr($method, \\strlen($action)), ...$parameters);\n        }\n\n        return null;\n    }\n\n    protected function roundWith(DateInterval|string|float|int $precision, callable|string $function): ?static\n    {\n        $unit = 'second';\n\n        if ($precision instanceof DateInterval) {\n            $precision = CarbonInterval::instance($precision)->forHumans(['locale' => 'en']);\n        }\n\n        if (\\is_string($precision) && preg_match('/^\\s*(?<precision>\\d+)?\\s*(?<unit>\\w+)(?<other>\\W.*)?$/', $precision, $match)) {\n            if (trim($match['other'] ?? '') !== '') {\n                throw new InvalidIntervalException('Rounding is only possible with single unit intervals.');\n            }\n\n            $precision = (int) ($match['precision'] ?: 1);\n            $unit = $match['unit'];\n        }\n\n        return $this->roundUnit($unit, $precision, $function);\n    }\n}\n","sourceCodeStart":32,"sourceCodeEnd":60,"githubUrl":"https://github.com/briannesbitt/Carbon/blob/b13f05955dcfd7da71d60af745fd148cbdb73505/src/Carbon/Traits/IntervalRounding.php#L32-L60","documentation":"Error \"Rounding is only possible with single unit intervals.\" thrown in briannesbitt/Carbon.","triggerScenarios":"Thrown at src/Carbon/Traits/IntervalRounding.php:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b13f05955dcfd7da71d60af745fd148cbdb73505","analyzedAt":"2026-08-17T04:40:56.953Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}