Skip to content

Commit

Permalink
fix phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
Nielsvanpach committed Apr 29, 2024
1 parent 16e9d20 commit 819b3fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
15 changes: 10 additions & 5 deletions src/Countries/Ecuador.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand All @@ -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<string, CarbonImmutable> */
/** @return array<string, CarbonInterface> */
protected function variableHolidays(int $year): array
{
$easter = $this->easter($year);
Expand Down

0 comments on commit 819b3fd

Please sign in to comment.