Skip to content

Commit 5990d53

Browse files
author
Charlotte Dunois
committed
Update readme and examples
1 parent 99c4464 commit 5990d53

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ List contents
124124
-------------
125125

126126
```php
127-
$filesystem->dir(__DIR__)->ls()->then(function (\SplObjectStorage $list) {
127+
$filesystem->dir(__DIR__)->ls()->then(function (array $list) {
128128
foreach ($list as $node) {
129129
echo $node->getPath(), PHP_EOL;
130130
}

examples/directory_create_recursive.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
echo 'Creating directory: ' . $dirName, PHP_EOL;
1414
$dir->createRecursive('rwxrwx---')->then(function () use ($startDir) {
1515
return $startDir->lsRecursive();
16-
})->then(function (\SplObjectStorage $list) {
16+
})->then(function (array $list) {
1717
foreach ($list as $node) {
1818
echo $node->getPath(), PHP_EOL;
1919
}

examples/directory_ls.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
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 (\SplObjectStorage $list) {
9+
$filesystem->dir(__DIR__ . DIRECTORY_SEPARATOR . 'tmp')->ls()->then(function (array $list) {
1010
foreach ($list as $node) {
1111
echo get_class($node), ': ', $node->getPath(), PHP_EOL;
1212
}

examples/directory_ls_recursive.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
$filesystem = \React\Filesystem\Filesystem::create($loop);
88
echo 'Using ', get_class($filesystem->getAdapter()), PHP_EOL;
9-
$filesystem->dir(dirname(__DIR__))->lsRecursive()->then(function (\SplObjectStorage $list) {
9+
$filesystem->dir(dirname(__DIR__))->lsRecursive()->then(function (array $list) {
1010
foreach ($list as $node) {
1111
echo $node->getPath(), PHP_EOL;
1212
}

examples/directory_ls_recursive_regexp_interfaces.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66

77
$filesystem = \React\Filesystem\Filesystem::create($loop);
88
echo 'Using ', get_class($filesystem->getAdapter()), PHP_EOL;
9-
$filesystem->dir(dirname(__DIR__))->lsRecursive()->then(function (\SplObjectStorage $list) {
10-
$interfaces = new RegexIterator($list, '/.*?Interface.php$/');
9+
$filesystem->dir(dirname(__DIR__))->lsRecursive()->then(function (array $list) {
10+
$iterator = new ArrayIterator($list);
11+
$interfaces = new RegexIterator($iterator, '/.*?Interface.php$/');
12+
1113
foreach ($interfaces as $node) {
1214
echo $node->getPath(), PHP_EOL;
1315
}

0 commit comments

Comments
 (0)