Skip to content

Commit

Permalink
feat: deprecate Date::toDateTime() method (#749)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Challis <ben-challis@users.noreply.github.com>
  • Loading branch information
jan-j and ben-challis authored Aug 20, 2024
1 parent 8e199a4 commit 0114ecf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ public function offsetByYears(int $years): self

/**
* Provides a date time representation of this date in UTC.
*
* @deprecated Converting a date with no time to a datetime with time of 00:00:00 in a certain timezone assumes
* too much and should be handled downstream where the default/assumed time and the timezone is well known.
*/
public function toDateTime(): \DateTimeImmutable
{
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ parameters:
- '#Dynamic call to static method PHPUnit\\Framework\\.*#'
- '#^Call to an undefined static method DateTime(?:Immutable)?::createFromInterface\(\)\.$#'
- '#^Attribute class PHPUnit\\Framework\\Attributes\\CodeCoverageIgnore is deprecated: https://github.com/sebastianbergmann/phpunit/issues/5236$#'
- '#Call to deprecated method toDateTime\(\) of class Lendable\\Clock\\Date:.*#'

0 comments on commit 0114ecf

Please sign in to comment.