Skip to content

Commit

Permalink
Fix deprecations related to implicit nullable types
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Mar 19, 2024
1 parent ecadbdc commit a081c80
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(PropertyGenerator $prefixInterceptor)

$interceptor = new ParameterGenerator('prefixInterceptor');

$interceptor->setType(Closure::class);
$interceptor->setType('?' . Closure::class);
$interceptor->setDefaultValue(null);
$this->setParameter(new ParameterGenerator('methodName', 'string'));
$this->setParameter($interceptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(PropertyGenerator $suffixInterceptor)

$interceptor = new ParameterGenerator('suffixInterceptor');

$interceptor->setType(Closure::class);
$interceptor->setType('?' . Closure::class);
$interceptor->setDefaultValue(null);
$this->setParameter(new ParameterGenerator('methodName', 'string'));
$this->setParameter($interceptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct(PropertyGenerator $initializerProperty)
{
parent::__construct(
'setProxyInitializer',
[(new ParameterGenerator('initializer', Closure::class))->setDefaultValue(null)],
[(new ParameterGenerator('initializer', '?' . Closure::class))->setDefaultValue(null)],
self::FLAG_PUBLIC,
'$this->' . $initializerProperty->getName() . ' = $initializer;'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(PropertyGenerator $initializerProperty)

$initializerParameter = new ParameterGenerator('initializer');

$initializerParameter->setType(Closure::class);
$initializerParameter->setType('?' . Closure::class);
$initializerParameter->setDefaultValue(null);
$this->setParameter($initializerParameter);
$this->setBody('$this->' . $initializerProperty->getName() . ' = $initializer;');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ public static function staticProxyConstructor($instance, $prefixInterceptors, $s
return $selfInstance;
}

public function setMethodPrefixInterceptor(string $methodName, \Closure $prefixInterceptor = null) : void
public function setMethodPrefixInterceptor(string $methodName, ?\Closure $prefixInterceptor = null) : void
{
// no-op (on purpose)
}

public function setMethodSuffixInterceptor(string $methodName, \Closure $suffixInterceptor = null) : void
public function setMethodSuffixInterceptor(string $methodName, ?\Closure $suffixInterceptor = null) : void
{
// no-op (on purpose)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ProxyManagerTestAsset/LazyLoadingMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function staticProxyConstructor($initializer) : self
return $instance;
}

public function setProxyInitializer(\Closure $initializer = null) : void
public function setProxyInitializer(?\Closure $initializer = null) : void
{
$this->initializer = $initializer;
}
Expand Down

0 comments on commit a081c80

Please sign in to comment.