Skip to content

Commit

Permalink
Upgrade/php8.4 (#324)
Browse files Browse the repository at this point in the history
* upgrade PHP version to 8.4

* try ubuntu 24 on CI/CD

* add explicit nullables
  • Loading branch information
jleonardolemos authored Jan 13, 2025
1 parent 96850bb commit ed10a8d
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/continous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
ports:
- 5672:5672

runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
matrix:
php-versions: ['7.3', '7.4', '8.0']
Expand Down Expand Up @@ -56,10 +56,10 @@ jobs:
ports:
- 5672:5672

runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']
php-versions: ['8.1', '8.2', '8.3', '8.4']

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [v2.5.0]
### Added
- Support PHP 8.4

## [v2.4.0]
### Added
- Support for Laravel 11
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.3-fpm-alpine
FROM php:8.4-fpm-alpine

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
RUN apk --no-cache --update add libmemcached-dev zlib-dev libpng-dev libjpeg-turbo-dev freetype-dev libxml2-dev
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function exchange(string $name, string $type = 'direct'): PublisherContra
return new Publisher($this->app, $this, $name);
}

public function routing(string $name = null): PublisherContract
public function routing(?string $name = null): PublisherContract
{
$exchange = $this->app['config']['pigeon.exchange'];
$type = $this->app['config']['pigeon.exchange_type'];
Expand Down
4 changes: 2 additions & 2 deletions src/Drivers/DriverContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public function events(string $event = '*'): ConsumerContract;

public function dispatch(string $eventName, array $event, array $meta = []): void;

public function routing(string $name): PublisherContract;
public function routing(?string $name): PublisherContract;

public function getConnection();

public function getChannel(int $id = null);
public function getChannel(?int $id = null);
}
2 changes: 1 addition & 1 deletion src/Drivers/RabbitDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function getConnection()
return $this->connection;
}

public function getChannel(int $id = null): AMQPChannel
public function getChannel(?int $id = null): AMQPChannel
{
return $this->getConnection()->channel($id);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/Driver/NullDriverException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class NullDriverException extends Exception
{
public function __construct($message = 'Cannot use [NULL] driver', $code = 0, Throwable $previous = null)
public function __construct($message = 'Cannot use [NULL] driver', $code = 0, ?Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/Events/EmptyEventException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class EmptyEventException extends Exception
{
public function __construct($message = 'Cannot dispatch empty event', $code = 0, Throwable $previous = null)
public function __construct($message = 'Cannot dispatch empty event', $code = 0, ?Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Facade/Pigeon.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Class Pigeon.
*
* @method static \Convenia\Pigeon\Drivers\Driver driver(string $driver)
* @method static \Convenia\Pigeon\Publisher\PublisherContract routing(string $name = null)
* @method static \Convenia\Pigeon\Publisher\PublisherContract routing(?string $name = null)
* @method static \Convenia\Pigeon\Publisher\PublisherContract exchange(string $name, string $type = 'direct')
* @method static \Convenia\Pigeon\Publisher\PublisherContract dispatch(string $eventName, array $event, array $meta = [])
* @method static \Convenia\Pigeon\Consumer\ConsumerContract queue(string $name, array $properties = [])
Expand Down
2 changes: 1 addition & 1 deletion src/MessageProcessor/MessageProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class MessageProcessor implements MessageProcessorContract
protected $fallback;
protected $driver;

public function __construct(DriverContract $driver, Closure $callback, Closure $fallback = null)
public function __construct(DriverContract $driver, Closure $callback, ?Closure $fallback = null)
{
$this->driver = $driver;
$this->callback = $callback;
Expand Down
2 changes: 1 addition & 1 deletion src/MessageProcessor/MessageProcessorContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

interface MessageProcessorContract
{
public function __construct(DriverContract $driver, Closure $callback, Closure $fallback = null);
public function __construct(DriverContract $driver, Closure $callback, ?Closure $fallback = null);

public function process(AMQPMessage $message);
}
2 changes: 1 addition & 1 deletion src/Publisher/Publisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function bind(string $queue): PublisherContract
return $this;
}

public function publish(array $message, array $properties = [], int $channelId = null)
public function publish(array $message, array $properties = [], ?int $channelId = null)
{
$msg = $this->makeMessage($message, $properties);
$this->driver->getChannel($channelId)->basic_publish(
Expand Down
2 changes: 1 addition & 1 deletion src/Resolver/Resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function reject(bool $requeue = true)
->basic_nack($this->message->delivery_info['delivery_tag'], false, $requeue);
}

public function headers(string $key = null)
public function headers(?string $key = null)
{
return is_null($key)
? $this->message->get_properties()
Expand Down
2 changes: 1 addition & 1 deletion src/Resolver/ResolverContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ public function ack();

public function reject(bool $requeue = true);

public function headers(string $key = null);
public function headers(?string $key = null);
}
8 changes: 4 additions & 4 deletions src/Support/Testing/PigeonFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct($app)
$this->events = new Collection();
}

public function assertConsuming(string $queue, int $timeout = null, bool $multiple = null)
public function assertConsuming(string $queue, ?int $timeout = null, ?bool $multiple = null)
{
$comsumer = $this->consumers->get($queue);

Expand All @@ -57,7 +57,7 @@ public function assertConsuming(string $queue, int $timeout = null, bool $multip
}
}

public function assertConsumingEvent(string $event, int $timeout = null, bool $multiple = null)
public function assertConsumingEvent(string $event, ?int $timeout = null, ?bool $multiple = null)
{
$comsumer = $this->consumers->get($event);

Expand Down Expand Up @@ -191,7 +191,7 @@ public function exchange(string $name, string $type = 'direct'): PublisherContra
return new Publisher($this->app, $this, $name);
}

public function routing(string $name): PublisherContract
public function routing(?string $name = null): PublisherContract
{
$exchange = $this->app['config']['pigeon.exchange'];
$publisher = (new Publisher($this->app, $this, $exchange))->routing($name);
Expand Down Expand Up @@ -274,7 +274,7 @@ public function getConnection()
/**
* @codeCoverageIgnore
*/
public function getChannel(int $id = null)
public function getChannel(?int $id = null)
{
return $this;
}
Expand Down

0 comments on commit ed10a8d

Please sign in to comment.