Skip to content

Commit

Permalink
Add intl-version to matrix
Browse files Browse the repository at this point in the history
As it looks like some intl-versions are bolloks....
  • Loading branch information
heiglandreas committed Aug 5, 2023
1 parent 7479245 commit a2089e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,20 @@ jobs:
matrix:
# operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.3', '7.4', '8.0', '8.1', '8.2']
icu-versions: ['73.1', '71.1', '69.1', '67.1']
experimental: [false]
include:
- php-versions: '8.3'
experimental: true
name: PHP ${{ matrix.php-versions }} # Test on ${{ matrix.operating-system }}
name: PHP ${{ matrix.php-versions }}-icu${{ matrix.icu-versions }} # Test on ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: sodium
extensions: sodium, intl-${{matrix.icu-version}}
ini-values: post_max_size=256M, short_open_tag=On
coverage: xdebug
- name: prepare
Expand Down
14 changes: 8 additions & 6 deletions src/CalendarDayFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

use IntlCalendar;
use Org_Heigl\Holidaychecker\Exceptions\UnknownCalendar;
use UnexpectedValueException;
use function sprintf;

class CalendarDayFactory
Expand All @@ -47,11 +46,14 @@ public static function createCalendarDay(int $day, int $month, string $calendar)
$calendar
));
}
$calendar = IntlCalendar::createInstance('UTC', '@calendar=' . $calendar);
if (null === $calendar) {
throw new UnexpectedValueException('Expected instance of IntlCalendar, got null');
}
$icuCalendar = IntlCalendar::createInstance('UTC', '@calendar=' . $calendar);

return new CalendarDay($day, $month, $calendar);
if ($icuCalendar === null) {
throw new UnknownCalendar(sprintf(
'The %s calendar could not be created',
$calendar
));

Check warning on line 55 in src/CalendarDayFactory.php

View check run for this annotation

Codecov / codecov/patch

src/CalendarDayFactory.php#L52-L55

Added lines #L52 - L55 were not covered by tests
}
return new CalendarDay($day, $month, $icuCalendar);
}
}

0 comments on commit a2089e9

Please sign in to comment.