Skip to content

Commit

Permalink
Added missing immutability annotation to Holidays interface
Browse files Browse the repository at this point in the history
  • Loading branch information
norberttech committed Jun 2, 2020
1 parent 836234e commit bab8a69
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
}
},
"scripts": {
"build": [
"@static:analyze",
"@test",
"@test:mutation"
],
"test": [
"phpunit"
],
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Aeon/Calendar/Gregorian/Holidays.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Aeon\Calendar\Gregorian\Holidays\Holiday;

/**
* @psalm-immutable
*/
interface Holidays
{
public function isHoliday(Day $day) : bool;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Aeon\Calendar\Gregorian\Holidays;
use Webmozart\Assert\Assert;

/**
* @psalm-immutable
*/
final class GoogleCalendarRegionalHolidays implements Holidays
{
/**
Expand Down Expand Up @@ -38,6 +41,11 @@ function (string $countryCode) : string {
$this->calendars = null;
}

/**
* @param Day $day
* @return bool
* @throws HolidayYearException
*/
public function isHoliday(Day $day) : bool
{
if ($this->calendars === null) {
Expand Down Expand Up @@ -100,6 +108,7 @@ private function loadCalendars() : void
}
}

/** @psalm-suppress InaccessibleProperty */
private function loadCalendar(string $countryCode) : void
{
/**
Expand Down

0 comments on commit bab8a69

Please sign in to comment.