Skip to content

Commit

Permalink
test: bump PHPStan to level 4
Browse files Browse the repository at this point in the history
  • Loading branch information
owenvoke committed Sep 5, 2024
1 parent 8acb327 commit baaeb51
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ parameters:
- src

# The level 8 is the highest level
level: 0
level: 4
7 changes: 5 additions & 2 deletions src/Calendars/YasumiUkCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,30 @@

use Carbon\Carbon;
use Worksome\UkTaxAllowance\Contracts\UkCalendar;
use Yasumi\Provider\AbstractProvider;
use Yasumi\Provider\UnitedKingdom;
use Yasumi\ProviderInterface;
use Yasumi\Yasumi;

class YasumiUkCalendar implements UkCalendar
{
protected const FUTURE = 1;
protected const PAST = -1;

/** {@inheritdoc} */
public function isWeekendDay(Carbon $date): bool
{
return $this->getCalendar($date)
->isWeekendDay($date);
}

/** {@inheritdoc} */
public function isHoliday(Carbon $date): bool
{
return $this->getCalendar($date)
->isHoliday($date);
}

/** {@inheritdoc} */
public function isWorkingDay(Carbon $date): bool
{
$ukCalendar = $this->getCalendar($date);
Expand Down Expand Up @@ -62,7 +65,7 @@ protected function closestWorkingDay(Carbon $date, int $direction): Carbon
return $workingDay;
}

private function getCalendar(Carbon $carbon): AbstractProvider
private function getCalendar(Carbon $carbon): ProviderInterface
{
return Yasumi::create(UnitedKingdom::class, $carbon->year);
}
Expand Down
3 changes: 2 additions & 1 deletion src/UkTaxAllowanceCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function monthlyEndDatesBetween(Carbon $start, Carbon $end): Collection
return collect([$dateEnd->copy()]);
}

/** @var Collection<Carbon> $months */
$months = collect(
CarbonInterval::day()
->toPeriod($dateStart, $dateEnd)
Expand All @@ -71,7 +72,7 @@ public function monthlyEndDatesBetween(Carbon $start, Carbon $end): Collection

public function weekly(Carbon $start, Carbon $end): int
{
return collect($this->weeklyEndDatesBetween($start, $end))->count();
return $this->weeklyEndDatesBetween($start, $end)->count();
}

public function monthly(Carbon $start, Carbon $end): int
Expand Down
2 changes: 1 addition & 1 deletion src/UkTaxAllowanceServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class UkTaxAllowanceServiceProvider extends ServiceProvider
{
public function register()
public function register(): void
{
$this->app->bind(UkCalendar::class, function () {
return new YasumiUkCalendar();
Expand Down

0 comments on commit baaeb51

Please sign in to comment.