Skip to content

Commit

Permalink
PHP 8.4 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
andypost committed Jul 23, 2024
1 parent 888b087 commit 64b9519
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
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 64b9519

Please sign in to comment.