Skip to content

Commit

Permalink
GitRepository: fixed usage of \DateTimeInterface::ATOM
Browse files Browse the repository at this point in the history
  • Loading branch information
janpecha committed Apr 29, 2021
1 parent e672098 commit 3d92b7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/GitRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public function getCommit($commitId)

// author date
$result = $this->run('log', '-1', $commitId, '--pretty="format:%ad"', '--date=iso-strict');
$authorDate = \DateTimeImmutable::createFromFormat(\DateTimeInterface::ATOM, (string) $result->getOutputLastLine());
$authorDate = \DateTimeImmutable::createFromFormat(\DateTime::ATOM, (string) $result->getOutputLastLine());

if (!($authorDate instanceof \DateTimeImmutable)) {
throw new GitException('Failed fetching of commit author date.', 0, NULL, $result);
Expand All @@ -410,7 +410,7 @@ public function getCommit($commitId)

// committer date
$result = $this->run('log', '-1', $commitId, '--pretty="format:%cd"', '--date=iso-strict');
$committerDate = \DateTimeImmutable::createFromFormat(\DateTimeInterface::ATOM, (string) $result->getOutputLastLine());
$committerDate = \DateTimeImmutable::createFromFormat(\DateTime::ATOM, (string) $result->getOutputLastLine());

if (!($committerDate instanceof \DateTimeImmutable)) {
throw new GitException('Failed fetching of commit committer date.', 0, NULL, $result);
Expand Down
4 changes: 2 additions & 2 deletions tests/GitPhp/GitRepository.getCommit.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ test(function () {
['2021-04-29T17:55:09+02:00']
);

$timestamp = \DateTimeImmutable::createFromFormat(\DateTimeInterface::ATOM, '2021-04-29T16:55:09+01:00')->getTimestamp();
$timestamp = \DateTimeImmutable::createFromFormat(\DateTime::ATOM, '2021-04-29T16:55:09+01:00')->getTimestamp();

$repo = $git->open(__DIR__);
$commit = $repo->getLastCommit();
Expand Down Expand Up @@ -152,7 +152,7 @@ test(function () {
['2021-04-29T17:55:09+02:00']
);

$timestamp = \DateTimeImmutable::createFromFormat(\DateTimeInterface::ATOM, '2021-04-29T16:55:09+01:00')->getTimestamp();
$timestamp = \DateTimeImmutable::createFromFormat(\DateTime::ATOM, '2021-04-29T16:55:09+01:00')->getTimestamp();

$repo = $git->open(__DIR__);
$commit = $repo->getCommit('734713bc047d87bf7eac9674765ae793478c50d3');
Expand Down

0 comments on commit 3d92b7e

Please sign in to comment.