Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: README region code example is incorrect #213

Closed
Vanilagy opened this issue Mar 21, 2024 · 1 comment · Fixed by #227
Closed

[Bug]: README region code example is incorrect #213

Vanilagy opened this issue Mar 21, 2024 · 1 comment · Fixed by #227
Labels
bug Something isn't working

Comments

@Vanilagy
Copy link

What happened?

Just like the README says, I tried doing this to get all holidays for Hesse, Germany:

Holidays::for(Germany::make(region: 'DE-HE'), year: $year)->get();

But this failed, as the make method doesn't take in named params. Instead, this works:

Holidays::for(Germany::make('DE-HE'), year: $year)->get();

How to reproduce the bug

Germany::make(region: 'DE-HE');

Package Version

1.8

PHP Version

8.3.0

Which operating systems does with happen with?

macOS

Notes

No response

@Vanilagy Vanilagy added the bug Something isn't working label Mar 21, 2024
@arnebr
Copy link
Contributor

arnebr commented May 13, 2024

This is true, the ::make function does not allow named parameters there. Some of the countries like Switzerland have set their constructor to public to enable something like new CountryName(region:'AB-CD') that will work then. I will make an adjustment PR to reflect it in the README.md thanks for hinting that.

The other option would be to shift each country to a public constructor to initiate each county like new CountryName(region) but this a big PR and @Nielsvanpach needs to decide that

arnebr added a commit to arnebr/holidays that referenced this issue May 13, 2024
Named parameters are given via func_get_args. Remove the parameter to example work.

Fixes spatie#213
Nielsvanpach pushed a commit that referenced this issue May 21, 2024
Named parameters are given via func_get_args. Remove the parameter to example work.

Fixes #213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants