diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 868a13cfd..c98139708 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -12,7 +12,7 @@ jobs: os: [ubuntu-latest] php: [8.3, 8.2, 8.1] stability: [prefer-lowest, prefer-stable] - carbon: [2.72, 3.0] + carbon: [2.72, 3.2] name: P${{ matrix.php }} - ${{ matrix.stability }} - Carbon ${{ matrix.carbon }} diff --git a/src/Countries/Ecuador.php b/src/Countries/Ecuador.php index 7324026fa..e3892c4bb 100644 --- a/src/Countries/Ecuador.php +++ b/src/Countries/Ecuador.php @@ -3,6 +3,7 @@ namespace Spatie\Holidays\Countries; use Carbon\CarbonImmutable; +use Carbon\CarbonInterface; use Spatie\Holidays\Concerns\Observable; use Spatie\Holidays\Concerns\Translatable; use Spatie\Holidays\Contracts\HasTranslations; @@ -29,7 +30,7 @@ protected function allHolidays(int $year): array ], $this->variableHolidays($year)); } - public function nearestDay(int $year, int $month, int $day): CarbonImmutable + public function nearestDay(int $year, int $month, int $day): CarbonInterface { $date = CarbonImmutable::createFromDate($year, $month, $day); @@ -42,22 +43,26 @@ public function nearestDay(int $year, int $month, int $day): CarbonImmutable } if ($date->is('Wednesday') || $date->is('Thursday')) { - return $date->next(CarbonImmutable::FRIDAY); + return $date->next(CarbonInterface::FRIDAY); } return $date; } - public function getChristmasHoliday(int $year): CarbonImmutable + public function getChristmasHoliday(int $year): CarbonInterface { if ($year === 2022) { - return $this->sundayToNextMonday('12-25', $year); + $observedChristmasDay = $this->sundayToNextMonday('12-25', $year); + + if ($observedChristmasDay !== null ) { + return $observedChristmasDay; + } } return CarbonImmutable::createFromDate($year, 12, 25); } - /** @return array */ + /** @return array */ protected function variableHolidays(int $year): array { $easter = $this->easter($year);