Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ on:
jobs:
test:
name: test
runs-on: "ubuntu-latest"
runs-on: "ubuntu-24.04"

strategy:
matrix:
include:
- php-version: 8.2
- php-version: 8.3
- php-version: 8.4


steps:
Expand All @@ -29,13 +29,13 @@ jobs:

examples:
name: examples
runs-on: "ubuntu-latest"
runs-on: "ubuntu-24.04"

strategy:
matrix:
include:
- php-version: 8.2
- php-version: 8.3
- php-version: 8.4

steps:
- name: checkout
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
{ "name": "Christopher Davis", "email": "[email protected]" }
],
"require": {
"php": "^8.2",
"php": "^8.3",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"guzzlehttp/promises": "^1.3"
"guzzlehttp/promises": "^2.0.3"

},
"require-dev": {
Expand Down
6 changes: 3 additions & 3 deletions src/AbstractConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ abstract class AbstractConsumer implements Consumer
*/
private $hasPcntl = null;

public function __construct(LoggerInterface $logger=null)
public function __construct(?LoggerInterface $logger=null)
{
$this->logger = $logger;
}

/**
* {@inheritdoc}
*/
public function run(string $queueName, MessageLifecycle $lifecycle=null) : int
public function run(string $queueName, ?MessageLifecycle $lifecycle=null) : int
{
$lifecycle = $lifecycle ?? new Lifecycle\NullLifecycle();
$this->running = true;
Expand All @@ -81,7 +81,7 @@ public function run(string $queueName, MessageLifecycle $lifecycle=null) : int
/**
* {@inheritdoc}
*/
public function stop(int $code=null) : void
public function stop(?int $code=null) : void
{
$this->running = false;
$this->exitCode = null === $code ? self::EXIT_SUCCESS : $code;
Expand Down
6 changes: 3 additions & 3 deletions src/Consumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface Consumer
* @param $lifecycle The message lifecycle to apply to the running consumer.
* @return int The exit code to be used for the consumer.
*/
public function run(string $queueName, MessageLifecycle $lifecycle=null) : int;
public function run(string $queueName, ?MessageLifecycle $lifecycle=null) : int;

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

/**
* Gracefully stop the consumer with the given exit code.
*
* @param int $code The exit code passed to `exit`. If null `EXIT_SUCCESS` is used.
* @return void
*/
public function stop(int $code=null) : void;
public function stop(?int $code=null) : void;
}
8 changes: 4 additions & 4 deletions src/DefaultConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class DefaultConsumer extends AbstractConsumer
public function __construct(
Driver $driver,
MessageHandler $handler,
RetrySpec $retries=null,
LoggerInterface $logger=null
?RetrySpec $retries=null,
?LoggerInterface $logger=null
) {
parent::__construct($logger);
$this->driver = $driver;
Expand All @@ -66,7 +66,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
public function once(string $queueName, MessageLifecycle $lifecycle=null) : ?bool
public function once(string $queueName, ?MessageLifecycle $lifecycle=null) : ?bool
{
$envelope = $this->driver->dequeue($queueName);
if (!$envelope) {
Expand Down Expand Up @@ -96,7 +96,7 @@ public function once(string $queueName, MessageLifecycle $lifecycle=null) : ?boo
/**
* {@inheritdoc}
*/
public function stop(int $code=null) : void
public function stop(?int $code=null) : void
{
if ($this->currentPromise) {
$this->currentPromise->cancel();
Expand Down
2 changes: 1 addition & 1 deletion src/Handler/PcntlForkingHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class PcntlForkingHandler implements MessageHandler

private Pcntl $pcntl;

public function __construct(MessageHandler $wrapped, Pcntl $pcntl=null)
public function __construct(MessageHandler $wrapped, ?Pcntl $pcntl=null)
{
$this->wrapped = $wrapped;
$this->pcntl = $pcntl ?: new Pcntl();
Expand Down
2 changes: 1 addition & 1 deletion src/Lifecycle/MappingLifecycle.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final class MappingLifecycle implements MessageLifecycle
* @param $fallback The message lifecycle to which unmatches messages will be applied
* @throws InvalidArgumentException if $mapping is a bad type
*/
public function __construct($mapping, MessageLifecycle $fallback=null)
public function __construct($mapping, ?MessageLifecycle $fallback=null)
{
if (!is_array($mapping) && !$mapping instanceof \ArrayAccess) {
throw new InvalidArgumentException(sprintf(
Expand Down
2 changes: 1 addition & 1 deletion src/Retry/LimitedSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class LimitedSpec implements RetrySpec
private $maxAttempts;
private $retryDelay;

public function __construct(int $maxAttempts=null, int $retryDelay=0)
public function __construct(?int $maxAttempts=null, int $retryDelay=0)
{
if (null !== $maxAttempts && $maxAttempts < 1) {
throw new InvalidArgumentException(sprintf(
Expand Down
4 changes: 2 additions & 2 deletions src/Serializer/NativeSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ final class NativeSerializer implements Serializer
*/
private $signer;

public function __construct(Signer $signer, array $allowedClasses=null)
public function __construct(Signer $signer, ?array $allowedClasses=null)
{
$this->signer = $signer;
$this->allowedClasses = $allowedClasses;
}

public static function fromSigningKey(string $key, array $allowedClasses=null)
public static function fromSigningKey(string $key, ?array $allowedClasses=null)
{
return new self(new HmacSha256($key), $allowedClasses);
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/Driver/AbstractPersistanceDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// not called
abstract class _DriverAbc extends AbstractPersistanceDriver
{
public function __construct(Serializer $serializer=null)
public function __construct(?Serializer $serializer=null)
{
if ($serializer) {
parent::__construct($serializer);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/Handler/PcntlForkingHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ protected function setUp() : void
$this->message = new SimpleMessage(self::NAME);
}

private function createHandler(callable $callback, Pcntl $pcntl=null)
private function createHandler(callable $callback, ?Pcntl $pcntl=null)
{
return new PcntlForkingHandler(new CallableHandler($callback), $pcntl);
}
Expand Down