Skip to content

V2: Improve Islamic calendar contracts#322

Merged
Nielsvanpach merged 12 commits intov2from
bugs/phpstan-fixes
Feb 26, 2026
Merged

V2: Improve Islamic calendar contracts#322
Nielsvanpach merged 12 commits intov2from
bugs/phpstan-fixes

Conversation

@Nielsvanpach
Copy link
Collaborator

Key Changes

  1. Islamic Calendar Type Improvements (src/Calendars/IslamicCalendar.php)
    • Changed nullable return types to non-nullable for date lookup methods (ashuraDates(), arafatDates(), islamicNewYearDates(), prophetMuhammadBirthdayDates()) - now return array instead of ?array
    • Changed nullable return types for holiday resolution methods (arafat(), islamicNewYear(), prophetMuhammadBirthday()) - now return CarbonImmutable instead of ?CarbonImmutable
    • Default implementations now return empty arrays [] instead of null
  2. Calendar Resolution Logic (src/Calendars/ResolvesCalendarDates.php)
    • getMultiDayHoliday() and getSingleDayHoliday() now accept array instead of non-empty-array
    • Empty arrays are handled gracefully - methods return empty results instead of throwing
  3. Country Files
    • Added explicit PHPDoc return types to all Islamic date lookup methods
    • Simplified country implementations by removing unnecessary null checks
  4. Support for Multiple Eid Holidays
    • Turkey can now have two Eid al-Fitr and Eid al-Adha holidays in the same year (e.g., 2000, 2033)
      Breaking Change
      Methods like arafat(), islamicNewYear(), and prophetMuhammadBirthday() now throw an InvalidYear exception if the year is not found in the lookup table, instead of returning null. Countries that don't define certain Islamic holidays will need to ensure they implement all required abstract methods.

@Nielsvanpach Nielsvanpach merged commit d4d207f into v2 Feb 26, 2026
12 checks passed
@Nielsvanpach Nielsvanpach deleted the bugs/phpstan-fixes branch February 26, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant