diff --git a/src/Carbon/Traits/Localization.php b/src/Carbon/Traits/Localization.php index c83b0291d..4c09e1a63 100644 --- a/src/Carbon/Traits/Localization.php +++ b/src/Carbon/Traits/Localization.php @@ -38,7 +38,6 @@ trait Localization */ protected $localTranslator; - /** * Options for diffForHumans(). * @@ -49,7 +48,6 @@ trait Localization /** * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. * You should rather use the ->settings() method. - * * @see settings * * @param int $humanDiffOptions @@ -62,7 +60,6 @@ public static function setHumanDiffOptions($humanDiffOptions) /** * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. * You should rather use the ->settings() method. - * * @see settings * * @param int $humanDiffOption @@ -75,7 +72,6 @@ public static function enableHumanDiffOption($humanDiffOption) /** * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. * You should rather use the ->settings() method. - * * @see settings * * @param int $humanDiffOption diff --git a/src/Carbon/Traits/Options.php b/src/Carbon/Traits/Options.php index aaebd75bc..f380e6b3a 100644 --- a/src/Carbon/Traits/Options.php +++ b/src/Carbon/Traits/Options.php @@ -11,8 +11,6 @@ namespace Carbon\Traits; -use Carbon\Carbon; -use Carbon\CarbonImmutable; use Carbon\CarbonInterface; /** @@ -22,7 +20,7 @@ * * Depends on the following methods: * - * @method static Carbon|CarbonImmutable setTimezone + * @method \Carbon\Carbon|\Carbon\CarbonImmutable setTimezone($timezone) Set the timezone */ trait Options { @@ -165,7 +163,6 @@ trait Options /** * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. * You should rather use the ->settings() method. - * * @see settings * * Enable the strict mode (or disable with passing false). @@ -193,7 +190,6 @@ public static function isStrictModeEnabled() * You should rather use the ->settings() method. * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants * are available for quarters, years, decade, centuries, millennia (singular and plural forms). - * * @see settings * * Indicates if months should be calculated with overflow. @@ -212,7 +208,6 @@ public static function useMonthsOverflow($monthsOverflow = true) * You should rather use the ->settings() method. * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants * are available for quarters, years, decade, centuries, millennia (singular and plural forms). - * * @see settings * * Reset the month overflow behavior. @@ -239,7 +234,6 @@ public static function shouldOverflowMonths() * You should rather use the ->settings() method. * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants * are available for quarters, years, decade, centuries, millennia (singular and plural forms). - * * @see settings * * Indicates if years should be calculated with overflow. @@ -258,7 +252,6 @@ public static function useYearsOverflow($yearsOverflow = true) * You should rather use the ->settings() method. * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants * are available for quarters, years, decade, centuries, millennia (singular and plural forms). - * * @see settings * * Reset the month overflow behavior. diff --git a/src/Carbon/Traits/Units.php b/src/Carbon/Traits/Units.php index 53b5fb063..e612b38c2 100644 --- a/src/Carbon/Traits/Units.php +++ b/src/Carbon/Traits/Units.php @@ -217,7 +217,11 @@ public function addUnit($unit, $value = 1, $overflow = null) } elseif ($canOverflow = in_array($unit, [ 'month', 'year', - ]) && ($overflow === false || ($overflow === null && !($this->{'local'.($ucUnit = ucfirst($unit).'s').'Overflow'} ?? static::{'shouldOverflow'.$ucUnit}())))) { + ]) && ($overflow === false || ( + $overflow === null && + ($ucUnit = ucfirst($unit).'s') && + !($this->{'local'.$ucUnit.'Overflow'} ?? static::{'shouldOverflow'.$ucUnit}()) + ))) { $day = $date->day; } diff --git a/tests/Factory/FactoryTest.php b/tests/Factory/FactoryTest.php index 1637ceda8..9b528f24b 100644 --- a/tests/Factory/FactoryTest.php +++ b/tests/Factory/FactoryTest.php @@ -48,4 +48,3 @@ public function testFactory() $this->assertSame('01/01/2018', $factory->parse('2018-01-01')->format('d/m/Y')); } } -