Skip to content

Commit 7dd5f22

Browse files
authored
Merge pull request #99 from AgencyPMG/ALLI-17433-upgrade-pmg-queue-to-support-php-8-4
Alli 17433 upgrade pmg/queue to support php 8 4
2 parents 1cd7e43 + c999bd7 commit 7dd5f22

File tree

11 files changed

+23
-23
lines changed

11 files changed

+23
-23
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ on:
88
jobs:
99
test:
1010
name: test
11-
runs-on: "ubuntu-latest"
11+
runs-on: "ubuntu-24.04"
1212

1313
strategy:
1414
matrix:
1515
include:
16-
- php-version: 8.2
1716
- php-version: 8.3
17+
- php-version: 8.4
1818

1919

2020
steps:
@@ -29,13 +29,13 @@ jobs:
2929

3030
examples:
3131
name: examples
32-
runs-on: "ubuntu-latest"
32+
runs-on: "ubuntu-24.04"
3333

3434
strategy:
3535
matrix:
3636
include:
37-
- php-version: 8.2
3837
- php-version: 8.3
38+
- php-version: 8.4
3939

4040
steps:
4141
- name: checkout

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
{ "name": "Christopher Davis", "email": "chris@pmg.com" }
77
],
88
"require": {
9-
"php": "^8.2",
9+
"php": "^8.3",
1010
"psr/log": "^1.0 || ^2.0 || ^3.0",
11-
"guzzlehttp/promises": "^1.3"
11+
"guzzlehttp/promises": "^2.0.3"
1212

1313
},
1414
"require-dev": {

src/AbstractConsumer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ abstract class AbstractConsumer implements Consumer
4646
*/
4747
private $hasPcntl = null;
4848

49-
public function __construct(LoggerInterface $logger=null)
49+
public function __construct(?LoggerInterface $logger=null)
5050
{
5151
$this->logger = $logger;
5252
}
5353

5454
/**
5555
* {@inheritdoc}
5656
*/
57-
public function run(string $queueName, MessageLifecycle $lifecycle=null) : int
57+
public function run(string $queueName, ?MessageLifecycle $lifecycle=null) : int
5858
{
5959
$lifecycle = $lifecycle ?? new Lifecycle\NullLifecycle();
6060
$this->running = true;
@@ -81,7 +81,7 @@ public function run(string $queueName, MessageLifecycle $lifecycle=null) : int
8181
/**
8282
* {@inheritdoc}
8383
*/
84-
public function stop(int $code=null) : void
84+
public function stop(?int $code=null) : void
8585
{
8686
$this->running = false;
8787
$this->exitCode = null === $code ? self::EXIT_SUCCESS : $code;

src/Consumer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface Consumer
3131
* @param $lifecycle The message lifecycle to apply to the running consumer.
3232
* @return int The exit code to be used for the consumer.
3333
*/
34-
public function run(string $queueName, MessageLifecycle $lifecycle=null) : int;
34+
public function run(string $queueName, ?MessageLifecycle $lifecycle=null) : int;
3535

3636
/**
3737
* Consume a single job from the given queue. This will block until the
@@ -47,13 +47,13 @@ public function run(string $queueName, MessageLifecycle $lifecycle=null) : int;
4747
* @return boolean|null True if the a job was execute successfully. Null if
4848
* no job was executed. See the logs.
4949
*/
50-
public function once(string $queueName, MessageLifecycle $lifecycle=null) : ?bool;
50+
public function once(string $queueName, ?MessageLifecycle $lifecycle=null) : ?bool;
5151

5252
/**
5353
* Gracefully stop the consumer with the given exit code.
5454
*
5555
* @param int $code The exit code passed to `exit`. If null `EXIT_SUCCESS` is used.
5656
* @return void
5757
*/
58-
public function stop(int $code=null) : void;
58+
public function stop(?int $code=null) : void;
5959
}

src/DefaultConsumer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ class DefaultConsumer extends AbstractConsumer
5454
public function __construct(
5555
Driver $driver,
5656
MessageHandler $handler,
57-
RetrySpec $retries=null,
58-
LoggerInterface $logger=null
57+
?RetrySpec $retries=null,
58+
?LoggerInterface $logger=null
5959
) {
6060
parent::__construct($logger);
6161
$this->driver = $driver;
@@ -66,7 +66,7 @@ public function __construct(
6666
/**
6767
* {@inheritdoc}
6868
*/
69-
public function once(string $queueName, MessageLifecycle $lifecycle=null) : ?bool
69+
public function once(string $queueName, ?MessageLifecycle $lifecycle=null) : ?bool
7070
{
7171
$envelope = $this->driver->dequeue($queueName);
7272
if (!$envelope) {
@@ -96,7 +96,7 @@ public function once(string $queueName, MessageLifecycle $lifecycle=null) : ?boo
9696
/**
9797
* {@inheritdoc}
9898
*/
99-
public function stop(int $code=null) : void
99+
public function stop(?int $code=null) : void
100100
{
101101
if ($this->currentPromise) {
102102
$this->currentPromise->cancel();

src/Handler/PcntlForkingHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ final class PcntlForkingHandler implements MessageHandler
3939

4040
private Pcntl $pcntl;
4141

42-
public function __construct(MessageHandler $wrapped, Pcntl $pcntl=null)
42+
public function __construct(MessageHandler $wrapped, ?Pcntl $pcntl=null)
4343
{
4444
$this->wrapped = $wrapped;
4545
$this->pcntl = $pcntl ?: new Pcntl();

src/Lifecycle/MappingLifecycle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ final class MappingLifecycle implements MessageLifecycle
4545
* @param $fallback The message lifecycle to which unmatches messages will be applied
4646
* @throws InvalidArgumentException if $mapping is a bad type
4747
*/
48-
public function __construct($mapping, MessageLifecycle $fallback=null)
48+
public function __construct($mapping, ?MessageLifecycle $fallback=null)
4949
{
5050
if (!is_array($mapping) && !$mapping instanceof \ArrayAccess) {
5151
throw new InvalidArgumentException(sprintf(

src/Retry/LimitedSpec.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class LimitedSpec implements RetrySpec
2929
private $maxAttempts;
3030
private $retryDelay;
3131

32-
public function __construct(int $maxAttempts=null, int $retryDelay=0)
32+
public function __construct(?int $maxAttempts=null, int $retryDelay=0)
3333
{
3434
if (null !== $maxAttempts && $maxAttempts < 1) {
3535
throw new InvalidArgumentException(sprintf(

src/Serializer/NativeSerializer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ final class NativeSerializer implements Serializer
4141
*/
4242
private $signer;
4343

44-
public function __construct(Signer $signer, array $allowedClasses=null)
44+
public function __construct(Signer $signer, ?array $allowedClasses=null)
4545
{
4646
$this->signer = $signer;
4747
$this->allowedClasses = $allowedClasses;
4848
}
4949

50-
public static function fromSigningKey(string $key, array $allowedClasses=null)
50+
public static function fromSigningKey(string $key, ?array $allowedClasses=null)
5151
{
5252
return new self(new HmacSha256($key), $allowedClasses);
5353
}

test/unit/Driver/AbstractPersistanceDriverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
// not called
2525
abstract class _DriverAbc extends AbstractPersistanceDriver
2626
{
27-
public function __construct(Serializer $serializer=null)
27+
public function __construct(?Serializer $serializer=null)
2828
{
2929
if ($serializer) {
3030
parent::__construct($serializer);

0 commit comments

Comments
 (0)