Skip to content

Commit a73f198

Browse files
committed
Merge branch 'release/2.6.0'
2 parents ffe6342 + 8db37cd commit a73f198

File tree

1,697 files changed

+11707
-16889
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,697 files changed

+11707
-16889
lines changed

.editorconfig

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = space
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
10+
[*.php]
11+
indent_size = 4
12+
13+
[*.json]
14+
indent_size = 2
15+
16+
[*.{yml,yaml}]
17+
indent_size = 2
18+

.github/workflows/coding-standard.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
operating-system: [ ubuntu-latest, windows-latest, macOS-latest ]
15-
php-versions: [ '7.4', '8.0' ]
15+
php-versions: [ '7.4', '8.0', '8.1', '8.2']
1616

1717
steps:
1818
- name: Set git to use LF
@@ -21,7 +21,7 @@ jobs:
2121
git config --global core.eol lf
2222
2323
- name: Checkout
24-
uses: actions/checkout@v2.3.4
24+
uses: actions/checkout@v3.2.0
2525
with:
2626
fetch-depth: 1
2727

@@ -30,17 +30,17 @@ jobs:
3030
with:
3131
php-version: ${{ matrix.php-versions }}
3232
coverage: pcov
33+
extensions: intl
3334

3435
- name: Get Composer Cache Directory
3536
id: composer-cache
3637
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
37-
38-
- name: Cache Composer dependencies
39-
uses: actions/cache@v2
38+
- uses: actions/cache@v3
4039
with:
4140
path: ${{ steps.composer-cache.outputs.dir }}
42-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
43-
restore-keys: ${{ runner.os }}-composer-
41+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
42+
restore-keys: |
43+
${{ runner.os }}-composer-
4444
4545
- name: Check Composer configuration
4646
run: composer validate --strict
@@ -50,3 +50,6 @@ jobs:
5050

5151
- name: Check Code Style
5252
run: vendor/bin/php-cs-fixer --diff --dry-run -v fix
53+
env:
54+
PHP_CS_FIXER_IGNORE_ENV: 1
55+

.github/workflows/mutation-tests.yml

-52
This file was deleted.

.github/workflows/static-analysis.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
operating-system: [ ubuntu-latest, windows-latest, macOS-latest ]
15-
php-versions: [ '7.4', '8.0' ]
15+
php-versions: [ '7.4', '8.0', '8.1', '8.2' ]
1616

1717
steps:
1818
- name: Set git to use LF
@@ -21,7 +21,7 @@ jobs:
2121
git config --global core.eol lf
2222
2323
- name: Checkout
24-
uses: actions/checkout@v2.3.4
24+
uses: actions/checkout@v3.2.0
2525
with:
2626
fetch-depth: 1
2727

@@ -30,17 +30,17 @@ jobs:
3030
with:
3131
php-version: ${{ matrix.php-versions }}
3232
coverage: pcov
33+
extensions: intl
3334

3435
- name: Get Composer Cache Directory
3536
id: composer-cache
3637
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
37-
38-
- name: Cache Composer dependencies
39-
uses: actions/cache@v2
38+
- uses: actions/cache@v3
4039
with:
4140
path: ${{ steps.composer-cache.outputs.dir }}
42-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
43-
restore-keys: ${{ runner.os }}-composer-
41+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
42+
restore-keys: |
43+
${{ runner.os }}-composer-
4444
4545
- name: Check Composer configuration
4646
run: composer validate --strict

.github/workflows/testing.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
operating-system: [ ubuntu-latest, windows-latest, macOS-latest ]
15-
php-versions: [ '7.4', '8.0' ]
15+
php-versions: [ '7.4', '8.0', '8.1', '8.2' ]
1616

1717
steps:
1818
- name: Set git to use LF
@@ -21,7 +21,7 @@ jobs:
2121
git config --global core.eol lf
2222
2323
- name: Checkout
24-
uses: actions/checkout@v2.3.4
24+
uses: actions/checkout@v3.2.0
2525
with:
2626
fetch-depth: 1
2727

@@ -30,17 +30,17 @@ jobs:
3030
with:
3131
php-version: ${{ matrix.php-versions }}
3232
coverage: pcov
33+
extensions: intl, calendar
3334

3435
- name: Get Composer Cache Directory
3536
id: composer-cache
3637
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
37-
38-
- name: Cache Composer dependencies
39-
uses: actions/cache@v2
38+
- uses: actions/cache@v3
4039
with:
4140
path: ${{ steps.composer-cache.outputs.dir }}
42-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
43-
restore-keys: ${{ runner.os }}-composer-
41+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
42+
restore-keys: |
43+
${{ runner.os }}-composer-
4444
4545
- name: Check Composer configuration
4646
run: composer validate --strict

.gitignore

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.DS_Store
22
.idea/
3-
vendor
4-
composer.lock
53
.php-cs-fixer.cache
64
.php_cs.cache
7-
bin/_*
85
.phpunit.result.cache
6+
bin/_*
7+
composer.lock
98
var
9+
vendor

.phan/config.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@
291291
// should be added to the `directory_list` as well as
292292
// to `exclude_analysis_directory_list`.
293293
'exclude_analysis_directory_list' => [
294-
'vendor/',
294+
'vendor/',
295+
'examples/'
295296
],
296297

297298
// Enable this to enable checks of require/include statements referring to valid paths.
@@ -349,7 +350,8 @@
349350
// Thus, both first-party and third-party code being used by
350351
// your application should be included in this list.
351352
'directory_list' => [
352-
'src',
353+
'src',
354+
'examples'
353355
],
354356

355357
// A list of individual files to include in analysis

.php-cs-fixer.php

+19-13
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
/**
46
* This file is part of the Yasumi package.
57
*
6-
* Copyright (c) 2015 - 2022 AzuyaLabs
8+
* Copyright (c) 2015 - 2023 AzuyaLabs
79
*
810
* For the full copyright and license information, please view the LICENSE
911
* file that was distributed with this source code.
@@ -14,17 +16,21 @@
1416

1517
$config = new PhpCsFixer\Config();
1618
$config->setRiskyAllowed(true)->setRules([
17-
'@Symfony' => true,
18-
'blank_line_after_opening_tag' => true,
19-
'is_null' => true,
20-
'modernize_types_casting' => true,
21-
'self_accessor' => true,
22-
'dir_constant' => true,
23-
'ordered_class_elements' => true,
24-
'declare_strict_types' => true,
25-
'no_superfluous_elseif' => true,
26-
'combine_consecutive_issets' => true,
27-
'combine_consecutive_unsets' => true,
19+
'@Symfony' => true,
20+
'@PER' => true,
21+
'combine_consecutive_issets' => true,
22+
'combine_consecutive_unsets' => true,
23+
'declare_strict_types' => true,
24+
'no_superfluous_elseif' => true,
25+
'no_superfluous_phpdoc_tags' => ['remove_inheritdoc' => true],
26+
27+
// Risky rules
28+
'dir_constant' => true,
29+
'get_class_to_class_keyword' => true,
30+
'is_null' => true,
31+
'modernize_strpos' => true,
32+
'modernize_types_casting' => true,
33+
'self_accessor' => true,
2834
])->setFinder($finder);
2935

3036
return $config;

CHANGELOG.md

+75-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/) and this project adheres
66
to [Semantic Versioning](https://semver.org).
77

8+
Changes related to the business logic of the holidays or their providers are listed first, followed by any technical or architectural
9+
changes.
10+
811
## [Unreleased]
912

1013
### Added
@@ -13,10 +16,78 @@ to [Semantic Versioning](https://semver.org).
1316

1417
### Fixed
1518

16-
### Deprecated
19+
### Removed
20+
21+
## [2.6.0] - 2023-04-27
22+
23+
### Added
24+
25+
- Bank holiday for King Charles III’s Coronation in the United Kingdom. [\#305](https://github.com/azuyalabs/yasumi/pull/305) ([Freshleaf Media](https://www.github.com/freshleafmedia))
26+
- Bank holiday for Queen Elizabeth II’s State Funeral on September 19, 2022, for the United Kingdom. [\#287](https://github.com/azuyalabs/yasumi/pull/287) ([Freshleaf Media](https://www.github.com/freshleafmedia))
27+
- National Day of Mourning for Australia. [\#288](https://github.com/azuyalabs/yasumi/pull/288) ([FuzzyWuzzyFraggle](https://www.github.com/FuzzyWuzzyFraggle)).
28+
- In Japan, Marine Day was rescheduled to July 23 as the 2020 Tokyo Olympics took place. The rescheduled Marine Day for
29+
2021 was included, but not the original rescheduled day for 2020.
30+
- Slovak translations for a couple of popular holidays. [\#298](https://github.com/azuyalabs/yasumi/pull/298) ([Jozef Grencik](https://www.github.com/jozefgrencik))
31+
- All examples as shown on the documentation site as a convenience to developers who like to have all information in a
32+
single place.
33+
- Included an `.editorconfig` file to maintain a consistent style for developers using different text editors.
34+
- The `ext-intl` extension as a required extension. [\#306](https://github.com/azuyalabs/yasumi/pull/306) ([Freshleaf Media](https://www.github.com/freshleafmedia))
35+
- An exception is thrown in case the time stamp of the start and end date in the `dateTimeBetween` method can't be established.
36+
- Checks in case getting transition details or a date interval subtraction fails.
37+
38+
### Changed
39+
40+
- Adjusted the visibility of the `calculateSummerWinterTime` method to `private` as it is an internal method and
41+
shouldn't be accessible directly.
42+
- Made the calculation for summer/winter time more defensive by adding a check that the timestamps are successfully created.
43+
- Changed to use the `strtotime` function as `mktime` does not generate timestamps before 1970-01-01 (negative values),
44+
which is needed to determine winter/summertime before that.
45+
- Refactored summer and winter time tests for Denmark and The Netherlands by introducing a base class holding the domain
46+
logic.
47+
- Switched from `getShortName()` to `getName()` for the `ReflectionClass` created by the method `anotherTime()` in the
48+
`AbstractProvider` class. Using `getShortName` could result in a `ProviderNotFoundException` for some custom holiday
49+
providers, since the namespace is not fully qualified. This can happen, if you create a custom holiday provider.
50+
[\#292](https://github.com/azuyalabs/yasumi/pull/292) ([SupraSmooth](https://github.com/SupraSmooth)).
51+
- Replaced the use of the `DateTime` class with `DateTimeInterface` (always use interface where possible).
52+
- Use the preferred/idiomatic way of getting an immutable date from a mutable one. Added extra checks if modifying date
53+
methods are not successful.
54+
- Split functions that generate random dates/years into a new trait to slim down the overgrown base trait.
55+
- Code styling fixes and improvements.
56+
- Upgraded dependencies to latest working versions.
57+
- Improved and cleaned up numerous unit tests.
58+
59+
### Fixed
60+
61+
- Liberation Day for The Netherlands is only an official holiday every 5 years [\#280](https://github.com/azuyalabs/yasumi/pull/280) ([Daan Roet](https://github.com/droet)).
62+
- Pentecost Monday in France was only recognized as an official holiday until 2004. Since 2004, it is considered a
63+
special holiday, a so called 'working holiday'. Hence, it is therefore classified as an observed holiday in Yasumi
64+
from 2004 and forward. [\#281](https://github.com/azuyalabs/yasumi/issues/281).
65+
- The holiday of Epiphany (6th of January) was incorrectly categorized as `other` and changed to an official holiday in
66+
Baden-Württemberg, Bavaria and SaxonyAnhalt. [\#296](https://github.com/azuyalabs/yasumi/issues/296) ([Anna Damm](https://github.com/AnnaDamm)).
67+
- The year 1988 was incorrectly omitted from observing the Emperor's birthday in Japan.
68+
- The tests for Remembrance Day, Malvina's Day and National Sovereignty Day in Argentina were considered for all years;
69+
however, these have only been celebrated since their establishment.
70+
- Tests for New Year's Day, Spring Bank Holiday, and May Day Holiday in the United Kingdom (England, Wales, Northern
71+
Ireland, and Scotland), as well as Battle of the Boyne in Northern Ireland, were considered for any calendar year;
72+
however, these are celebrated only since a particular calendar year.
73+
- In version 2022f of the `tz` db, a correction for 1947 was made for the summertime transition in Denmark to April
74+
the 6th. Various corrections have been made to accommodate for change.
75+
- The `ProviderInterface::getHolidays` has been re-added after it was erroneously removed. [\#277](https://github.com/azuyalabs/yasumi/pull/277) ([Jakub Wojtyra](https://github.com/jwojtyra-aterian)).
76+
- Created the interface methods of the `ProviderInterface` that the abstract provider class implements. Since the return
77+
type of the Yasumi factory methods is now `ProviderInterface`, those missing methods generated errors, especially by
78+
static analysers.
79+
- Changed the visibility of various class methods back to `protected`. The visibility was accidentally reduced during a clean-up
80+
of code. This caused these methods not being accessible any more when extending a provider class.
1781

1882
### Removed
1983

84+
- The `count` method from the `ProviderInterface` as the `AbstractProvider` class already implements the Countable interface.
85+
- Unused `InvalidDateException` class and other unused imported classes.
86+
- `tests` folder from analysis by PHPStan (the large number of files makes the analysis needlessly long).
87+
- Redundant checks for empty arrays and types.
88+
- Mutation testing from GitHub Actions, as currently the outcome is not actively used. Running mutation tests locally
89+
should be sufficient.
90+
2091
## [2.5.0] - 2022-01-30
2192

2293
### Added
@@ -687,7 +758,9 @@ to [Semantic Versioning](https://semver.org).
687758

688759
- Initial Release
689760

690-
[Unreleased]: https://github.com/azuyalabs/yasumi/compare/2.5.0...HEAD
761+
[Unreleased]: https://github.com/azuyalabs/yasumi/compare/2.6.0...HEAD
762+
763+
[2.6.0]: https://github.com/azuyalabs/yasumi/compare/2.5.0...2.6.0
691764

692765
[2.5.0]: https://github.com/azuyalabs/yasumi/compare/2.4.0...2.5.0
693766

0 commit comments

Comments
 (0)