Skip to content

Commit

Permalink
fixed PHP 8.4 deprecations (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
okorneliuk authored Nov 23, 2024
1 parent 44c6f37 commit dd0571a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ public function stop(): void
$this->send('', $this->encode(['stop' => true]));
}

public function hasPayload(string $class = null): bool
public function hasPayload(?string $class = null): bool
{
return $this->findPayload($class) !== null;
}

public function getPayload(string $class = null): ?Payload
public function getPayload(?string $class = null): ?Payload
{
$pos = $this->findPayload($class);
if ($pos === null) {
Expand All @@ -140,7 +140,7 @@ public function getPayload(string $class = null): ?Payload
*
* @return null|int Index in {@see $this->payloads} or null if not found
*/
private function findPayload(string $class = null): ?int
private function findPayload(?string $class = null): ?int
{
// Find in existing payloads
if ($this->payloads !== []) {
Expand Down
4 changes: 2 additions & 2 deletions src/WorkerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ public function stop(): void;
*
* @return bool Returns {@see true} if worker is ready to accept new payload.
*/
public function hasPayload(string $class = null): bool;
public function hasPayload(?string $class = null): bool;

/**
* @param class-string<Payload>|null $class
*
* @return Payload|null Returns {@see null} if worker is not ready to accept new payload and has no cached payload
* of the given type.
*/
public function getPayload(string $class = null): ?Payload;
public function getPayload(?string $class = null): ?Payload;
}

0 comments on commit dd0571a

Please sign in to comment.