Skip to content

Commit dd0571a

Browse files
authored
fixed PHP 8.4 deprecations (#39)
1 parent 44c6f37 commit dd0571a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Worker.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ public function stop(): void
118118
$this->send('', $this->encode(['stop' => true]));
119119
}
120120

121-
public function hasPayload(string $class = null): bool
121+
public function hasPayload(?string $class = null): bool
122122
{
123123
return $this->findPayload($class) !== null;
124124
}
125125

126-
public function getPayload(string $class = null): ?Payload
126+
public function getPayload(?string $class = null): ?Payload
127127
{
128128
$pos = $this->findPayload($class);
129129
if ($pos === null) {
@@ -140,7 +140,7 @@ public function getPayload(string $class = null): ?Payload
140140
*
141141
* @return null|int Index in {@see $this->payloads} or null if not found
142142
*/
143-
private function findPayload(string $class = null): ?int
143+
private function findPayload(?string $class = null): ?int
144144
{
145145
// Find in existing payloads
146146
if ($this->payloads !== []) {

src/WorkerInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ public function stop(): void;
5151
*
5252
* @return bool Returns {@see true} if worker is ready to accept new payload.
5353
*/
54-
public function hasPayload(string $class = null): bool;
54+
public function hasPayload(?string $class = null): bool;
5555

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

0 commit comments

Comments
 (0)