diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 39d1e16..6c23c75 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,6 +33,8 @@ jobs: include: - php: '8.0' coverage: false + - php: '8.4' + coverage: false - php: '7.2' coverage: false composer-flags: '--prefer-lowest' @@ -53,7 +55,7 @@ jobs: - name: "Use PHPUnit 9.3+ on PHP 8" run: composer require --no-update --dev phpunit/phpunit:^9.3 - if: "matrix.php == '8.0'" + if: "matrix.php == '8.0' || matrix.php == '8.4'" - run: composer update --no-progress ${{ matrix.composer-flags }} diff --git a/src/Argument/LiteralArgument.php b/src/Argument/LiteralArgument.php index c121d35..55adede 100644 --- a/src/Argument/LiteralArgument.php +++ b/src/Argument/LiteralArgument.php @@ -24,7 +24,7 @@ class LiteralArgument implements LiteralArgumentInterface */ protected $value; - public function __construct($value, string $type = null) + public function __construct($value, ?string $type = null) { if ( null === $type diff --git a/src/Container.php b/src/Container.php index c3aa35d..195dba7 100644 --- a/src/Container.php +++ b/src/Container.php @@ -40,9 +40,9 @@ class Container implements DefinitionContainerInterface protected $delegates = []; public function __construct( - DefinitionAggregateInterface $definitions = null, - ServiceProviderAggregateInterface $providers = null, - InflectorAggregateInterface $inflectors = null + ?DefinitionAggregateInterface $definitions = null, + ?ServiceProviderAggregateInterface $providers = null, + ?InflectorAggregateInterface $inflectors = null ) { $this->definitions = $definitions ?? new DefinitionAggregate(); $this->providers = $providers ?? new ServiceProviderAggregate(); @@ -153,7 +153,7 @@ public function has($id): bool return false; } - public function inflector(string $type, callable $callback = null): InflectorInterface + public function inflector(string $type, ?callable $callback = null): InflectorInterface { return $this->inflectors->add($type, $callback); } diff --git a/src/DefinitionContainerInterface.php b/src/DefinitionContainerInterface.php index 7e7e57e..d7d5338 100644 --- a/src/DefinitionContainerInterface.php +++ b/src/DefinitionContainerInterface.php @@ -16,5 +16,5 @@ public function addServiceProvider(ServiceProviderInterface $provider): self; public function addShared(string $id, $concrete = null): DefinitionInterface; public function extend(string $id): DefinitionInterface; public function getNew($id); - public function inflector(string $type, callable $callback = null): InflectorInterface; + public function inflector(string $type, ?callable $callback = null): InflectorInterface; } diff --git a/src/Inflector/Inflector.php b/src/Inflector/Inflector.php index b8f0675..e0809cd 100644 --- a/src/Inflector/Inflector.php +++ b/src/Inflector/Inflector.php @@ -33,7 +33,7 @@ class Inflector implements ArgumentResolverInterface, InflectorInterface */ protected $properties = []; - public function __construct(string $type, callable $callback = null) + public function __construct(string $type, ?callable $callback = null) { $this->type = $type; $this->callback = $callback; diff --git a/src/Inflector/InflectorAggregate.php b/src/Inflector/InflectorAggregate.php index c719332..70922d4 100644 --- a/src/Inflector/InflectorAggregate.php +++ b/src/Inflector/InflectorAggregate.php @@ -16,7 +16,7 @@ class InflectorAggregate implements InflectorAggregateInterface */ protected $inflectors = []; - public function add(string $type, callable $callback = null): Inflector + public function add(string $type, ?callable $callback = null): Inflector { $inflector = new Inflector($type, $callback); $this->inflectors[] = $inflector; diff --git a/src/Inflector/InflectorAggregateInterface.php b/src/Inflector/InflectorAggregateInterface.php index 474276b..c95ac17 100644 --- a/src/Inflector/InflectorAggregateInterface.php +++ b/src/Inflector/InflectorAggregateInterface.php @@ -9,6 +9,6 @@ interface InflectorAggregateInterface extends ContainerAwareInterface, IteratorAggregate { - public function add(string $type, callable $callback = null): Inflector; + public function add(string $type, ?callable $callback = null): Inflector; public function inflect(object $object); } diff --git a/tests/Asset/Baz.php b/tests/Asset/Baz.php index ff83441..e138299 100644 --- a/tests/Asset/Baz.php +++ b/tests/Asset/Baz.php @@ -6,7 +6,7 @@ class Baz { - public function __construct(BarInterface $bar = null) + public function __construct(?BarInterface $bar = null) { } } diff --git a/tests/Asset/Foo.php b/tests/Asset/Foo.php index c7b6d6d..b624c5c 100644 --- a/tests/Asset/Foo.php +++ b/tests/Asset/Foo.php @@ -12,7 +12,7 @@ class Foo public static $staticHello; - public function __construct(Bar $bar = null) + public function __construct(?Bar $bar = null) { $this->bar = $bar; }