1
0
mirror of https://github.com/danog/amp.git synced 2024-12-04 02:17:54 +01:00

Remove static to access $this

This commit is contained in:
Niklas Keller 2020-10-25 21:44:01 +01:00
parent eec21c12c6
commit fc423c7db5

View File

@ -24,7 +24,7 @@ final class CombinedCancellationToken implements CancellationToken
$this->callbacks = []; $this->callbacks = [];
foreach ($callbacks as $callback) { foreach ($callbacks as $callback) {
Loop::defer(static fn (): Promise => call($callback, $this->exception)); Loop::defer(fn(): Promise => call($callback, $this->exception));
} }
}); });
@ -34,7 +34,7 @@ final class CombinedCancellationToken implements CancellationToken
public function __destruct() public function __destruct()
{ {
foreach ($this->tokens as list($token, $id)) { foreach ($this->tokens as [$token, $id]) {
/** @var CancellationToken $token */ /** @var CancellationToken $token */
$token->unsubscribe($id); $token->unsubscribe($id);
} }
@ -46,7 +46,7 @@ final class CombinedCancellationToken implements CancellationToken
$id = $this->nextId++; $id = $this->nextId++;
if (isset($this->exception)) { if (isset($this->exception)) {
Loop::defer(static fn (): Promise => call($callback, $this->exception)); Loop::defer(fn(): Promise => call($callback, $this->exception));
} else { } else {
$this->callbacks[$id] = $callback; $this->callbacks[$id] = $callback;
} }
@ -63,7 +63,7 @@ final class CombinedCancellationToken implements CancellationToken
/** @inheritdoc */ /** @inheritdoc */
public function isRequested(): bool public function isRequested(): bool
{ {
foreach ($this->tokens as list($token)) { foreach ($this->tokens as [$token]) {
if ($token->isRequested()) { if ($token->isRequested()) {
return true; return true;
} }
@ -75,7 +75,7 @@ final class CombinedCancellationToken implements CancellationToken
/** @inheritdoc */ /** @inheritdoc */
public function throwIfRequested(): void public function throwIfRequested(): void
{ {
foreach ($this->tokens as list($token)) { foreach ($this->tokens as [$token]) {
$token->throwIfRequested(); $token->throwIfRequested();
} }
} }