Skip to content

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
stelgenhof committed Jan 11, 2019
2 parents 115a3cc + ff2fd72 commit f66dd77
Show file tree
Hide file tree
Showing 1,373 changed files with 24,385 additions and 7,002 deletions.
9 changes: 6 additions & 3 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2018 AzuyaLabs
* 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 <stelgenhof@gmail.com>
* @author Sacha Telgenhof <me@sachatelgenhof.com>
*/

$finder = PhpCsFixer\Finder::create()->in(__DIR__);

return PhpCsFixer\Config::create()->setRules(['@PSR2' => true])->setFinder($finder);
return PhpCsFixer\Config::create()->setRiskyAllowed(true)->setRules([
'@PSR2' => true,
'native_function_invocation' => true
])->setFinder($finder);
20 changes: 16 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
language: php

php:
- 5.6
- 7.0
- 7.1
- hhvm
- 7.2
- 7.3
- nightly

dist: trusty
sudo: required

cache:
directories:
- $HOME/.composer/cache

before_install:
- if [[ $HHVM == true ]]; then sudo apt-get update; fi
- if [[ $HHVM == true ]]; then sudo apt-get install hhvm=3.\*; fi

before_script:
- composer self-update
- composer install --no-interaction

script:
- if [[ $PHPSTAN = 1 ]]; then composer require --dev phpstan/phpstan:^0.9 && vendor/bin/phpstan analyse -l 7 src; fi
- if [[ $PHPSTAN = 1 ]]; then composer require --dev phpstan/phpstan:^0.10 && 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
Expand All @@ -29,3 +35,9 @@ matrix:
include:
- php: 7.1
env: PHPSTAN=1
- php: 7.2
env: PHPSTAN=1
- php: 7.3
env: PHPSTAN=1
- php: hhvm
env: HHVM=true
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,44 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

### Removed


## [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))
- 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
- Upgraded entirely to PHP version 7 with PHP 7.1 being the minimum required version. Base code and all unit tests have been reworked to compatibility with PHP 7.
- Upgraded to PHPUnit to version 7.5.
- Changed Japanese holiday for the 2020 Olympic Games. Marine Day, Mountain Day and Health And Sports Day. [\#113](https://github.com/azuyalabs/yasumi/pull/113) ([cookie-maker](https://github.com/cookie-maker))
- Summer/winter time is now fetched from PHP's tz database. [\#103](https://github.com/azuyalabs/yasumi/pull/103) ([c960657](https://github.com/c960657))
- Changed translation for Norway's national day. [\#98](https://github.com/azuyalabs/yasumi/pull/98) ([c960657](https://github.com/c960657))
- Applied proper null checks in the summertime and wintertime calculations for Denmark and The Netherlands.
- Corrected some namespaces for Australia and Germany.
- Updated copyright year.
- Upgraded various dependency packages.
- Internal locale list updated based on CLDR v34.
- Refactored the Japan and USA Holiday Provider by moving the holiday calculations to private methods. This reduced the complexity of the initialize method.

### Fixed
- Translation for Russia showed in English (except New Year's Day) as the proper locale was not in place.
- Fixed issue for summertime in Denmark in 1980. By default summertime in Denmark is set for the last day of March since 1980, however in 1980 itself, it started on April, 6th.
- Fixed spelling issue in the Swedish translation. [\#97](https://github.com/azuyalabs/yasumi/pull/97) ([c960657](https://github.com/c960657))
- Fixed spelling issues in the Danish translation. [\#96](https://github.com/azuyalabs/yasumi/pull/96) ([c960657](https://github.com/c960657))
- Fixed German Easter Sunday and Pentecost Sunday holidays (not nationwide, only in Brandenburg). [\#100](https://github.com/azuyalabs/yasumi/pull/100) ([TalonTR](https://github.com/TalonTR))
- Fixed BetweenFilter to ignore time part and timezone. [\#101](https://github.com/azuyalabs/yasumi/pull/101) ([c960657](https://github.com/c960657))
- Fixed bug in provider list generation related to variable order of files returned by the filesystem [\#107](https://github.com/azuyalabs/yasumi/pull/107) ([leafnode](https://github.com/leafnode))

### Removed


## [1.8.0] - 2018-02-21

### Added
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at stelgenhof@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at me@sachatelgenhof.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ When contributing there are a few guidelines we'd like you to keep in mind:
Please use the following command after you have completed your work:

``` bash
$ composer php-cs-fixer
$ 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/) .
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 - 2018 AzuyaLabs
Copyright (c) 2015 - 2019 AzuyaLabs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@
[![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.

***!!Update!!***
A new [blog](https://azuyalabs.github.io/yasumi/blog/) section has been added to the documentation site. Keeping you informed about any news, releases, etc. in a handy blog post format!
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
special celebrations from various countries/states. Many services exist on the internet that provide holidays, however
are either not free or offer only limited information. In addition, no complete PHP library seems to exist today
Expand All @@ -25,6 +31,9 @@ Documentation

Yasumi’s documentation is available on [https://azuyalabs.github.io/yasumi/](https://azuyalabs.github.io/yasumi/). You will find all the necessary information how to install Yasumi and also recipes how you can use Yasumi in your project.

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!

License
-------
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
"authors": [
{
"name": "Sacha Telgenhof",
"email": "me@sachatelgenhof.nl"
"email": "me@sachatelgenhof.com"
}
],
"require": {
"php": ">=5.6.0"
"php": ">=7.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.6",
"fzaninotto/faker": "~1.7",
"friendsofphp/php-cs-fixer": "^2.14",
"fzaninotto/faker": "~1.8",
"mikey179/vfsStream": "~1.6",
"phpunit/phpunit": "~5.7"
"phpunit/phpunit": "~7.5"
},
"autoload": {
"psr-4": {
Expand All @@ -39,7 +39,7 @@
}
},
"scripts": {
"php-cs-fixer": "./vendor/bin/php-cs-fixer fix .",
"format": "./vendor/bin/php-cs-fixer fix .",
"test": "vendor/bin/phpunit"
},
"config": {
Expand Down
11 changes: 8 additions & 3 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
<!--
~ This file is part of the Yasumi package.
~
~ Copyright (c) 2015 - 2018 AzuyaLabs
~ 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 <stelgenhof@gmail.com>
~ @author Sacha Telgenhof <me@sachatelgenhof.com>
-->

<phpunit backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
Expand All @@ -20,7 +21,6 @@
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
syntaxCheck="true"
verbose="true"
>
<testsuites>
Expand Down Expand Up @@ -48,6 +48,11 @@
<directory suffix="Test.php">./tests/Belgium</directory>
</testsuite>

<!-- Test Suite for holidays in Bosnia & Herzegovina -->
<testsuite name="Bosnia">
<directory suffix="Test.php">./tests/Bosnia</directory>
</testsuite>

<!-- Test Suite for holidays in Brazil -->
<testsuite name="Brazil">
<directory suffix="Test.php">./tests/Brazil</directory>
Expand Down
4 changes: 2 additions & 2 deletions src/Yasumi/Exception/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2018 AzuyaLabs
* 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 <stelgenhof@gmail.com>
* @author Sacha Telgenhof <me@sachatelgenhof.com>
*/

namespace Yasumi\Exception;
Expand Down
10 changes: 5 additions & 5 deletions src/Yasumi/Exception/InvalidDateException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2018 AzuyaLabs
* 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 <stelgenhof@gmail.com>
* @author Sacha Telgenhof <me@sachatelgenhof.com>
*/

namespace Yasumi\Exception;
Expand All @@ -27,7 +27,7 @@ class InvalidDateException extends InvalidArgumentException implements Exception
*/
public function __construct($argumentValue)
{
$type = gettype($argumentValue);
$type = \gettype($argumentValue);
switch ($type) {
case 'boolean':
$displayName = $argumentValue ? 'true' : 'false';
Expand All @@ -40,13 +40,13 @@ public function __construct($argumentValue)
$displayName = $argumentValue;
break;
case 'object':
$displayName = get_class($argumentValue);
$displayName = \get_class($argumentValue);
break;
default:
$displayName = $type;
break;
}

parent::__construct(sprintf(sprintf('\'%s\' is not a valid DateTime(Immutable) instance', $displayName)));
parent::__construct(\sprintf(\sprintf('\'%s\' is not a valid DateTime(Immutable) instance', $displayName)));
}
}
4 changes: 2 additions & 2 deletions src/Yasumi/Exception/UnknownLocaleException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2018 AzuyaLabs
* 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 <stelgenhof@gmail.com>
* @author Sacha Telgenhof <me@sachatelgenhof.com>
*/

namespace Yasumi\Exception;
Expand Down
16 changes: 8 additions & 8 deletions src/Yasumi/Filters/BankHolidaysFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2018 AzuyaLabs
* 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 <stelgenhof@gmail.com>
* @author Sacha Telgenhof <me@sachatelgenhof.com>
*/

namespace Yasumi\Filters;
Expand All @@ -33,22 +33,22 @@ class BankHolidaysFilter extends FilterIterator implements Countable
*
* @return bool
*/
public function accept()
public function accept(): bool
{
return $this->getInnerIterator()->current()->getType() === Holiday::TYPE_BANK;
}

/**
* @return integer Returns the number of filtered holidays.
*/
public function count()
public function count(): int
{
$days = array_keys(iterator_to_array($this));
$days = \array_keys(\iterator_to_array($this));

array_walk($days, function (&$day) {
$day = str_replace('substituteHoliday:', '', $day);
\array_walk($days, function (&$day) {
$day = \str_replace('substituteHoliday:', '', $day);
});

return count(array_unique($days));
return \count(\array_unique($days));
}
}
Loading

0 comments on commit f66dd77

Please sign in to comment.