Skip to content

Cleanup for new major (required by Cake6)#497

Draft
dereuromark wants to merge 2 commits into3.nextfrom
3.next-cleanup
Draft

Cleanup for new major (required by Cake6)#497
dereuromark wants to merge 2 commits into3.nextfrom
3.next-cleanup

Conversation

@dereuromark
Copy link
Member

@dereuromark dereuromark commented Feb 6, 2026

Summary

Major release cleanup for Chronos 4.0 / CakePHP 6.0 compatibility:

  • Remove the $range parameter from toQuarter() which was deprecated in 3.3.0
    • Users should use toQuarterRange() for quarter range functionality
  • Widen $toStringFormat property type from string to array|string|int
    • This allows CakePHP I18n classes to rename $_toStringFormat to $toStringFormat without type conflicts
    • Enables CakePHP upgrade tool to apply PSR naming conventions consistently
  • Remove outdated PHPStan ignore for DateTimeImmutable::createFromTimestamp() (now available in PHP 8.4)

Refs: cakephp/upgrade#386

Note:
The type widening is backwards compatible because CakePHP 5 I18n classes use their own $_toStringFormat property and override all related methods - they don't touch Chronos's property at all. The widening just enables
CakePHP 6 to do the PSR naming cleanup.

- Remove $range parameter from toQuarter() (deprecated in 3.3.0)
- Update tests to remove deprecated usage
- Remove outdated PHPStan ignore for createFromTimestamp()
@dereuromark dereuromark changed the title Remove deprecated toQuarter() $range parameter Cleanup for new major (required by Cake6) Feb 6, 2026
Allow subclasses to use IntlDateFormatter constants by widening
the $toStringFormat property type from string to array|string|int.
This enables CakePHP I18n classes to rename $_toStringFormat to
$toStringFormat without type conflicts.
@dereuromark dereuromark added this to the 4.x milestone Feb 6, 2026
* @var array|string|int
*/
protected static string $toStringFormat = self::DEFAULT_TO_STRING_FORMAT;
protected static array|string|int $toStringFormat = self::DEFAULT_TO_STRING_FORMAT;
Copy link
Contributor

@LordSimal LordSimal Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this considered a breaking change for non cakephp apps using this?

Copy link
Member Author

@dereuromark dereuromark Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thats BC breaking why this is targeting 4x, see milestone and PR descr.
Same as deprecation removal etc is.

But no, not for Cake Apps, explained above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants