Skip to content

Commit

Permalink
Rename missed properties
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Dec 13, 2024
1 parent dafeb20 commit db61c0f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions src/Driver/BlockingFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class BlockingFile implements File, \IteratorAggregate

private readonly DeferredFuture $onClose;

private ?LockType $lockMode = null;
private ?LockType $lockType = null;

/**
* @param resource $handle An open filesystem descriptor.
Expand Down Expand Up @@ -64,20 +64,20 @@ public function __destruct()
*/
public function getLockType(): ?LockType
{
return $this->lockMode;
return $this->lockType;
}

public function lock(LockType $type, ?Cancellation $cancellation = null): void
{
Internal\lock($this->path, $this->getFileHandle(), $type, $cancellation);
$this->lockMode = $type;
$this->lockType = $type;
}

public function tryLock(LockType $type): bool
{
$locked = Internal\tryLock($this->path, $this->getFileHandle(), $type);
if ($locked) {
$this->lockMode = $type;
$this->lockType = $type;
}

return $locked;
Expand All @@ -86,7 +86,7 @@ public function tryLock(LockType $type): bool
public function unlock(): void
{
Internal\unlock($this->path, $this->getFileHandle());
$this->lockMode = null;
$this->lockType = null;
}

public function read(?Cancellation $cancellation = null, int $length = self::DEFAULT_READ_LENGTH): ?string
Expand Down Expand Up @@ -161,7 +161,7 @@ public function close(): void
throw new StreamException("Failed closing file '{$this->path}'");
} finally {
\restore_error_handler();
$this->lockMode = null;
$this->lockType = null;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Driver/EioFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function close(): void
$this->closing->await();
} finally {
$this->poll->done();
$this->lockMode = null;
$this->lockType = null;
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/Driver/ParallelFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ final class ParallelFile implements File, \IteratorAggregate

private readonly DeferredFuture $onClose;

private ?LockType $lockMode = null;
private ?LockType $lockType = null;

public function __construct(
private readonly Internal\FileWorker $worker,
Expand Down Expand Up @@ -96,7 +96,7 @@ public function close(): void
$this->closing->await();
} finally {
$this->onClose->complete();
$this->lockMode = null;
$this->lockType = null;
}
}

Expand Down Expand Up @@ -149,14 +149,14 @@ public function eof(): bool
public function lock(LockType $type, ?Cancellation $cancellation = null): void
{
$this->flock('lock', $type, $cancellation);
$this->lockMode = $type;
$this->lockType = $type;
}

public function tryLock(LockType $type): bool
{
$locked = $this->flock('try-lock', $type);
if ($locked) {
$this->lockMode = $type;
$this->lockType = $type;
}

return $locked;
Expand All @@ -165,12 +165,12 @@ public function tryLock(LockType $type): bool
public function unlock(): void
{
$this->flock('unlock');
$this->lockMode = null;
$this->lockType = null;
}

public function getLockType(): ?LockType
{
return $this->lockMode;
return $this->lockType;
}

private function flock(string $action, ?LockType $type = null, ?Cancellation $cancellation = null): bool
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/UvFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function close(): void
$this->closing->await();
} finally {
$this->poll->done();
$this->lockMode = null;
$this->lockType = null;
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/Internal/QueuedWritesFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ abstract class QueuedWritesFile implements File, \IteratorAggregate

private bool $writable;

protected ?LockType $lockMode = null;
protected ?LockType $lockType = null;

public function __construct(
private readonly string $path,
Expand Down Expand Up @@ -134,14 +134,14 @@ abstract protected function getFileHandle();
public function lock(LockType $type, ?Cancellation $cancellation = null): void
{
lock($this->path, $this->getFileHandle(), $type, $cancellation);
$this->lockMode = $type;
$this->lockType = $type;
}

public function tryLock(LockType $type): bool
{
$locked = tryLock($this->path, $this->getFileHandle(), $type);
if ($locked) {
$this->lockMode = $type;
$this->lockType = $type;
}

return $locked;
Expand All @@ -150,12 +150,12 @@ public function tryLock(LockType $type): bool
public function unlock(): void
{
unlock($this->path, $this->getFileHandle());
$this->lockMode = null;
$this->lockType = null;
}

public function getLockType(): ?LockType
{
return $this->lockMode;
return $this->lockType;
}

public function seek(int $position, Whence $whence = Whence::Start): int
Expand Down

0 comments on commit db61c0f

Please sign in to comment.