Skip to content

Commit

Permalink
Update phpcs-tool to 9.1.0 with Hostnet-Level-1 (#11)
Browse files Browse the repository at this point in the history
* Explicitly configure allow-plugins
* Add phpcs to github workflow
* Update phpcs-tool to 9.1.0 with Hostnet-Level-1
  • Loading branch information
janlam7 authored May 4, 2022
1 parent c3ee015 commit a6972ed
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 38 deletions.
49 changes: 25 additions & 24 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@ name: CI
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: ['7.3', '7.4', '8.0']
name: PHP ${{ matrix.php-versions }}
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: composer install
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: phpunit
run: php vendor/bin/phpunit
test:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: ['7.3', '7.4', '8.0']
name: PHP ${{ matrix.php-versions }}
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: composer install
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: phpunit
run: php vendor/bin/phpunit
- name: phpcs
run: php vendor/bin/phpcs
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"php": "^7.3||^8.0"
},
"require-dev": {
"hostnet/phpcs-tool": "^8.3",
"hostnet/phpcs-tool": "^9.1.0",
"phpunit/phpunit": "^9.5.6"
},
"autoload": {
Expand All @@ -18,5 +18,11 @@
"psr-4": {
"Hostnet\\Component\\BankHoliday\\": "test/"
}
},
"config": {
"allow-plugins": {
"hostnet/*": true,
"dealerdirect/phpcodesniffer-composer-installer": false
}
}
}
4 changes: 4 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<ruleset name="bank-holiday-component PHPCS">
<rule ref="Hostnet-Level-1"/>
</ruleset>
24 changes: 12 additions & 12 deletions src/BankHoliday.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,58 +15,58 @@ final class BankHoliday
/**
* The first day of a year.
*/
const NEW_YEARS_DAY = 'new_years_day';
public const NEW_YEARS_DAY = 'new_years_day';

/**
* The sunday of easter.
*/
const EASTER_SUNDAY = 'easter_sunday';
public const EASTER_SUNDAY = 'easter_sunday';

/**
* The monday of easter.
*/
const EASTER_MONDAY = 'easter_monday';
public const EASTER_MONDAY = 'easter_monday';

/**
* The Dutch bank holiday Kings day.
*/
const DUTCH_KINGS_DAY = 'dutch_kings_day';
public const DUTCH_KINGS_DAY = 'dutch_kings_day';

/**
* Bank holiday on May 5th, denoting the end of WW2 in The Netherlands.
* This is, for the majority of the Dutch population, a bank holiday once every five years.
*/
const DUTCH_LIBERATION_DAY = 'dutch_liberation_day';
public const DUTCH_LIBERATION_DAY = 'dutch_liberation_day';

/**
* Ascension day (Christian holiday).
*/
const ASCENSION_DAY = 'ascension_day';
public const ASCENSION_DAY = 'ascension_day';

/**
* Whit sunday (Christian holiday).
*/
const WHIT_SUNDAY = 'whit_sunday';
public const WHIT_SUNDAY = 'whit_sunday';

/**
* Whit monday is a bank holiday that follows the Christian holiday whit sunday.
*/
const WHIT_MONDAY = 'whit_monday';
public const WHIT_MONDAY = 'whit_monday';

/**
* Christmas day, always on December 25th.
*/
const CHRISTMAS_DAY = 'christmas_day';
public const CHRISTMAS_DAY = 'christmas_day';

/**
* The day after christmas day.
*/
const BOXING_DAY = 'boxing_day';
public const BOXING_DAY = 'boxing_day';

/**
* All bank holidays that are defined in this class.
*/
const ALL = [
public const ALL = [
self::DUTCH_LIBERATION_DAY,
self::ASCENSION_DAY,
self::BOXING_DAY,
Expand All @@ -82,7 +82,7 @@ final class BankHoliday
/**
* Set of Dutch bank holidays.
*/
const DUTCH_BANK_HOLIDAY_SET = [
public const DUTCH_BANK_HOLIDAY_SET = [
self::NEW_YEARS_DAY,
self::EASTER_MONDAY,
self::DUTCH_KINGS_DAY,
Expand Down
2 changes: 1 addition & 1 deletion src/BankHolidayResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,6 @@ private function getDutchLiberationDate(int $year)
return null;
}

return new \DateTime(sprintf("%d-05-05", $year));
return new \DateTime(sprintf('%d-05-05', $year));
}
}

0 comments on commit a6972ed

Please sign in to comment.