Skip to content

[Clock] Assign the clock returned by withTimeZone() - #23532

Merged
javiereguiluz merged 1 commit into
symfony:7.4from
BenMacha:docs-clock-with-timezone
Dec 2, 2026
Merged

javiereguiluz merged 1 commit into
symfony:7.4from
BenMacha:docs-clock-with-timezone

Conversation

@BenMacha

Copy link
Copy Markdown
Contributor

withTimeZone() returns a new clock instance (the clocks are immutable), so calling $clock->withTimeZone('Europe/Paris'); without using the result has no effect and $clock->now() on the next line still uses the original timezone. This assigns the result back to $clock and says why in the comment.

@javiereguiluz

Copy link
Copy Markdown
Member

Good catch, thanks @BenMacha.

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.

3 participants