diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 88cef877..88e4b370 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: php-version: - - "8.3" + - "8.4" operating-system: - "ubuntu-latest" diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index c0484ea7..7fc2feef 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -17,7 +17,7 @@ jobs: - name: "installing PHP" uses: "shivammathur/setup-php@v2" with: - php-version: "8.3" + php-version: "8.4" ini-values: memory_limit=-1 tools: composer:v2, cs2pr extensions: bcmath, mbstring, intl, sodium, json diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 835c9bbf..d9376481 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -15,7 +15,7 @@ jobs: - name: "installing PHP" uses: "shivammathur/setup-php@v2" with: - php-version: "8.3" + php-version: "8.4" ini-values: memory_limit=-1 tools: composer:v2, cs2pr extensions: bcmath, mbstring, intl, sodium, json diff --git a/.github/workflows/documentation-check.yml b/.github/workflows/documentation-check.yml index d583dbc2..6fb7da39 100644 --- a/.github/workflows/documentation-check.yml +++ b/.github/workflows/documentation-check.yml @@ -15,7 +15,7 @@ jobs: - name: "installing PHP" uses: "shivammathur/setup-php@v2" with: - php-version: "8.3" + php-version: "8.4" ini-values: memory_limit=-1 tools: composer:v2, cs2pr extensions: bcmath, mbstring, intl, sodium, json diff --git a/.github/workflows/mutation-tests.yml b/.github/workflows/mutation-tests.yml index 7d7d0f8b..9c96e3a2 100644 --- a/.github/workflows/mutation-tests.yml +++ b/.github/workflows/mutation-tests.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: php-version: - - "8.3" + - "8.4" operating-system: - "ubuntu-latest" diff --git a/.github/workflows/preload-check.yml b/.github/workflows/preload-check.yml index bf3c6e06..8cea21ac 100644 --- a/.github/workflows/preload-check.yml +++ b/.github/workflows/preload-check.yml @@ -15,7 +15,7 @@ jobs: - name: "installing PHP" uses: "shivammathur/setup-php@v2" with: - php-version: "8.3" + php-version: "8.4" ini-values: memory_limit=-1 tools: composer:v2, cs2pr extensions: bcmath, mbstring, intl, sodium, json diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index cfdb3430..07a005a2 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -15,6 +15,7 @@ jobs: php-version: - "8.2" - "8.3" + - "8.4" operating-system: - "macos-latest" - "ubuntu-latest" diff --git a/Makefile b/Makefile index d619b7a4..8e0e50f7 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ help: @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_\-\.]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) install: ## install all dependencies for a development environment - composer install + COMPOSER_IGNORE_PLATFORM_REQ=php+ composer install coding-standard-fix: ## apply automated coding standard fixes PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --config=config/.php_cs.dist.php diff --git a/composer.json b/composer.json index 6127ff32..392ca0d7 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "php": "~8.2.0 || ~8.3.0", + "php": "~8.2.0 || ~8.3.0 || ~8.4.0", "ext-bcmath": "*", "ext-json": "*", "ext-mbstring": "*", diff --git a/composer.lock b/composer.lock index a41893b1..a3d30aef 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "97465cc59bebf30479efdae3608e548a", + "content-hash": "96e8a3659280b296c7389255024734c4", "packages": [ { "name": "revolt/event-loop", @@ -7403,17 +7403,17 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "~8.2.0 || ~8.3.0", + "php": "~8.2.0 || ~8.3.0 || ~8.4.0", "ext-bcmath": "*", "ext-json": "*", "ext-mbstring": "*", "ext-sodium": "*", "ext-intl": "*" }, - "platform-dev": [], + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/src/Psl/DateTime/DateTime.php b/src/Psl/DateTime/DateTime.php index c1bafde1..87398c91 100644 --- a/src/Psl/DateTime/DateTime.php +++ b/src/Psl/DateTime/DateTime.php @@ -172,14 +172,7 @@ public static function fromParts(Timezone $timezone, int $year, Month|int $month $month = $month->value; } - /** - * @var IntlCalendar $calendar - */ - $calendar = IntlCalendar::createInstance( - Internal\to_intl_timezone($timezone), - ); - - $calendar->set($year, $month - 1, $day, $hours, $minutes, $seconds); + $calendar = Internal\create_intl_calendar_from_date_time($timezone, $year, $month, $day, $hours, $minutes, $seconds); if ($seconds !== $calendar->get(IntlCalendar::FIELD_SECOND)) { throw Exception\UnexpectedValueException::forSeconds($seconds, $calendar->get(IntlCalendar::FIELD_SECOND)); diff --git a/src/Psl/DateTime/Internal/create_intl_calendar_from_date_time.php b/src/Psl/DateTime/Internal/create_intl_calendar_from_date_time.php new file mode 100644 index 00000000..f09a21e0 --- /dev/null +++ b/src/Psl/DateTime/Internal/create_intl_calendar_from_date_time.php @@ -0,0 +1,44 @@ += 80300) { + $calendar->setDateTime($year, $month - 1, $day, $hours, $minutes, $seconds); + } else { + // @codeCoverageIgnoreStart + $calendar->set($year, $month - 1, $day, $hours, $minutes, $seconds); + // @codeCoverageIgnoreEnd + } + + return $calendar; +} diff --git a/src/Psl/Internal/Loader.php b/src/Psl/Internal/Loader.php index 51bd3d8a..e843124b 100644 --- a/src/Psl/Internal/Loader.php +++ b/src/Psl/Internal/Loader.php @@ -554,6 +554,7 @@ final class Loader 'Psl\\DateTime\\Internal\\default_timezone' => 'Psl/DateTime/Internal/default_timezone.php', 'Psl\\DateTime\\Internal\\system_time' => 'Psl/DateTime/Internal/system_time.php', 'Psl\\DateTime\\Internal\\high_resolution_time' => 'Psl/DateTime/Internal/high_resolution_time.php', + 'Psl\\DateTime\\Internal\\create_intl_calendar_from_date_time' => 'Psl/DateTime/Internal/create_intl_calendar_from_date_time.php', 'Psl\\DateTime\\Internal\\create_intl_date_formatter' => 'Psl/DateTime/Internal/create_intl_date_formatter.php', 'Psl\\DateTime\\Internal\\parse' => 'Psl/DateTime/Internal/parse.php', 'Psl\\DateTime\\Internal\\format_rfc3339' => 'Psl/DateTime/Internal/format_rfc3339.php',