Skip to content

Commit 0b03d3e

Browse files
tobias-93bobvandevijver
authored andcommitted
Fix nullable typing causing a deprecation in PHP 8.4
1 parent 386b3bd commit 0b03d3e

File tree

14 files changed

+20
-20
lines changed

14 files changed

+20
-20
lines changed

Builder/BaseBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function getTemplateName(): string
2525
return '@AdmingeneratorGenerator/templates/' . $this->getGenerator()->getTemplateBaseDir() . parent::getTemplateName();
2626
}
2727

28-
public function __construct(Environment $environment = null)
28+
public function __construct(?Environment $environment = null)
2929
{
3030
parent::__construct();
3131
$this->twigExtensions[] = ClassifyExtension::class;

EventListener/ControllerListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(
2727
$this->cacheSuffix = 'default';
2828
}
2929

30-
public function setCacheProvider(CacheInterface $cacheProvider = null, $cacheSuffix = 'default'): void
30+
public function setCacheProvider(?CacheInterface $cacheProvider = null, $cacheSuffix = 'default'): void
3131
{
3232
$this->cacheProvider = $cacheProvider;
3333
$this->cacheSuffix = $cacheSuffix;

Menu/AdmingeneratorMenuBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function addLinkRoute(ItemInterface $menu, string $label, string $rout
5353
/**
5454
* Set active class to current item and all its parents (so it is automatically opened)
5555
*/
56-
protected function setActive(ItemInterface $item = null): void
56+
protected function setActive(?ItemInterface $item = null): void
5757
{
5858
if ($item) {
5959
$this->setActive($item->getParent());

Resources/views/templates/CommonAdmin/ActionsAction/object_action.php.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
* @param \{{ model }} ${{ builder.ModelClass }} Your \{{ model }} object
103103
* @return Response Must return a response!
104104
*/
105-
protected function errorObject{{ action.name|php_name|capitalize }}(\Exception $e, \{{ model }} ${{ builder.ModelClass }} = null)
105+
protected function errorObject{{ action.name|php_name|capitalize }}(\Exception $e, ?\{{ model }} ${{ builder.ModelClass }} = null)
106106
{
107107

108108
// Throw exception if defined

Resources/views/templates/CommonAdmin/ActionsAction/object_delete.php.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
* @param \{{ model }} ${{ builder.ModelClass }} Your \{{ model }} object
100100
* @return Response Must return a response!
101101
*/
102-
protected function errorObjectDelete(\Exception $e, \{{ model }} ${{ builder.ModelClass }} = null)
102+
protected function errorObjectDelete(\Exception $e, ?\{{ model }} ${{ builder.ModelClass }} = null)
103103
{
104104

105105
// Throw exception if defined

Resources/views/templates/CommonAdmin/EditType/type.php.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class {{ builder.YamlKey|ucfirst }}Type extends BaseType
7171
*
7272
* @return boolean
7373
*/
74-
protected function canDisplay{{ column.name|classify|php_name }}(\{{ model }} ${{ builder.ModelClass }} = null)
74+
protected function canDisplay{{ column.name|classify|php_name }}(?\{{ model }} ${{ builder.ModelClass }} = null)
7575
{
7676
{% if column.credentials is not empty and column.credentials != 'AdmingenAllowed' %}
7777
{% if(admingenerator_config('use_jms_security')) %}

Resources/views/templates/CommonAdmin/security_action.php.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @param \{{ model }} ${{ builder.ModelClass }}
1414
* @return boolean
1515
*/
16-
protected function validateCredentials($credentials, \{{ model }} ${{ builder.ModelClass }} = null)
16+
protected function validateCredentials($credentials, ?\{{ model }} ${{ builder.ModelClass }} = null)
1717
{
1818
{% if(admingenerator_config('use_jms_security')) %}
1919
$credentials = new Expression($credentials);
@@ -29,7 +29,7 @@
2929
* @param \{{ model }} ${{ builder.ModelClass }}
3030
* @throws AccessDeniedException if is not allowed
3131
*/
32-
protected function denyAccessUnlessValidateCredentials($credentials, \{{ model }} ${{ builder.ModelClass }} = null)
32+
protected function denyAccessUnlessValidateCredentials($credentials, ?\{{ model }} ${{ builder.ModelClass }} = null)
3333
{
3434
if (!$this->validateCredentials($credentials, ${{ builder.ModelClass }})) {
3535
throw $this->createAccessDeniedException('Credentials unsatisfied');

Routing/NestedRoutingLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class NestedRoutingLoader extends RoutingLoader
88
{
9-
public function load(mixed $resource, string $type = null): RouteCollection
9+
public function load(mixed $resource, ?string $type = null): RouteCollection
1010
{
1111
$this->actions['nested_move'] = array(
1212
'path' => '/nested-move/{dragged}/{action}/{dropped}',
@@ -19,7 +19,7 @@ public function load(mixed $resource, string $type = null): RouteCollection
1919
return parent::load($resource, $type);
2020
}
2121

22-
public function supports(mixed $resource, string $type = null): bool
22+
public function supports(mixed $resource, ?string $type = null): bool
2323
{
2424
return 'admingenerator_nested' == $type;
2525
}

Routing/RoutingLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class RoutingLoader extends FileLoader
9191

9292
protected array $yaml = [];
9393

94-
public function load(mixed $resource, string $type = null): RouteCollection
94+
public function load(mixed $resource, ?string $type = null): RouteCollection
9595
{
9696
$collection = new RouteCollection();
9797

@@ -165,7 +165,7 @@ public function load(mixed $resource, string $type = null): RouteCollection
165165
return $collection;
166166
}
167167

168-
public function supports(mixed $resource, string $type = null): bool
168+
public function supports(mixed $resource, ?string $type = null): bool
169169
{
170170
return 'admingenerator' == $type;
171171
}

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function testDefaultConfig(): void
2323
* Get waiting default values from configuration. If $key is not null
2424
* and is in first level keys, returns value of this specific key only.
2525
*/
26-
private function getBundleDefaultConfig(string $key = null): mixed
26+
private function getBundleDefaultConfig(?string $key = null): mixed
2727
{
2828
static $defaultConfiguration = [
2929
'generate_base_in_project_dir' => false,

0 commit comments

Comments
 (0)