Skip to content

Commit

Permalink
Merge pull request #261 from skilld-labs/php84
Browse files Browse the repository at this point in the history
PHP 8.4 compatibility
  • Loading branch information
philipobenito authored Oct 23, 2024
2 parents 888b087 + c8d2427 commit 5a6f1c7
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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 }}

Expand Down
2 changes: 1 addition & 1 deletion src/Argument/LiteralArgument.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/DefinitionContainerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion src/Inflector/Inflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Inflector/InflectorAggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Inflector/InflectorAggregateInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion tests/Asset/Baz.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class Baz
{
public function __construct(BarInterface $bar = null)
public function __construct(?BarInterface $bar = null)
{
}
}
2 changes: 1 addition & 1 deletion tests/Asset/Foo.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Foo

public static $staticHello;

public function __construct(Bar $bar = null)
public function __construct(?Bar $bar = null)
{
$this->bar = $bar;
}
Expand Down

0 comments on commit 5a6f1c7

Please sign in to comment.