Skip to content

Commit 3d92b7e

Browse files
committed
GitRepository: fixed usage of \DateTimeInterface::ATOM
1 parent e672098 commit 3d92b7e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/GitRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ public function getCommit($commitId)
394394

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

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

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

415415
if (!($committerDate instanceof \DateTimeImmutable)) {
416416
throw new GitException('Failed fetching of commit committer date.', 0, NULL, $result);

tests/GitPhp/GitRepository.getCommit.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ test(function () {
7373
['2021-04-29T17:55:09+02:00']
7474
);
7575

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

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

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

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

0 commit comments

Comments
 (0)