Skip to content

Commit 53b31f3

Browse files
committed
DateTimeImmutable => DateTime for PHP 5.4
1 parent c1a284b commit 53b31f3

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/AbstractSyncAdapter.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace React\Filesystem;
44

5-
use DateTimeImmutable;
5+
use DateTime;
66
use React\Filesystem\Node\NodeInterface;
77
use React\Filesystem\Stream\StreamFactory;
88
use React\Promise\FulfilledPromise;
@@ -86,9 +86,9 @@ public function stat($filename)
8686
return $this->invoker->invokeCall('stat', [
8787
'path' => $filename,
8888
])->then(function ($stat) {
89-
$stat['atime'] = new DateTimeImmutable('@' . $stat['atime']);
90-
$stat['mtime'] = new DateTimeImmutable('@' . $stat['mtime']);
91-
$stat['ctime'] = new DateTimeImmutable('@' . $stat['ctime']);
89+
$stat['atime'] = new DateTime('@' . $stat['atime']);
90+
$stat['mtime'] = new DateTime('@' . $stat['mtime']);
91+
$stat['ctime'] = new DateTime('@' . $stat['ctime']);
9292
return \React\Promise\resolve($stat);
9393
});
9494
}

src/Eio/Adapter.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace React\Filesystem\Eio;
44

5-
use DateTimeImmutable;
5+
use DateTime;
66
use React\EventLoop\LoopInterface;
77
use React\Filesystem\AdapterInterface;
88
use React\Filesystem\CallInvokerInterface;
@@ -145,9 +145,9 @@ public function setReadDirInvoker(CallInvokerInterface $invoker)
145145
public function stat($filename)
146146
{
147147
return $this->invoker->invokeCall('eio_lstat', [$filename])->then(function ($stat) {
148-
$stat['atime'] = new DateTimeImmutable('@' .$stat['atime']);
149-
$stat['mtime'] = new DateTimeImmutable('@' .$stat['mtime']);
150-
$stat['ctime'] = new DateTimeImmutable('@' .$stat['ctime']);
148+
$stat['atime'] = new DateTime('@' .$stat['atime']);
149+
$stat['mtime'] = new DateTime('@' .$stat['mtime']);
150+
$stat['ctime'] = new DateTime('@' .$stat['ctime']);
151151
return \React\Promise\resolve($stat);
152152
});
153153
}

tests/Adapters/FileTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ public function testStat(LoopInterface $loop, FilesystemInterface $filesystem)
2828
$this->assertSame($actualStat[$key], $result[$key]);
2929
}
3030

31-
$this->assertInstanceOf('DateTimeImmutable', $result['atime']);
31+
$this->assertInstanceOf('DateTime', $result['atime']);
3232
$this->assertEquals($actualStat['atime'], $result['atime']->format('U'));
33-
$this->assertInstanceOf('DateTimeImmutable', $result['mtime']);
33+
$this->assertInstanceOf('DateTime', $result['mtime']);
3434
$this->assertEquals($actualStat['mtime'], $result['mtime']->format('U'));
35-
$this->assertInstanceOf('DateTimeImmutable', $result['atime']);
35+
$this->assertInstanceOf('DateTime', $result['atime']);
3636
$this->assertEquals($actualStat['ctime'], $result['ctime']->format('U'));
3737
}
3838

@@ -44,11 +44,11 @@ public function testTime(LoopInterface $loop, FilesystemInterface $filesystem)
4444
$actualStat = lstat(__FILE__);
4545
$result = $this->await($filesystem->file(__FILE__)->time(), $loop);
4646
$this->assertSame(3, count($result));
47-
$this->assertInstanceOf('DateTimeImmutable', $result['atime']);
47+
$this->assertInstanceOf('DateTime', $result['atime']);
4848
$this->assertEquals($actualStat['atime'], $result['atime']->format('U'));
49-
$this->assertInstanceOf('DateTimeImmutable', $result['mtime']);
49+
$this->assertInstanceOf('DateTime', $result['mtime']);
5050
$this->assertEquals($actualStat['mtime'], $result['mtime']->format('U'));
51-
$this->assertInstanceOf('DateTimeImmutable', $result['atime']);
51+
$this->assertInstanceOf('DateTime', $result['atime']);
5252
$this->assertEquals($actualStat['ctime'], $result['ctime']->format('U'));
5353
}
5454

0 commit comments

Comments
 (0)