Skip to content

Commit e0ecc27

Browse files
authored
IBX-10507: Allowed nullable type declarations for method parameters across the codebase (#265)
1 parent 1741e21 commit e0ecc27

File tree

9 files changed

+13
-25
lines changed

9 files changed

+13
-25
lines changed

phpstan-baseline.neon

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -552,18 +552,6 @@ parameters:
552552
count: 2
553553
path: src/lib/FieldType/RichText/RichTextStorage.php
554554

555-
-
556-
message: '#^Property Ibexa\\FieldTypeRichText\\FieldType\\RichText\\RichTextStorage\:\:\$logger \(Psr\\Log\\LoggerInterface\) does not accept Psr\\Log\\LoggerInterface\|null\.$#'
557-
identifier: assign.propertyType
558-
count: 1
559-
path: src/lib/FieldType/RichText/RichTextStorage.php
560-
561-
-
562-
message: '#^Property Ibexa\\FieldTypeRichText\\FieldType\\RichText\\RichTextStorage\:\:\$logger \(Psr\\Log\\LoggerInterface\) in isset\(\) is not nullable\.$#'
563-
identifier: isset.property
564-
count: 1
565-
path: src/lib/FieldType/RichText/RichTextStorage.php
566-
567555
-
568556
message: '#^Method Ibexa\\FieldTypeRichText\\FieldType\\RichText\\RichTextStorage\\Gateway\:\:getContentIds\(\) has parameter \$remoteIds with no value type specified in iterable type array\.$#'
569557
identifier: missingType.iterableValue
@@ -1345,7 +1333,7 @@ parameters:
13451333
path: src/lib/RichText/Validator/ValidatorDispatcher.php
13461334

13471335
-
1348-
message: '#^PHPDoc tag @param for parameter \$validator with type Ibexa\\FieldTypeRichText\\eZ\\RichText\\Validator is not subtype of native type Ibexa\\Contracts\\FieldTypeRichText\\RichText\\ValidatorInterface\|null\.$#'
1336+
message: '#^PHPDoc tag @param for parameter \$validator with type Ibexa\\FieldTypeRichText\\eZ\\RichText\\Validator\|null is not subtype of native type Ibexa\\Contracts\\FieldTypeRichText\\RichText\\ValidatorInterface\|null\.$#'
13491337
identifier: parameter.phpDocType
13501338
count: 1
13511339
path: src/lib/RichText/Validator/ValidatorDispatcher.php

src/lib/FieldType/RichText/RichTextStorage.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
class RichTextStorage extends GatewayBasedStorage
2121
{
2222
/**
23-
* @var \Psr\Log\LoggerInterface
23+
* @var \Psr\Log\LoggerInterface|null
2424
*/
2525
protected $logger;
2626

@@ -31,9 +31,9 @@ class RichTextStorage extends GatewayBasedStorage
3131

3232
/**
3333
* @param \Ibexa\Contracts\Core\FieldType\StorageGateway $gateway
34-
* @param \Psr\Log\LoggerInterface $logger
34+
* @param \Psr\Log\LoggerInterface|null $logger
3535
*/
36-
public function __construct(StorageGateway $gateway, LoggerInterface $logger = null)
36+
public function __construct(StorageGateway $gateway, ?LoggerInterface $logger = null)
3737
{
3838
parent::__construct($gateway);
3939
$this->logger = $logger;

src/lib/RichText/Converter/Link.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(
4646
LocationService $locationService,
4747
ContentService $contentService,
4848
RouterInterface $router,
49-
LoggerInterface $logger = null
49+
?LoggerInterface $logger = null
5050
) {
5151
$this->locationService = $locationService;
5252
$this->contentService = $contentService;

src/lib/RichText/Converter/Render/Embed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Embed extends Render implements Converter
4747
'replace' => '_self',
4848
];
4949

50-
public function __construct(RendererInterface $renderer, LoggerInterface $logger = null)
50+
public function __construct(RendererInterface $renderer, ?LoggerInterface $logger = null)
5151
{
5252
parent::__construct($renderer);
5353
$this->logger = $logger;

src/lib/RichText/Converter/Render/Template.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ class Template extends Render implements Converter
4040
*
4141
* @param \Ibexa\Contracts\FieldTypeRichText\RichText\RendererInterface $renderer
4242
* @param \Ibexa\Contracts\FieldTypeRichText\RichText\Converter $richTextConverter
43-
* @param \Psr\Log\LoggerInterface $logger
43+
* @param \Psr\Log\LoggerInterface|null $logger
4444
*/
4545
public function __construct(
4646
RendererInterface $renderer,
4747
Converter $richTextConverter,
48-
LoggerInterface $logger = null
48+
?LoggerInterface $logger = null
4949
) {
5050
$this->richTextConverter = $richTextConverter;
5151
$this->logger = $logger ?? new NullLogger();

src/lib/RichText/ConverterDispatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct($converterMap)
4040
* @param string $namespace
4141
* @param \Ibexa\Contracts\FieldTypeRichText\RichText\Converter|null $converter
4242
*/
43-
public function addConverter($namespace, Converter $converter = null)
43+
public function addConverter($namespace, ?Converter $converter = null)
4444
{
4545
$this->mapping[$namespace] = $converter;
4646
}

src/lib/RichText/Exception/InvalidXmlException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class InvalidXmlException extends InvalidArgumentException
2323
* @param array $errors
2424
* @param \Throwable|null $previous
2525
*/
26-
public function __construct(string $argumentName, array $errors = [], Throwable $previous = null)
26+
public function __construct(string $argumentName, array $errors = [], ?Throwable $previous = null)
2727
{
2828
$messages = [];
2929
foreach ($errors as $error) {

src/lib/RichText/Renderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function __construct(
8484
string $tagConfigurationNamespace,
8585
string $styleConfigurationNamespace,
8686
string $embedConfigurationNamespace,
87-
LoggerInterface $logger = null,
87+
?LoggerInterface $logger = null,
8888
array $customTagsConfiguration = [],
8989
array $customStylesConfiguration = []
9090
) {

src/lib/RichText/Validator/ValidatorDispatcher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public function __construct($validatorMap)
3838
* Adds validator mapping.
3939
*
4040
* @param string $namespace
41-
* @param \Ibexa\FieldTypeRichText\eZ\RichText\Validator $validator
41+
* @param \Ibexa\FieldTypeRichText\eZ\RichText\Validator|null $validator
4242
*/
43-
public function addValidator($namespace, ValidatorInterface $validator = null)
43+
public function addValidator($namespace, ?ValidatorInterface $validator = null)
4444
{
4545
$this->mapping[$namespace] = $validator;
4646
}

0 commit comments

Comments
 (0)