1
0
mirror of https://github.com/danog/file.git synced 2024-11-26 20:04:51 +01:00

Use short list syntax (#40)

This commit is contained in:
Jáchym Toušek 2020-03-06 21:06:39 +01:00 committed by GitHub
parent 041d8b38b0
commit 9e8bb4defe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 16 deletions

View File

@ -64,7 +64,7 @@ final class EioDriver implements Driver
private function onOpenHandle(array $openArr, $result, $req): void
{
list($mode, $path, $deferred) = $openArr;
[$mode, $path, $deferred] = $openArr;
if ($result === -1) {
$deferred->fail(new FilesystemException(\eio_get_last_error($req)));
@ -79,7 +79,7 @@ final class EioDriver implements Driver
private function onOpenFtruncate(array $openArr, $result, $req): void
{
list($fh, $mode, $path, $deferred) = $openArr;
[$fh, $mode, $path, $deferred] = $openArr;
if ($result === -1) {
$deferred->fail(new FilesystemException(\eio_get_last_error($req)));
@ -91,7 +91,7 @@ final class EioDriver implements Driver
private function onOpenFstat(array $openArr, $result, $req): void
{
list($fh, $mode, $path, $deferred) = $openArr;
[$fh, $mode, $path, $deferred] = $openArr;
if ($result === -1) {
$deferred->fail(new FilesystemException(\eio_get_last_error($req)));
} else {
@ -122,7 +122,7 @@ final class EioDriver implements Driver
private function onStat(array $data, $result, $req): void
{
list($deferred, $path) = $data;
[$deferred, $path] = $data;
if ($result === -1) {
$deferred->resolve(null);
} else {
@ -379,7 +379,7 @@ final class EioDriver implements Driver
private function onUnlink(array $data, $result, $req): void
{
list($deferred, $path) = $data;
[$deferred, $path] = $data;
if ($result === -1) {
$deferred->fail(new FilesystemException(\eio_get_last_error($req)));
@ -449,7 +449,7 @@ final class EioDriver implements Driver
private function onRmdir(array $data, $result, $req): void
{
list($deferred, $path) = $data;
[$deferred, $path] = $data;
if ($result === -1) {
$deferred->fail(new FilesystemException(\eio_get_last_error($req)));
@ -559,7 +559,7 @@ final class EioDriver implements Driver
private function onGetFstat(array $fhAndPromisor, $result, $req): void
{
list($fh, $deferred) = $fhAndPromisor;
[$fh, $deferred] = $fhAndPromisor;
if ($result === -1) {
$deferred->fail(new FilesystemException(\eio_get_last_error($req)));
@ -574,7 +574,7 @@ final class EioDriver implements Driver
private function onGetRead(array $fhAndPromisor, $result, $req): void
{
list($fh, $deferred) = $fhAndPromisor;
[$fh, $deferred] = $fhAndPromisor;
\eio_close($fh);
@ -605,7 +605,7 @@ final class EioDriver implements Driver
private function onPutOpen(array $data, $result, $req): void
{
list($contents, $deferred) = $data;
[$contents, $deferred] = $data;
if ($result === -1) {
$deferred->fail(new FilesystemException(\eio_get_last_error($req)));
@ -621,7 +621,7 @@ final class EioDriver implements Driver
private function onPutWrite(array $fhAndPromisor, $result, $req): void
{
list($fh, $deferred) = $fhAndPromisor;
[$fh, $deferred] = $fhAndPromisor;
\eio_close($fh);

View File

@ -34,7 +34,7 @@ final class ParallelDriver implements Driver
return call(function () use ($path, $mode) {
$worker = $this->pool->getWorker();
try {
list($id, $size, $mode) = yield $worker->enqueue(new Internal\FileTask("fopen", [$path, $mode]));
[$id, $size, $mode] = yield $worker->enqueue(new Internal\FileTask("fopen", [$path, $mode]));
} catch (TaskException $exception) {
throw new FilesystemException("Could not open file", $exception);
} catch (WorkerException $exception) {

View File

@ -60,7 +60,7 @@ final class UvDriver implements Driver
if ($fh) {
$this->onOpenHandle($fh, $openArr);
} else {
list(, $path, $deferred) = $openArr;
[, $path, $deferred] = $openArr;
$deferred->fail(new FilesystemException(
"Failed opening file handle to $path"
));
@ -93,14 +93,14 @@ final class UvDriver implements Driver
private function onOpenHandle($fh, array $openArr): void
{
list($mode) = $openArr;
[$mode] = $openArr;
if ($mode[0] === "w") {
\uv_fs_ftruncate($this->loop, $fh, $length = 0, function ($fh) use ($openArr): void {
if ($fh) {
$this->finalizeHandle($fh, $size = 0, $openArr);
} else {
list(, $path, $deferred) = $openArr;
[, $path, $deferred] = $openArr;
$deferred->fail(new FilesystemException(
"Failed truncating file $path"
));
@ -112,7 +112,7 @@ final class UvDriver implements Driver
StatCache::set($openArr[1], $stat);
$this->finalizeHandle($fh, $stat["size"], $openArr);
} else {
list(, $path, $deferred) = $openArr;
[, $path, $deferred] = $openArr;
$deferred->fail(new FilesystemException(
"Failed reading file size from open handle pointing to $path"
));
@ -123,7 +123,7 @@ final class UvDriver implements Driver
private function finalizeHandle($fh, $size, array $openArr): void
{
list($mode, $path, $deferred) = $openArr;
[$mode, $path, $deferred] = $openArr;
$handle = new UvFile($this->driver, $this->poll, $fh, $path, $mode, $size);
$deferred->resolve($handle);
}