feat: add Peru holiday provider#405
Open
giovanny07 wants to merge 26 commits intoazuyalabs:developfrom
Open
Conversation
Bumps [actions/stale](https://github.com/actions/stale) from 10.1.1 to 10.2.0. Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Added an initial AGENTS.md that provides the context and instructions to help AI coding agents work on Yasumi. More information about AGENTS.md files can be found here: https://agents.md/ Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
When a randomized test fails, the PHPUnit output does not show which year or date triggered the failure. Some assertion methods already use sprintf to embed the year in failure messages, but some other assertion methods do not. Also added a generic context in other places where it could help identifying failures. In addition, removed redundant assertions as in PHPUnit many stronger assertions already imply weaker ones. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
The `generateRandomYear()` method defaults to 1000–9999. Testing year 7000 for whether Christmas falls on December 25th does not add value. The more meaningful edge years — leap years, century years, years near known rule changes — are statistically unlikely to be hit in multiple iterations across a 9000-year window. Tightening the default range will improve coverage of relevant edge cases while reducing run time. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
Some additional classes have assertions that can benefit from having a failure message. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
Fixed a few tests for the NYSE provider: - While the provider and GroundZeroTest.php files both use the holiday name `groundZero1-4`, NYSETest.php uses name `WTCAttack1-4`. - The test conditions for `juneteenth` and `CarterMourning` were incongruent to the logic defined by the provider. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
Adds a new holiday provider for Andorra (AD) with support for all 14 public holidays, test coverage, and Andorran locale translations. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
The `initialize()` method declared in the `ProviderInterface` is redundant. End users of the API never need to call `initialize` themselves; it is an internal construction detail (the `AbstractProvider` class calls this method to have each concrete provider fills in the holiday registration. Hence, it should be an abstract method on the `AbstractProvider` class so that concrete providers still must implement it. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
This method has been deprecated and is not used anywhere in the codebase, and thus can be removed safely. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
The `getHoliday()` method triggers sorting unnecessarily. It is simply performing a keyed lookup with no need for the holiday list to be sorted chronologically first. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
The `removeKey()` method skips the key validation, while every other method that is performing a keyed lookup, is checking for an empty key value. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
Unlike `getHolidays()` and `getHolidayDates()`, this method doesn't sort first. The names returned may be in insertion order rather than chronological order, which would be inconsistent with the other methods. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
`extremaduraDay` is only established from 1985, while the test was set from and including 1984. When the year 1984 is picked, `extremaduraDay` won't exist, causing the test to fail. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
`twoDaysLaterNewYearsDay` was celebrated until 1989, not in 1990 anymore, while the test was set to and including 1990. When the year 1990 is picked, `twoDaysLaterNewYearsDay` won't exists, causing the test to fail. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
Return false from callbacks in OurLadyOfSorrowsDayTest and VictoryInEuropeDayTest to properly skip years 2025 and 2026; previously the bare return had no effect and excluded years could still appear in the generated test data. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
- Fixed off-by-one: newYearsDay type boundary changed from <= to < 1974 (1974 should be TYPE_BANK, not TYPE_OBSERVANCE) - Fixed test holiday count conditions using wrong variable ($this->year instead of $year) with inverted comparison direction - Fixed generateRandomYear range for bank holiday type assertions - Added sources to UK, Scotland, and NorthernIreland providers Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
- Removed missingType.generics suppression by adding proper generic type annotations to AbstractFilter, AbstractProvider, ProviderInterface, BetweenFilter, and OnFilter - Added runtime instanceof ProviderInterface guard in Yasumi::create() and throw ProviderNotFoundException if not satisfied - Added is_string() guard after preg_replace() in getProviders() and narrow return type PHPDoc to array<string, string> - Fixed null-unsafe usage of getHoliday() result in examples/basic.php - Added test covering the new ProviderInterface guard in create() Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
Added a new holiday provider for San Marino (SM) with support for all 18 public holidays, test coverage, and Italian locale translations. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
Added missing test suites for the Andorra, Bulgaria, Iran, and Mexico holiday providers. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
The `generateRandomYear(1981)` function could produce years before 1983, but `murciaDay` is only added from 1983 (first celebration). Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
Improved the contribution guidelines as it was missing a few essential
pointers:
- Added guidance on Conventional Commits.
- Added DCO sign-off requirement with example command.
- Added branching strategy (branch off develop, target develop).
- Added a "Before Submitting" section with the full composer cs /
composer phpstan / composer test checklist.
Additionnally corrected the PHPUnit version mentioned in the AGENTS.md
file. Furthermore, updated/corrected the list of supported versions in
SECURITY.md and replaced the public issue link for vulnerability reporting
with GitHub's private security advisory URL to prevent disclosing
unpatched vulnerabilities publicly.
Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
Add Peru (PE) holiday provider with 16 national holidays established by Decreto Legislativo N° 713 (Ley de Descansos Remunerados, Art. 6) as amended through 2023. Fixed holidays (Art. 7 — never moved): - New Year's Day (1 Jan) - Maundy Thursday and Good Friday (Easter-relative) - International Workers' Day (1 May) - Independence Day — Fiestas Patrias Day 1 (28 Jul, since 1821) - Independence Celebration Day — Gran Parada Militar (29 Jul, since 1821) - Christmas Day (25 Dec) Movable holidays (Art. 7 — observed on following Monday): - Battle of Arica and Flag Day (7 Jun, since 1880) - Saint Peter and Saint Paul Day (29 Jun) - Air Force Day (23 Jul, since 1929) - Battle of Junín (6 Aug, since 1824) - Saint Rose of Lima (30 Aug) - Battle of Angamos (8 Oct, since 1879) - All Saints' Day (1 Nov) - Immaculate Conception (8 Dec) - Battle of Ayacucho (9 Dec, since 1824) Includes 18 test files with testAlwaysFallsOnMonday() coverage for all 9 movable holidays and year-guard tests for historical holidays. Signed-off-by: Giovanny Rodriguez <giovanny.rodriguez@imagunet.com>
Signed-off-by: Giovanny Rodriguez <giovanny.rodriguez@imagunet.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Peru (PE) holiday provider with 16 national holidays established by Decreto Legislativo N° 713 (Ley de Descansos Remunerados, Art. 6) as amended through 2023.
Fixed holidays (Art. 7 — never moved):
Movable holidays (Art. 7 — observed on following Monday):
Includes 18 test files with testAlwaysFallsOnMonday() coverage for all 9 movable holidays and year-guard tests for historical holidays.