briannesbitt / Carbon

Compare db8e68c ... +0 ... d37c3df

Coverage Reach
Lang/uk.php Lang/be.php Lang/ru.php Lang/lv.php Lang/pl.php Lang/hu.php Lang/ka.php Lang/sl.php Lang/mk.php Lang/sr.php Lang/sr_Cyrl_ME.php Lang/bg.php Lang/sr_Cyrl.php Lang/lt.php Lang/pt.php Lang/fr.php Lang/ca.php Lang/cs.php Lang/it.php Lang/es.php Lang/hr.php Lang/az.php Lang/zh_Hant.php Lang/zh_Hans.php Lang/ms.php Lang/gl.php Lang/en.php Lang/bs.php Lang/nl.php Lang/tr.php Lang/hy.php Lang/ta.php Lang/el.php Lang/oc.php Lang/bn.php Lang/ja.php Lang/ko.php Lang/id.php Lang/te.php Lang/lb.php Lang/sv.php Lang/kk.php Lang/af.php Lang/ar_MA.php Lang/he.php Lang/sr_Latn_ME.php Lang/ky.php Lang/ar_LY.php Lang/tk_TM.php Lang/ar_KW.php Lang/ar_Shakl.php Lang/ga.php Lang/ar.php Lang/ar_SA.php Lang/ar_DZ.php Lang/ar_TN.php Lang/gu.php Lang/mr.php Lang/ne.php Lang/fy.php Lang/hi.php Lang/gd.php Lang/ug.php Lang/br.php Lang/tg.php Lang/gom_Latn.php Lang/ml.php Lang/cy.php Lang/si.php Lang/ss.php Lang/ur.php Lang/dv_MV.php Lang/kn.php Lang/pa.php Lang/jv.php Lang/bo.php Lang/cv.php Lang/tlh.php Lang/ku.php Lang/dv.php Lang/sd.php Lang/nds_DE.php Lang/ve_ZA.php Lang/sr_Latn_BA.php Lang/es_PH.php Lang/es_PY.php Lang/en_SD.php Lang/yuw_PG.php Lang/en_AI.php Lang/dua.php Lang/fil_PH.php Lang/fr_TN.php Lang/en_VU.php Lang/es_PR.php Lang/asa.php Lang/sd_IN.php Lang/ses.php Lang/wa_BE.php Lang/pa_Guru.php Lang/szl_PL.php Lang/en_LC.php Lang/ar_IQ.php Lang/qu_EC.php Lang/zh_MO.php Lang/sw_TZ.php Lang/ta_MY.php Lang/fy_DE.php Lang/ff_MR.php Lang/mua.php Lang/en_CY.php Lang/en_LR.php Lang/es_SV.php Lang/es_CO.php Lang/wae_CH.php Lang/raj_IN.php Lang/nan_TW@latin.php Lang/az_AZ.php Lang/nr_ZA.php Lang/ks_IN.php Lang/ber_MA.php Lang/ksf.php Lang/sid_ET.php Lang/ko_KP.php Lang/ht_HT.php Lang/ca_FR.php Lang/ha.php Lang/az_Cyrl.php Lang/ksh.php Lang/pt_MZ.php Lang/ksb.php Lang/es_HN.php Lang/ar_OM.php Lang/fr_TD.php Lang/fo_DK.php Lang/en_SX.php Lang/ki.php Lang/sg.php Lang/teo_KE.php Lang/zh_YUE.php Lang/ar_DJ.php Lang/quz_PE.php Lang/en_PN.php Lang/mni_IN.php Lang/en_GB.php Lang/sr_Latn_XK.php Lang/de_AT.php Lang/uz_Arab.php Lang/ta_LK.php Lang/gv_GB.php Lang/kam.php Lang/prg.php Lang/ln_CG.php Lang/yue_HK.php Lang/sw_KE.php Lang/en_DG.php Lang/tn_ZA.php Lang/en_TO.php Lang/unm_US.php Lang/lzh_TW.php Lang/lij_IT.php Lang/en_TC.php Lang/ca_AD.php Lang/hy_AM.php Lang/es_MX.php Lang/en_SG.php Lang/fr_SY.php Lang/en_KY.php Lang/seh.php Lang/en_AT.php Lang/en_KN.php Lang/en_DE.php Lang/bo_IN.php Lang/bho_IN.php Lang/es_BR.php Lang/li_NL.php Lang/uz_UZ.php Lang/en_GY.php Lang/ks_IN@devanagari.php Lang/ta_SG.php Lang/en_KI.php Lang/mer.php Lang/en_SL.php Lang/ee_TG.php Lang/aa_ER@saaho.php Lang/es_IC.php Lang/zh_CN.php Lang/es_PA.php Lang/doi_IN.php Lang/mgo.php Lang/sa_IN.php Lang/rof.php Lang/kea.php Lang/yav.php Lang/en_ZM.php Lang/es_CR.php Lang/vai_Latn.php Lang/ro_MD.php Lang/sn.php Lang/rwk.php Lang/en_SI.php Lang/en_SZ.php Lang/en_MY.php Lang/luo.php Lang/ur_PK.php Lang/gsw_LI.php Lang/en_NU.php Lang/en_NG.php Lang/ar_QA.php Lang/en_VG.php Lang/es_US.php Lang/ar_SS.php Lang/hne_IN.php Lang/hr_BA.php Lang/be_BY@latin.php Lang/es_BZ.php Lang/shs_CA.php Lang/en_SE.php Lang/agq.php Lang/es_UY.php Lang/kl_GL.php Lang/ln_AO.php Lang/lg_UG.php Lang/ar_TD.php Lang/en_ISO.php Lang/en_NA.php Lang/haw.php Lang/fr_CH.php Lang/jmc.php Lang/en_UG.php Lang/en_NZ.php Lang/ar_PS.php Lang/en_CX.php Lang/en_AG.php Lang/sm_WS.php Lang/an_ES.php Lang/de_LU.php Lang/en_GI.php Lang/be_BY.php Lang/ru_UA.php Lang/ar_JO.php Lang/tpi_PG.php Lang/fr_DJ.php Lang/fr_VU.php Lang/es_CU.php Lang/en_VC.php Lang/wal_ET.php Lang/el_GR.php Lang/nb_SJ.php Lang/en_MP.php Lang/ff.php Lang/ar_AE.php Lang/jgo.php Lang/pa_Arab.php Lang/en_IE.php Lang/shn_MM.php Lang/ayc_PE.php Lang/az_Latn.php Lang/mg_MG.php Lang/byn_ER.php Lang/nan_TW.php Lang/lag.php Lang/lrc.php Lang/kkj.php Lang/shi.php Lang/en_NF.php Lang/dz_BT.php Lang/en_IM.php Lang/saq.php Lang/en_NL.php Lang/ca_IT.php Lang/bn_IN.php Lang/gez_ER.php Lang/en_FM.php Lang/es_CL.php Lang/fr_CM.php Lang/ast.php Lang/en_GM.php Lang/en_PW.php Lang/en_GG.php Lang/ar_IL.php Lang/ar_ER.php Lang/sv_AX.php Lang/ln_CF.php Lang/gsw_FR.php Lang/sgs_LT.php Lang/en_ER.php Lang/mzn.php Lang/en_BI.php Lang/vai.php Lang/az_IR.php Lang/ti_ER.php Lang/uz_Cyrl.php Lang/ewo.php Lang/rn.php Lang/bn_BD.php Lang/sq_XK.php Lang/es_EA.php Lang/kde.php Lang/pa_PK.php Lang/mas_TZ.php Lang/en_IO.php Lang/yo_BJ.php Lang/ebu.php Lang/en_JE.php Lang/lu.php Lang/en_CH.php Lang/en_TK.php Lang/ce_RU.php Lang/en_RW.php Lang/cgg.php Lang/en_IL.php Lang/naq.php Lang/ar_MR.php Lang/xog.php Lang/sq_MK.php Lang/en_BB.php Lang/mgh.php Lang/en_BM.php Lang/en_TZ.php Lang/bez.php Lang/fy_NL.php Lang/ccp_IN.php Lang/fa_AF.php Lang/es_NI.php Lang/shi_Latn.php Lang/vo.php Lang/zh_SG.php Lang/ms_SG.php Lang/se_FI.php Lang/ig_NG.php Lang/el_CY.php Lang/ar_YE.php Lang/es_419.php Lang/en_AU.php Lang/en_PH.php Lang/agr_PE.php Lang/xh_ZA.php Lang/en_FJ.php Lang/en_CK.php Lang/en_ZA.php Lang/zu_ZA.php Lang/am_ET.php Lang/hak_TW.php Lang/ccp.php Lang/es_VE.php Lang/pt_BR.php Lang/ia_FR.php Lang/sah_RU.php Lang/mhr_RU.php Lang/so_DJ.php Lang/aa_ET.php Lang/nl_BE.php Lang/en_SC.php Lang/sc_IT.php Lang/st_ZA.php Lang/khq.php Lang/ii.php Lang/af_NA.php Lang/nso_ZA.php Lang/nd.php Lang/en_PG.php Lang/mjw_IN.php Lang/ar_KM.php Lang/ln.php Lang/yi_US.php Lang/ar_SD.php Lang/cu.php Lang/es_EC.php Lang/en_TV.php Lang/es_GQ.php Lang/en_NR.php Lang/pt_PT.php Lang/en_MW.php Lang/en_DK.php Lang/kw_GB.php Lang/ber_DZ.php Lang/en_FI.php Lang/ik_CA.php Lang/es_PE.php Lang/nyn.php Lang/niu_NU.php Lang/ar_LB.php Lang/es_GT.php Lang/tcy_IN.php Lang/fr_LU.php Lang/sr_Cyrl_XK.php Lang/fr_MR.php Lang/fr_MA.php Lang/hif_FJ.php Lang/aa_ER.php Lang/en_CC.php Lang/gez_ET.php Lang/anp_IN.php Lang/iu_CA.php Lang/ak_GH.php Lang/en_150.php Lang/en_IN.php Lang/es_BO.php Lang/nmg.php Lang/en_MU.php Lang/nl_NL.php Lang/nnh.php Lang/hsb_DE.php Lang/sbp.php Lang/en_LS.php Lang/aa_DJ.php Lang/zh.php Lang/dje.php Lang/fr_DZ.php Lang/en_FK.php Lang/os_RU.php Lang/ts_ZA.php Lang/bs_Cyrl.php Lang/om.php Lang/nl_AW.php Lang/smn.php Lang/en_MG.php Lang/mas.php Lang/en_GD.php Lang/ne_IN.php Lang/kab_DZ.php Lang/miq_NI.php Lang/as_IN.php Lang/om_KE.php Lang/bem_ZM.php Lang/tig_ER.php Lang/mai_IN.php Lang/kok_IN.php Lang/tt_RU@iqtelif.php Lang/rm.php Lang/brx_IN.php Lang/ar_SO.php Lang/uz_UZ@cyrillic.php Lang/bi_VU.php Lang/da_GL.php Lang/en_CM.php Lang/ee.php Lang/en_SH.php Lang/nhn_MX.php Lang/fr_CA.php Lang/qu.php Lang/bas.php Lang/cmn_TW.php Lang/teo.php Lang/iw.php Lang/nds_NL.php Lang/twq.php Lang/sw_CD.php Lang/tr_CY.php Lang/nus.php Lang/ar_BH.php Lang/chr_US.php Lang/de_CH.php Lang/qu_BO.php Lang/i18n.php Lang/mag_IN.php Lang/sw_UG.php Lang/ar_EG.php Lang/es_DO.php Lang/en_GH.php Lang/de_BE.php Lang/to_TO.php Lang/bs_Latn.php Lang/sr_Cyrl_BA.php Lang/en_001.php Lang/vun.php Lang/lkt.php Lang/dsb_DE.php Lang/dyo.php Lang/the_NP.php Lang/fr_BE.php Lang/pt_MO.php Lang/lrc_IQ.php Lang/en_SB.php Lang/ur_IN.php Lang/ms_BN.php Lang/en_SS.php Lang/ca_ES_Valencia.php Lang/guz.php Lang/no.php Lang/rw_RW.php Lang/bhb_IN.php Lang/sd_IN@devanagari.php Lang/crh_UA.php Lang/en_MS.php Lang/en_HK.php Lang/ar_EH.php Lang/ar_IN.php Lang/sat_IN.php Lang/en_CA.php Lang/luy.php Lang/kln.php Lang/ta_IN.php Lang/ti_ET.php Lang/es_AR.php Lang/dav.php Lang/mfe_MU.php Lang/it_CH.php Lang/ar_SY.php Lang/en_BE.php Lang/en_MT.php Lang/fur.php Lang/sr_RS@latin.php Lang/fr_CG.php Lang/et.php Lang/wal.php Lang/iu.php Lang/cmn.php Lang/ayc.php Lang/zgh.php Lang/as.php Lang/th_TH.php Lang/oc_FR.php Lang/bm.php Lang/lo_LA.php Lang/fr_NE.php Lang/uz_Latn.php Lang/hif.php Lang/de.php Lang/ast_ES.php Lang/cs_CZ.php Lang/yi.php Lang/so_SO.php Lang/gez.php Lang/unm.php Lang/eu.php Lang/mi.php Lang/crh.php Lang/tpi.php Lang/my.php Lang/mi_NZ.php Lang/ro_RO.php Lang/mhr.php Lang/da_DK.php Lang/tzl.php Lang/ru_KZ.php Lang/ss_ZA.php Lang/mg.php Lang/ru_BY.php Lang/ve.php Lang/ps.php Lang/ml_IN.php Lang/wo.php Lang/anp.php Lang/fa_IR.php Lang/so.php Lang/zh_Hans_MO.php Lang/nl_SR.php Lang/fr_RW.php Lang/pt_CH.php Lang/it_IT.php Lang/lv_LV.php Lang/tig.php Lang/sc.php Lang/li.php Lang/or.php Lang/en_WS.php Lang/pap_CW.php Lang/yo_NG.php Lang/bg_BG.php Lang/fo_FO.php Lang/fr_ML.php Lang/pap.php Lang/zh_TW.php Lang/lzh.php Lang/sh.php Lang/the.php Lang/gsw_CH.php Lang/quz.php Lang/ru_MD.php Lang/en_BW.php Lang/pap_AW.php Lang/nhn.php Lang/en_DM.php Lang/is_IS.php Lang/en_GU.php Lang/gd_GB.php Lang/fr_FR.php Lang/da.php Lang/de_LI.php Lang/mai.php Lang/fi.php Lang/es_ES.php Lang/fr_HT.php Lang/uz.php Lang/kab.php Lang/ko_KR.php Lang/fr_WF.php Lang/ja_JP.php Lang/ber.php Lang/km_KH.php Lang/mk_MK.php Lang/pa_IN.php Lang/fr_NC.php Lang/wo_SN.php Lang/nan.php Lang/pl_PL.php Lang/am.php Lang/pt_TL.php Lang/bhb.php Lang/en_BS.php Lang/nds.php Lang/fr_MF.php Lang/ht.php Lang/gsw.php Lang/gl_ES.php Lang/ia.php Lang/en_US_Posix.php Lang/tzm_Latn.php Lang/sr_RS.php Lang/sk.php Lang/yuw.php Lang/om_ET.php Lang/mr_IN.php Lang/ts.php Lang/lij.php Lang/to.php Lang/ru_RU.php Lang/fa.php Lang/fr_GF.php Lang/eo.php Lang/ca_ES.php Lang/csb_PL.php Lang/pt_AO.php Lang/tk.php Lang/sr_Latn.php Lang/hak.php Lang/fr_BJ.php Lang/kw.php Lang/so_KE.php Lang/fr_BF.php Lang/in.php Lang/fr_BI.php Lang/uk_UA.php Lang/sa.php Lang/zh_Hant_MO.php Lang/id_ID.php Lang/chr.php Lang/pt_LU.php Lang/yue_Hant.php Lang/doi.php Lang/yo.php Lang/zh_HK.php Lang/mt_MT.php Lang/yue_Hans.php Lang/tr_TR.php Lang/it_VA.php Lang/ms_MY.php Lang/xh.php Lang/so_ET.php Lang/st.php Lang/cy_GB.php Lang/fr_PF.php Lang/fil.php Lang/fi_FI.php Lang/pt_ST.php Lang/mfe.php Lang/af_ZA.php Lang/ga_IE.php Lang/fr_BL.php Lang/se_NO.php Lang/shs.php Lang/tzm.php Lang/tn.php Lang/pt_GW.php Lang/sat.php Lang/zh_Hans_HK.php Lang/sah.php Lang/cv_RU.php Lang/kn_IN.php Lang/sv_SE.php Lang/de_DE.php Lang/en_TT.php Lang/fr_GA.php Lang/ka_GE.php Lang/fr_SN.php Lang/ff_GN.php Lang/is.php Lang/hsb.php Lang/sm.php Lang/en_MO.php Lang/mn_MN.php Lang/ru_KG.php Lang/fr_YT.php Lang/it_SM.php Lang/de_IT.php Lang/pt_GQ.php Lang/tcy.php Lang/gu_IN.php Lang/nn.php Lang/ha_NG.php Lang/nb_NO.php Lang/byn.php Lang/bi.php Lang/nb.php Lang/tl.php Lang/fr_CI.php Lang/nn_NO.php Lang/aa.php Lang/sv_FI.php Lang/sr_ME.php Lang/si_LK.php Lang/th.php Lang/tg_TJ.php Lang/bho.php Lang/ak.php Lang/te_IN.php Lang/ks.php Lang/tl_PH.php Lang/yue.php Lang/en_VI.php Lang/en_JM.php Lang/en_ZW.php Lang/en_KE.php Lang/en_PK.php Lang/en_US.php Lang/hr_HR.php Lang/gv.php Lang/tt.php Lang/fur_IT.php Lang/ug_CN.php Lang/sk_SK.php Lang/kl.php Lang/lb_LU.php Lang/se_SE.php Lang/fr_GP.php Lang/en_MH.php Lang/zh_Hans_SG.php Lang/szl.php Lang/nso.php Lang/vi.php Lang/mag.php Lang/fr_CF.php Lang/wa.php Lang/ku_TR.php Lang/nl_CW.php Lang/bs_BA.php Lang/sl_SI.php Lang/ig.php Lang/lg.php Lang/ln_CD.php Lang/rw.php Lang/sq_AL.php Lang/br_FR.php Lang/fr_GN.php Lang/sw.php Lang/eu_ES.php Lang/os.php Lang/zu.php Lang/fo.php Lang/lo.php Lang/shi_Tfng.php Lang/fr_TG.php Lang/csb.php Lang/ik.php Lang/fr_MC.php Lang/en_AS.php Lang/or_IN.php Lang/mni.php Lang/tt_RU.php Lang/gom.php Lang/my_MM.php Lang/nl_SX.php Lang/bo_CN.php Lang/kok.php Lang/sid.php Lang/fr_CD.php Lang/zh_Hant_HK.php Lang/an.php Lang/fr_MU.php Lang/ce.php Lang/ne_NP.php Lang/he_IL.php Lang/vi_VN.php Lang/nr.php Lang/mt.php Lang/ti.php Lang/hu_HU.php Lang/tet.php Lang/ps_AF.php Lang/et_EE.php Lang/dz.php Lang/en_PR.php Lang/lt_LT.php Lang/fr_MQ.php Lang/fr_PM.php Lang/mo.php Lang/agr.php Lang/mjw.php Lang/en_UM.php Lang/fr_SC.php Lang/wae.php Lang/shn.php Lang/zh_Hant_TW.php Lang/se.php Lang/ky_KG.php Lang/hi_IN.php Lang/kk_KZ.php Lang/dsb.php Lang/pt_CV.php Lang/fr_GQ.php Lang/fr_RE.php Lang/ha_GH.php Lang/brx.php Lang/ff_SN.php Lang/sq.php Lang/sgs.php Lang/niu.php Lang/fr_MG.php Lang/fr_KM.php Lang/ha_NE.php Lang/ro.php Lang/miq.php Lang/nl_BQ.php Lang/hne.php Lang/mn.php Lang/vai_Vaii.php Lang/bem.php Lang/km.php Lang/en_BZ.php Lang/raj.php Lang/ff_CM.php Traits/Date.php Traits/Localization.php Traits/Creator.php Traits/Difference.php Traits/Comparison.php Traits/Units.php Traits/Converter.php Traits/Modifiers.php Traits/Rounding.php Traits/Week.php Traits/Boundaries.php Traits/Options.php Traits/Test.php Traits/Timestamp.php Traits/Mixin.php Traits/Serialization.php Traits/Macro.php Traits/IntervalRounding.php Traits/IntervalStep.php Traits/Mutability.php Traits/Cast.php CarbonInterval.php CarbonPeriod.php Translator.php CarbonTimeZone.php Language.php Exceptions/OutOfRangeException.php Exceptions/InvalidDateException.php Exceptions/NotACarbonClassException.php Exceptions/NotLocaleAwareException.php Exceptions/ParseErrorException.php Exceptions/InvalidIntervalException.php Exceptions/InvalidCastException.php Exceptions/InvalidFormatException.php Exceptions/UnitNotConfiguredException.php Exceptions/UnknownMethodException.php Exceptions/BadComparisonUnitException.php Exceptions/BadFluentConstructorException.php Exceptions/UnitException.php Exceptions/NotAPeriodException.php Exceptions/UnreachableException.php Exceptions/ImmutableException.php Exceptions/UnknownUnitException.php Exceptions/InvalidPeriodParameterException.php Exceptions/InvalidTimeZoneException.php Exceptions/InvalidTypeException.php Exceptions/UnknownSetterException.php Exceptions/UnknownGetterException.php Exceptions/BadFluentSetterException.php Exceptions/InvalidPeriodDateException.php PHPStan/Macro.php PHPStan/MacroScanner.php Doctrine/CarbonTypeConverter.php Doctrine/CarbonImmutableType.php Doctrine/DateTimeDefaultPrecision.php Doctrine/CarbonType.php Doctrine/DateTimeImmutableType.php Factory.php Laravel/ServiceProvider.php CarbonImmutable.php Cli/Invoker.php Carbon.php List/languages.php List/regions.php

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -12,9 +12,12 @@
Loading
12 12
namespace Carbon\Traits;
13 13
14 14
use Carbon\CarbonInterface;
15 +
use Carbon\CarbonTimeZone;
15 16
use Closure;
16 17
use DateTimeImmutable;
17 18
use DateTimeInterface;
19 +
use InvalidArgumentException;
20 +
use Throwable;
18 21
19 22
trait Test
20 23
{
@@ -84,13 +87,14 @@
Loading
84 87
        $useDateInstanceTimezone = $testNow instanceof DateTimeInterface;
85 88
86 89
        if ($useDateInstanceTimezone) {
87 -
            date_default_timezone_set($testNow->getTimezone()->getName());
90 +
            self::setDefaultTimezone($testNow->getTimezone()->getName(), $testNow);
88 91
        }
89 92
90 93
        static::setTestNow($testNow);
91 94
92 95
        if (!$useDateInstanceTimezone) {
93 -
            date_default_timezone_set(static::getMockedTestNow(\func_num_args() === 1 ? null : $tz)->timezone);
96 +
            $now = static::getMockedTestNow(\func_num_args() === 1 ? null : $tz);
97 +
            self::setDefaultTimezone($now->tzName, $now);
94 98
        }
95 99
    }
96 100
@@ -175,4 +179,30 @@
Loading
175 179
            ? $testInstance->rawFormat(static::MOCK_DATETIME_FORMAT)
176 180
            : $testInstance->format(static::MOCK_DATETIME_FORMAT);
177 181
    }
182 +
183 +
    private static function setDefaultTimezone($timezone, DateTimeInterface $date = null)
184 +
    {
185 +
        $previous = null;
186 +
        $success = false;
187 +
188 +
        try {
189 +
            $success = date_default_timezone_set($timezone);
190 +
        } catch (Throwable $exception) {
191 +
            $previous = $exception;
192 +
        }
193 +
194 +
        if (!$success) {
195 +
            $suggestion = @CarbonTimeZone::create($timezone)->toRegionName($date);
196 +
197 +
            throw new InvalidArgumentException(
198 +
                "Timezone ID '$timezone' is invalid".
199 +
                ($suggestion && $suggestion !== $timezone ? ", did you mean '$suggestion'?" : '.')."\n".
200 +
                "It must be one of the IDs from DateTimeZone::listIdentifiers(),\n".
201 +
                'For the record, hours/minutes offset are relevant only for a particular moment, '.
202 +
                'but not as a default timezone.',
203 +
                0,
204 +
                $previous
205 +
            );
206 +
        }
207 +
    }
178 208
}

@@ -217,7 +217,7 @@
Loading
217 217
     */
218 218
    public function diffInDays($date = null, $absolute = true)
219 219
    {
220 -
        return (int) $this->diff($this->resolveCarbon($date), $absolute)->format('%r%a');
220 +
        return $this->getIntervalDayDiff($this->diff($this->resolveCarbon($date), $absolute));
221 221
    }
222 222
223 223
    /**
@@ -518,7 +518,7 @@
Loading
518 518
            return $hoursDiff / static::HOURS_PER_DAY;
519 519
        }
520 520
521 -
        $daysDiff = (int) $interval->format('%r%a');
521 +
        $daysDiff = $this->getIntervalDayDiff($interval);
522 522
523 523
        return $daysDiff + fmod($hoursDiff, static::HOURS_PER_DAY) / static::HOURS_PER_DAY;
524 524
    }
@@ -1149,4 +1149,17 @@
Loading
1149 1149
1150 1150
        return $this->isoFormat((string) $format);
1151 1151
    }
1152 +
1153 +
    private function getIntervalDayDiff(DateInterval $interval): int
1154 +
    {
1155 +
        $daysDiff = (int) $interval->format('%r%a');
1156 +
1157 +
        // Work around PHP 8.1 regression (see https://bugs.php.net/bug.php?id=81458)
1158 +
        if ($daysDiff === 0) {
1159 +
            $daysDiff = ($interval->invert ? -1 : 1) *
1160 +
                ($interval->y * static::DAYS_PER_YEAR + $interval->m * 30 + $interval->d);
1161 +
        }
1162 +
1163 +
        return $daysDiff;
1164 +
    }
1152 1165
}

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Complexity Coverage
src/Carbon ø 100.00%
Project Totals (886 files) 2161 100.00%
Loading