azuyalabs / yasumi

The easy PHP Library for calculating holidays
https://www.yasumi.dev
Other
1.05k stars 155 forks source link

Update methods visibility in multiple Providers #332

Closed attepulkkinen closed 10 months ago

attepulkkinen commented 10 months ago

This resolves #331

I'm mildly annoyed that some methods are named calculateHolidayName() and some are addHolidayName() and there are even holidayName() but I'm not sure if renaming these would break some backward compatibility somewhere…

I decided against adding tests because this commit doesn't include any logic changes.

attepulkkinen commented 10 months ago

Running that command on my computer gives no errors, but I'll write a fix manually.

Also, not sure if this is a known issue, but there is also the following deprecation warning

Detected deprecations in use:
- Rule set "@PER" is deprecated. Use "@PER-CS" instead.
attepulkkinen commented 10 months ago

Actually, this is a bit silly style fix. I don't think such type Australia\string actually exists… How do you want to continue?

--- /home/runner/work/yasumi/yasumi/src/Yasumi/Provider/Australia/AustralianCapitalTerritory.php
+++ /home/runner/work/yasumi/yasumi/src/Yasumi/Provider/Australia/AustralianCapitalTerritory.php
@@ -61,11 +61,11 @@
      *
      * @see https://en.wikipedia.org/wiki/Easter
      *
-     * @param int         $year     the year for which Easter Saturday need to be created
-     * @param string      $timezone the timezone in which Easter Saturday is celebrated
-     * @param string      $locale   the locale for which Easter Saturday need to be displayed in
-     * @param string|null $type     The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE,
-     *                              TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered.
+     * @param int                   $year     the year for which Easter Saturday need to be created
+     * @param string                $timezone the timezone in which Easter Saturday is celebrated
+     * @param string                $locale   the locale for which Easter Saturday need to be displayed in
+     * @param Australia\string|null $type     The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE,
+     *                                        TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered.
      *
      * @throws \Exception
      */

This seems to be related to friendsofphp/php-cs-fixer version upgrade (v3.46.0 => v3.47.0)

The long-term solution here would be to use enums when support for PHP 8.0 will be eventually dropped.

stelgenhof commented 10 months ago

Thanks for noticing the deprecated ruleset. With recent PHP CS fixer updates I have seen some similar odd changes (and reverted).

Actually, this is a bit silly style fix. I don't think such type Australia\string actually exists… How do you want to continue?

Yes this indeed is a bit silly. Let me see if I can correct all of this. Although not a fan of it (and shouldn't be necessary), perhaps we can pin PHP CS fixer to a specific version.

stelgenhof commented 10 months ago

@attepulkkinen I've made a small (hopefully temporary) change that addresses the latest PHP CS Fixer issues. You may want to rebase your branch and give it another try.

attepulkkinen commented 10 months ago

Thank you. Can you tell when the next version will be released?

stelgenhof commented 9 months ago

@attepulkkinen Apologies for missing your last question. Generally I release a new version if there are a number of valuable changes since the last release. So, at the moment, I don't have any new release scheduled soon.