Skip to content

Commit

Permalink
Merge branch 'release/2.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
stelgenhof committed Oct 6, 2019
2 parents f756448 + 9870599 commit 87cde7f
Show file tree
Hide file tree
Showing 1,461 changed files with 20,822 additions and 9,487 deletions.
8 changes: 8 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: https://www.buymeacoffee.com/sachatelgenhof
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ vendor
composer.lock
.php_cs.cache
bin/_*
.phpunit.result.cache
14 changes: 10 additions & 4 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/**
* This file is part of the Yasumi package.
*
Expand All @@ -13,6 +13,12 @@
$finder = PhpCsFixer\Finder::create()->in(__DIR__);

return PhpCsFixer\Config::create()->setRiskyAllowed(true)->setRules([
'@PSR2' => true,
'native_function_invocation' => true
])->setFinder($finder);
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'native_function_invocation' => true,
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
'no_unused_imports' => true,
'single_quote' => true,
'space_after_semicolon' => true,
'trailing_comma_in_multiline_array' => true
])->setLineEnding("\n")->setFinder($finder);
13 changes: 12 additions & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
preset: psr2
preset: psr2

risky: true

enabled:
- short_array_syntax
- native_function_invocation
- alpha_ordered_imports
- no_unused_imports
- single_quote
- space_after_semicolon
- trailing_comma_in_multiline_array
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ php:
- 7.1
- 7.2
- 7.3
- 7.4snapshot
- nightly

dist: trusty
Expand All @@ -22,13 +23,15 @@ before_script:
- composer install --no-interaction

script:
- if [[ $PHPSTAN = 1 ]]; then composer require --dev phpstan/phpstan:^0.10 && vendor/bin/phpstan analyse -l 5 src; fi
- if [[ $PHPSTAN = 1 ]]; then composer require --dev phpstan/phpstan:^0.11 && vendor/bin/phpstan analyse -l 5 src; fi
- ./vendor/bin/phpunit
- phpenv config-rm xdebug.ini || return 0
- ./vendor/bin/php-cs-fixer --diff --dry-run -v fix

matrix:
allow_failures:
- php: 7.1
- php: 7.4snapshot
- php: hhvm
- php: nightly

Expand All @@ -39,5 +42,7 @@ matrix:
env: PHPSTAN=1
- php: 7.3
env: PHPSTAN=1
- php: 7.4snapshot
env: PHPSTAN=1
- php: hhvm
env: HHVM=true
83 changes: 76 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org).
The format is based on [Keep a Changelog](https://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org).

## [Unreleased]

Expand All @@ -14,17 +14,86 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Removed


## [2.2.0] - 2019-10-06

### Added
- Holiday providers for England, Wales, Scotland and Northern Ireland [\#166](https://github.com/azuyalabs/yasumi/pull/166) ([c960657](https://github.com/c960657))
- Holiday Provider for South Korea. [\#156](https://github.com/azuyalabs/yasumi/pull/156) ([blood72](https://github.com/blood72))
- Translation for the Easter holiday for the 'fr_FR' locale [\#146](https://github.com/azuyalabs/yasumi/pull/146) ([pioc92](https://github.com/pioc92))
- Translation for the Pentecost holiday for the 'fr_FR' locale [\#145](https://github.com/azuyalabs/yasumi/pull/145) ([pioc92](https://github.com/pioc92))
- Late Summer Bank Holiday in United Kingdom prior to 1965 [\#161](https://github.com/azuyalabs/yasumi/pull/161) ([c960657](https://github.com/c960657))
- Observance holidays for Sweden [\#172](https://github.com/azuyalabs/yasumi/pull/172) ([c960657](https://github.com/c960657))
- Special subclass of Holiday for substitute holidays [\#162](https://github.com/azuyalabs/yasumi/pull/162) ([c960657](https://github.com/c960657))
- Added additional code style fixers and aligning StyleCI settings with PHP-CS.
- Included extra requirement for some PHP Extensions in the composer file.

### Changed
- Updated the translation for the All Saints holiday for the 'fr_FR' locale [\#152](https://github.com/azuyalabs/yasumi/pull/152) ([pioc92](https://github.com/pioc92))
- Updated the translation for the Armistice holiday for the 'fr_FR' locale [\#154](https://github.com/azuyalabs/yasumi/pull/154) ([pioc92](https://github.com/pioc92))
- Updated the translation for the Victory in Europe holiday for the 'fr_FR' locale [\#153](https://github.com/azuyalabs/yasumi/pull/153) ([pioc92](https://github.com/pioc92))
- Updated the translation for the Assumption of Mary holiday for the 'fr_FR' locale [\#155](https://github.com/azuyalabs/yasumi/pull/155) ([pioc92](https://github.com/pioc92))
- Updated the translation for Christmas Day for the 'nl_NL' locale [\#160](https://github.com/azuyalabs/yasumi/pull/160) ([pioc92](https://github.com/pioc92))
- Reordered arguments to Yoda style.
- Replaced null checks by appropriate instance / type checks.
- Moved default method values to method body as parameters should be nullable.
- Applying the use of strict types. Strict typing allows for improved readability, maintainability, and less prone to bugs and security vulnerabilities.
- PHP 7.1 is allowed to fail for Travis-CI due to the fact PHPUnit 8 requires PHP >= 7.2. PHP 7.1 support will be dropped in Yasumi once 7.1 has reached its end of life (December 2019).
- Code using class imports rather than Fully Qualified Class names.
- Upgraded to PHPUnit 8.
- Replaced the standard 'InvalidArgumentException' when an invalid year or holiday provider are given by a new exception for each of these two situations separately ('InvalidYearException' and 'ProviderNotFoundException'). This allows you to better distinguish which exception may occur when instantiating the Yasumi class. [\#95](https://github.com/azuyalabs/yasumi/pull/95) ([qneyrat](https://github.com/qneyrat))
- Refactored the AbstractProvider::count method to use the newly added SubstituteHoliday class.
- Fallback support added to getName() to allow e.g. fallback from 'de_AT' to 'de'. [\#176](https://github.com/azuyalabs/yasumi/pull/176) ([c960657](https://github.com/c960657))

### Fixed
- Late Summer Bank Holiday in 1968 and 1969 in United Kingdom [\#161](https://github.com/azuyalabs/yasumi/pull/161) ([c960657](https://github.com/c960657))
- Fixed one-off exceptions for May Day Bank Holiday in 1995 and 2020 and Spring Bank Holiday in 2002 and 2012 (United Kingdom) [\#160](https://github.com/azuyalabs/yasumi/pull/160) ([c960657](https://github.com/c960657))
- Fixed revoked holidays in Portugal in 2013-2015 [\#163](https://github.com/azuyalabs/yasumi/pull/163) ([c960657](https://github.com/c960657))
- Fixed spelling issues in the Danish translation for Second Christmas Day. [\#167](https://github.com/azuyalabs/yasumi/pull/167) ([c960657](https://github.com/c960657))
- Corpus Christi is official in Poland [\#168](https://github.com/azuyalabs/yasumi/pull/168) ([c960657](https://github.com/c960657))
- Liberation Day is official in the Netherlands [\#169](https://github.com/azuyalabs/yasumi/pull/169) ([c960657](https://github.com/c960657))
- Typos in Easter Monday and Republic Day for the 'it_IT' locale [\#171](https://github.com/azuyalabs/yasumi/pull/171) ([c960657](https://github.com/c960657))
- Corrected the name of the Emperors Birthday function and variable.
- Good Friday is not official in Brazil [\#174](https://github.com/azuyalabs/yasumi/pull/174) ([c960657](https://github.com/c960657))

### Removed
- Unused constants.


## [2.1.0] - 2019-03-29

### Added
- As the Japanese Emperor will abdicate the throne on May 1st 2019, the holiday of the Emporers Birthday will change to February 23rd from 2020 (No holiday in 2019). In addition, Coronation Day and the Enthronement Proclamation Ceremony will be extra holidays in 2019. [\#130](https://github.com/azuyalabs/yasumi/pull/130) ([cookie-maker](https://github.com/cookie-maker))
- International Women's Day is an official holiday since 2019 in Berlin (Germany). [#133](https://github.com/azuyalabs/yasumi/pull/133) ([huehnerhose](https://github.com/huehnerhose))

### Changed
- Japanese Health And Sports Day will be renamed to Sports Day from 2020. [\#129](https://github.com/azuyalabs/yasumi/pull/129) ([cookie-maker](https://github.com/cookie-maker))
- Dutch spelling for Easter/Pentecost/Christmas to use lower case. [\#128](https://github.com/azuyalabs/yasumi/pull/128) ([c960657](https://github.com/c960657))
- Refactored the Netherlands Holiday provider by moving the calculation of individual holidays to private methods. This will reduce the complexity of the initialize method.
- Visibility of internal class functions to 'private'. These are to be used within the class only and should not be public.

### Fixed
- "Bridge Day" for Japan takes two days in 2019. Currently the code only allows for 1 bridge day at a maximum. [\#141](https://github.com/azuyalabs/yasumi/pull/141) ([cookie-maker](https://github.com/cookie-maker))
- Tests for Bremen, Lower Saxony and Schleswig Holstein (Germany) also celebrated Reformation Day in 2017. The unit tests were failing as it didn't account for that.
- Changed the USA Provider to check all holidays for potential substitute holidays, not just New Year's Day, Independence Day, and Christmas Day. [\#140](https://github.com/azuyalabs/yasumi/pull/140) ([jagers](https://github.com/jagers))
- Adjusted tests for the 'next' and 'previous' methods to avoid actually exceeding the year boundaries.
- Deprecation warning for the package mikey179/vfStream. Composer 2.0 requires package names to not contain any upper case characters. [\#135](https://github.com/azuyalabs/yasumi/pull/135) ([IceShack](https://github.com/IceShack))
- Incorrect comment about weekends in India [\#126](https://github.com/azuyalabs/yasumi/pull/126) ([c960657](https://github.com/c960657))
- Correction to the test of New Year's day in the United Kingdom. It has been identified as a Bank Holiday only since 1975 (not from 1974).

### Removed
- Duplicate definition of newYearsDay [\#125](https://github.com/azuyalabs/yasumi/pull/125) ([c960657](https://github.com/c960657))


## [2.0.0] - 2019-01-11

### Added
- New filter to select holidays that happen on a given date [\#119](https://github.com/azuyalabs/yasumi/pull/119) ([cruxicheiros](https://github.com/cruxicheiros))
- Holiday Providers for all Australian states and territories. [\#112](https://github.com/azuyalabs/yasumi/pull/112) ([Milamber33](https://github.com/Milamber33))
- Holiday Provider for Bosnia. [\#94](https://github.com/azuyalabs/yasumi/pull/94) ([TheAdnan](https://github.com/TheAdnan))
- Added Reformation Day as offical holiday since 2018 in Lower Saxony (Germany). [#115](https://github.com/azuyalabs/yasumi/issues/115) ([Taxcamp](https://github.com/Taxcamp))
- Added Reformation Day as offical holiday since 2018 in Schleswig-Holstein (Germany). [#106](https://github.com/azuyalabs/yasumi/pull/106) ([HenningCash](https://github.com/HenningCash))
- Added Reformation Day as offical holiday since 2018 in Hamburg (Germany). [#108](https://github.com/azuyalabs/yasumi/pull/108) ([HenningCash](https://github.com/HenningCash))
- Added Reformation Day as offical holiday since 2018 in Bremen (Germany). [#116](https://github.com/azuyalabs/yasumi/issues/116) ([TalonTR](https://github.com/TalonTR))
- Added International Women's Day as official holidy since 2019 in Berlin (Germany). [#133](https://github.com/azuyalabs/yasumi/pull/133) ([huehnerhose](https://github.com/huehnerhose))
- Added Reformation Day as official holiday since 2018 in Lower Saxony (Germany). [#115](https://github.com/azuyalabs/yasumi/issues/115) ([Taxcamp](https://github.com/Taxcamp))
- Added Reformation Day as official holiday since 2018 in Schleswig-Holstein (Germany). [#106](https://github.com/azuyalabs/yasumi/pull/106) ([HenningCash](https://github.com/HenningCash))
- Added Reformation Day as official holiday since 2018 in Hamburg (Germany). [#108](https://github.com/azuyalabs/yasumi/pull/108) ([HenningCash](https://github.com/HenningCash))
- Added Reformation Day as official holiday since 2018 in Bremen (Germany). [#116](https://github.com/azuyalabs/yasumi/issues/116) ([TalonTR](https://github.com/TalonTR))
- The (observed) holidays Lukkeloven, Constitution Day, New Year's Eve and Labour Day, as well as summertime and wintertime are included for Denmark [\#104](https://github.com/azuyalabs/yasumi/pull/104) ([c960657](https://github.com/c960657))

### Changed
Expand Down Expand Up @@ -85,7 +154,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## [1.7.0] - 2017-12-11
### Added
- All filters implement the [Countable](http://php.net/manual/en/class.countable.php) interface allowing you to use the ->count() method. [\#77](https://github.com/azuyalabs/yasumi/issues/77)
- All filters implement the [Countable](https://php.net/manual/en/class.countable.php) interface allowing you to use the ->count() method. [\#77](https://github.com/azuyalabs/yasumi/issues/77)
- Holiday Provider for Latvia. [\#70](https://github.com/azuyalabs/yasumi/pull/70) ([lukosius](https://github.com/lukosius))
- Holiday Provider for Lithuania. [\#67](https://github.com/azuyalabs/yasumi/pull/67) ([lukosius](https://github.com/lukosius))
- Sometimes it is more convenient to be able to create a Yasumi instance by ISO3166 code rather than Yasumi's Holiday Provider name. A new function `createByISO3166_2` has been added to allow for that. [\#62](https://github.com/azuyalabs/yasumi/pull/62) ([huehnerhose](https://github.com/huehnerhose))
Expand Down
6 changes: 3 additions & 3 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Project maintainers who do not follow or enforce the Code of Conduct in good fai

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [https://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
[homepage]: https://contributor-covenant.org
[version]: https://contributor-covenant.org/version/1/4/
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ When contributing there are a few guidelines we'd like you to keep in mind:
$ composer format
```

This will check/correct all the code for the PSR-2 Coding Standard using the wonderful [php-cs-fixer](http://cs.sensiolabs.org/) .
This will check/correct all the code for the PSR-2 Coding Standard using the wonderful [php-cs-fixer](https://cs.symfony.com).

- **Add unit tests!** - Your Pull Request won't be accepted if it doesn't have tests:

Expand All @@ -30,7 +30,7 @@ When contributing there are a few guidelines we'd like you to keep in mind:

- **One pull request per feature** - If you want to contribute more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#_changing_multiple) before submitting.


## Running Tests
Expand All @@ -43,4 +43,4 @@ or alternatively run with:

``` bash
$ vendor/bin/phpunit
```
```
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@
[![StyleCI](https://styleci.io/repos/32797151/shield?branch=master)](https://styleci.io/repos/32797151)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/azuyalabs/yasumi/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/azuyalabs/yasumi/?branch=master)

Important!
-----------
Yasumi version 2.0 has been released with support for PHP 7 only. As of January 2019 support for PHP 5 has ended.

For the previous code base (1.8.0) a separate support branch has been created that will only receive the most critical bug fixes (for those still using PHP 5). Please note that although v1.8.x works both in PHP 5 and PHP 7, the code base hasn't been upgraded to PHP 7.

It is highly recommended to upgrade to PHP7 and Yasumi v2.0.0 to enjoy the latest changes and improvements. More information can be found on the blog here: [Yasumi Release v2](https://azuyalabs.github.io/yasumi/blog/release_v2)

Introduction
------------
Yasumi (Japanese for 'Holiday'「休み」) is an easy PHP library to help you calculate the dates and names of holidays and other
Expand All @@ -35,6 +27,14 @@ Blog
----
Checkout the [blog](https://azuyalabs.github.io/yasumi/blog/) section on documentation site regularly for latest updates. Keeping you informed about any news, releases, etc. in a handy blog post format!

## Contributing

Contributions are encouraged and welcome; I am always happy to get feedback or pull requests on Github :) Create [Github Issues](https://github.com/azuyalabs/yasumi/issues) for bugs and new features and comment on the ones you are interested in.

If you enjoy what I am making, an extra cup of coffee is very much appreciated :). Your support helps me to put more time into Open-Source Software projects like this.

<a href="https://www.buymeacoffee.com/sachatelgenhof" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>

License
-------

Expand Down
10 changes: 7 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
}
],
"require": {
"php": ">=7.1"
"php": ">=7.1",
"ext-json": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.14",
"fzaninotto/faker": "~1.8",
"mikey179/vfsStream": "~1.6",
"phpunit/phpunit": "~7.5"
"mikey179/vfsstream": "~1.6",
"phpunit/phpunit": "~8.4"
},
"autoload": {
"psr-4": {
Expand All @@ -44,5 +45,8 @@
},
"config": {
"sort-packages": true
},
"suggest": {
"ext-calendar": "For calculating the date of Easter"
}
}
6 changes: 5 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@
<directory suffix="Test.php">./tests/SouthAfrica</directory>
</testsuite>

<!-- Test Suite for holidays in South Korea -->
<testsuite name="SouthKorea">
<directory suffix="Test.php">./tests/SouthKorea</directory>
</testsuite>

<!-- Test Suite for holidays in Spain -->
<testsuite name="Spain">
<directory suffix="Test.php">./tests/Spain</directory>
Expand Down Expand Up @@ -203,7 +208,6 @@
<directory suffix="Test.php">./tests/UnitedKingdom</directory>
</testsuite>


</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Exception/Exception.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/**
* This file is part of the Yasumi package.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Exception/InvalidDateException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/**
* This file is part of the Yasumi package.
*
Expand Down
24 changes: 24 additions & 0 deletions src/Yasumi/Exception/InvalidYearException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php declare(strict_types=1);
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2019 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <[email protected]>
*/

namespace Yasumi\Exception;

use InvalidArgumentException;

/**
* Class InvalidYearException.
*
* @author Quentin Neyrat <[email protected]>
*/
class InvalidYearException extends InvalidArgumentException implements Exception
{
}
Loading

0 comments on commit 87cde7f

Please sign in to comment.