Skip to content

Commit 4d186f1

Browse files
committed
Remove traces of call invokers
1 parent 4e2af61 commit 4d186f1

26 files changed

+260
-1273
lines changed

examples/directory_ls.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
$filesystem = \React\Filesystem\Filesystem::create($loop);
88
echo 'Using ', get_class($filesystem->getAdapter()), PHP_EOL;
9-
$filesystem->dir(__DIR__ . DIRECTORY_SEPARATOR . 'tmp')->ls()->then(function (array $list) {
9+
$filesystem->dir(__DIR__)->ls()->then(function (array $list) {
1010
foreach ($list as $node) {
1111
echo get_class($node), ': ', $node->getPath(), PHP_EOL;
1212
}
13-
}, function ($e) {
14-
echo $e->getMessage(), PHP_EOL;
13+
})->then(null, function ($error) {
14+
echo (string)$error;
1515
});
1616

1717
$loop->run();

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
convertErrorsToExceptions="true"
77
convertNoticesToExceptions="true"
88
convertWarningsToExceptions="true"
9-
processIsolation="false"
9+
processIsolation="true"
1010
stopOnFailure="false"
1111
syntaxCheck="false"
1212
bootstrap="tests/bootstrap.php"

src/AdapterInterface.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@ public function getLoop();
3333
*/
3434
public function setFilesystem(FilesystemInterface $filesystem);
3535

36-
/**
37-
* Set the call invoker for this adapter.
38-
*
39-
* @param CallInvokerInterface $invoker
40-
* @return void
41-
*/
42-
public function setInvoker(CallInvokerInterface $invoker);
43-
4436
/**
4537
* Call the underlying filesystem.
4638
*

src/CallInvokerInterface.php

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/ChildProcess/Adapter.php

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use React\Filesystem\ObjectStream;
99
use React\Filesystem\ObjectStreamSink;
1010
use React\Filesystem\AdapterInterface;
11-
use React\Filesystem\CallInvokerInterface;
1211
use React\Filesystem\FilesystemInterface;
1312
use React\Filesystem\MappedTypeDetector;
1413
use React\Filesystem\ModeTypeDetector;
@@ -64,11 +63,6 @@ class Adapter implements AdapterInterface
6463
*/
6564
protected $permissionFlagResolver;
6665

67-
/**
68-
* @var CallInvokerInterface
69-
*/
70-
protected $invoker;
71-
7266
/**
7367
* @var array
7468
*/
@@ -85,7 +79,6 @@ public function __construct(LoopInterface $loop, array $options = [])
8579
{
8680
$this->loop = $loop;
8781

88-
$this->invoker = \React\Filesystem\getInvoker($this, $options, 'invoker', 'React\Filesystem\InstantInvoker');
8982
$this->openFileLimiter = new OpenFileLimiter(\React\Filesystem\getOpenFileLimit($options));
9083
$this->permissionFlagResolver = new PermissionFlagResolver();
9184

@@ -145,15 +138,6 @@ public function setFilesystem(FilesystemInterface $filesystem)
145138
];
146139
}
147140

148-
/**
149-
* @param CallInvokerInterface $invoker
150-
* @return void
151-
*/
152-
public function setInvoker(CallInvokerInterface $invoker)
153-
{
154-
$this->invoker = $invoker;
155-
}
156-
157141
/**
158142
* @param string $function
159143
* @param array $args
@@ -176,7 +160,7 @@ public function callFilesystem($function, $args, $errorResultCode = -1)
176160
*/
177161
public function chmod($path, $mode)
178162
{
179-
return $this->invoker->invokeCall('chmod', [
163+
return $this->callFilesystem('chmod', [
180164
'path' => $path,
181165
'mode' => decoct($mode),
182166
]);
@@ -189,7 +173,7 @@ public function chmod($path, $mode)
189173
*/
190174
public function mkdir($path, $mode = self::CREATION_MODE)
191175
{
192-
return $this->invoker->invokeCall('mkdir', [
176+
return $this->callFilesystem('mkdir', [
193177
'path' => $path,
194178
'mode' => decoct($this->permissionFlagResolver->resolve($mode)),
195179
]);
@@ -271,7 +255,7 @@ public function close($fd)
271255
*/
272256
public function rmdir($path)
273257
{
274-
return $this->invoker->invokeCall('rmdir', [
258+
return $this->callFilesystem('rmdir', [
275259
'path' => $path,
276260
]);
277261
}
@@ -282,7 +266,7 @@ public function rmdir($path)
282266
*/
283267
public function unlink($path)
284268
{
285-
return $this->invoker->invokeCall('unlink', [
269+
return $this->callFilesystem('unlink', [
286270
'path' => $path,
287271
]);
288272
}
@@ -295,7 +279,7 @@ public function unlink($path)
295279
*/
296280
public function chown($path, $uid, $gid)
297281
{
298-
return $this->invoker->invokeCall('chown', [
282+
return $this->callFilesystem('chown', [
299283
'path' => $path,
300284
'uid' => $uid,
301285
'gid' => $gid,
@@ -308,7 +292,7 @@ public function chown($path, $uid, $gid)
308292
*/
309293
public function stat($filename)
310294
{
311-
return $this->invoker->invokeCall('stat', [
295+
return $this->callFilesystem('stat', [
312296
'path' => $filename,
313297
])->then(function ($stat) {
314298
$stat['atime'] = new DateTime('@' . $stat['atime']);
@@ -335,7 +319,7 @@ public function lsStream($path)
335319
{
336320
$stream = new ObjectStream();
337321

338-
$this->invoker->invokeCall('readdir', [
322+
$this->callFilesystem('readdir', [
339323
'path' => $path,
340324
'flags' => $this->options['lsFlags'],
341325
])->then(function ($result) use ($path, $stream) {
@@ -372,7 +356,7 @@ protected function processLsContents($basePath, $result, ObjectStream $stream)
372356
*/
373357
public function touch($path, $mode = self::CREATION_MODE)
374358
{
375-
return $this->invoker->invokeCall('touch', [
359+
return $this->callFilesystem('touch', [
376360
'path' => $path,
377361
'mode' => decoct($this->permissionFlagResolver->resolve($mode)),
378362
]);
@@ -385,7 +369,7 @@ public function touch($path, $mode = self::CREATION_MODE)
385369
*/
386370
public function rename($fromPath, $toPath)
387371
{
388-
return $this->invoker->invokeCall('rename', [
372+
return $this->callFilesystem('rename', [
389373
'from' => $fromPath,
390374
'to' => $toPath,
391375
]);
@@ -397,7 +381,7 @@ public function rename($fromPath, $toPath)
397381
*/
398382
public function readlink($path)
399383
{
400-
return $this->invoker->invokeCall('readlink', [
384+
return $this->callFilesystem('readlink', [
401385
'path' => $path,
402386
])->then(function ($result) {
403387
return \React\Promise\resolve($result['path']);
@@ -411,7 +395,7 @@ public function readlink($path)
411395
*/
412396
public function symlink($fromPath, $toPath)
413397
{
414-
return $this->invoker->invokeCall('symlink', [
398+
return $this->callFilesystem('symlink', [
415399
'from' => $fromPath,
416400
'to' => $toPath,
417401
])->then(function ($result) {

0 commit comments

Comments
 (0)