blob: f9744b818919204160851486ac97c935a4372fa2 [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3/**
4 * Thanks to https://github.com/flaushi for his suggestion:
5 * https://github.com/doctrine/dbal/issues/2873#issuecomment-534956358
6 */
7namespace Carbon\Doctrine;
8
9class DateTimeDefaultPrecision
10{
11 private static $precision = 6;
12
13 /**
14 * Change the default Doctrine datetime and datetime_immutable precision.
15 *
16 * @param int $precision
17 */
18 public static function set(int $precision): void
19 {
20 self::$precision = $precision;
21 }
22
23 /**
24 * Get the default Doctrine datetime and datetime_immutable precision.
25 *
26 * @return int
27 */
28 public static function get(): int
29 {
30 return self::$precision;
31 }
32}