Skip to content

Commit 1b7bd54

Browse files
authored
Merge pull request #48 from CharlotteDunoisLabs/patch-stream
Remove opinionated usage of adapter & things
2 parents c708966 + 476673c commit 1b7bd54

File tree

8 files changed

+6
-20
lines changed

8 files changed

+6
-20
lines changed

src/ChildProcess/Adapter.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@
1010
use React\Filesystem\FilesystemInterface;
1111
use React\Filesystem\MappedTypeDetector;
1212
use React\Filesystem\ModeTypeDetector;
13-
use React\Filesystem\Node\NodeInterface;
14-
use React\Filesystem\ObjectStream;
1513
use React\Filesystem\OpenFileLimiter;
1614
use React\Filesystem\PermissionFlagResolver;
1715
use React\Filesystem\Stream\StreamFactory;
18-
use React\Filesystem\TypeDetectorInterface;
19-
use React\Promise\FulfilledPromise;
2016
use React\Promise\PromiseInterface;
2117
use WyriHaximus\React\ChildProcess\Messenger\Messages\Factory;
2218
use WyriHaximus\React\ChildProcess\Messenger\Messages\Payload;

src/InstantInvoker.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace React\Filesystem;
44

55
use React\EventLoop\LoopInterface;
6-
use React\Promise\Deferred;
76

87
class InstantInvoker implements CallInvokerInterface
98
{

src/Node/File.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use React\Filesystem\ObjectStream;
88
use React\Filesystem\ObjectStreamSink;
99
use React\Filesystem\Stream\GenericStreamInterface;
10-
use React\Promise\Deferred;
1110
use React\Promise\FulfilledPromise;
1211
use React\Promise\RejectedPromise;
1312
use React\Promise\Stream;

src/Node/FileInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use React\Filesystem\AdapterInterface;
66
use React\Promise\PromiseInterface;
7-
use React\Stream\WritableStreamInterface;
87

98
interface FileInterface extends NodeInterface
109
{

src/Stream/DuplexStream.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Evenement\EventEmitter;
66
use React\Filesystem\AdapterInterface;
77
use React\Stream\DuplexStreamInterface;
8-
use React\Filesystem\ThrottledQueuedInvoker;
98
use React\Promise\FulfilledPromise;
109

1110
class DuplexStream extends EventEmitter implements DuplexStreamInterface, GenericStreamInterface
@@ -24,8 +23,6 @@ public function __construct($path, $fileDescriptor, AdapterInterface $filesystem
2423
$this->path = $path;
2524
$this->setFilesystem($filesystem);
2625
$this->fileDescriptor = $fileDescriptor;
27-
28-
$this->callInvoker = new ThrottledQueuedInvoker($filesystem);
2926
}
3027

3128
protected function readChunk()
@@ -45,7 +42,7 @@ protected function resolveSize()
4542
return new FulfilledPromise();
4643
}
4744

48-
return $this->callInvoker->invokeCall('eio_stat', [$this->path])->then(function ($stat) {
45+
return $this->getFilesystem()->stat($this->path)->then(function ($stat) {
4946
$this->size = $stat['size'];
5047
return new FulfilledPromise();
5148
});

src/Stream/GenericStreamTrait.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
namespace React\Filesystem\Stream;
44

55
use React\Filesystem\AdapterInterface;
6-
use React\Filesystem\InstantInvoker;
76

87
trait GenericStreamTrait
98
{
109
protected $path;
1110
protected $filesystem;
1211
protected $fileDescriptor;
1312
protected $closed = false;
14-
protected $callInvoker;
1513

1614
/**
1715
* @param string $path
@@ -23,8 +21,6 @@ public function __construct($path, $fileDescriptor, AdapterInterface $filesystem
2321
$this->path = $path;
2422
$this->filesystem = $filesystem;
2523
$this->fileDescriptor = $fileDescriptor;
26-
27-
$this->callInvoker = new InstantInvoker($filesystem);
2824
}
2925

3026
/**

tests/Stream/ReadableStreamTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public function testReadChunk($className, $stat)
230230
$filesystem = $this->mockAdapter();
231231

232232
$filesystem
233-
->expects($this->at((int)!$stat + 0))
233+
->expects($this->at(0))
234234
->method('stat')
235235
->with($path)
236236
->will($this->returnValue(\React\Promise\resolve([
@@ -239,21 +239,21 @@ public function testReadChunk($className, $stat)
239239
;
240240

241241
$filesystem
242-
->expects($this->at((int)!$stat + 1))
242+
->expects($this->at(1))
243243
->method('read')
244244
->with($fileDescriptor, 8192, 0)
245245
->will($this->returnValue($readPromise))
246246
;
247247

248248
$filesystem
249-
->expects($this->at((int)!$stat + 2))
249+
->expects($this->at(2))
250250
->method('read')
251251
->with($fileDescriptor, 8192, 8192)
252252
->will($this->returnValue($readPromise))
253253
;
254254

255255
$filesystem
256-
->expects($this->at((int)!$stat + 3))
256+
->expects($this->at(3))
257257
->method('close')
258258
->with($fileDescriptor)
259259
->will($this->returnValue(new FulfilledPromise()))

tests/Stream/WritableStreamTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function classNamesProvider()
1616
],
1717
[
1818
'React\Filesystem\Stream\DuplexStream',
19-
1
19+
0
2020
],
2121
];
2222
}

0 commit comments

Comments
 (0)