Skip to content

Commit 4e23630

Browse files
authored
IBX-10507: Switch nullable type hints for consistent parameter definitions (#1681)
1 parent 260a6ca commit 4e23630

40 files changed

+129
-894
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -5118,36 +5118,12 @@ parameters:
51185118
count: 1
51195119
path: src/lib/Form/Data/ContentType/ContentTypesDeleteData.php
51205120

5121-
-
5122-
message: '#^PHPDoc tag @param for parameter \$baseLanguage with type Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Language\|null is not subtype of native type Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Language\.$#'
5123-
identifier: parameter.phpDocType
5124-
count: 1
5125-
path: src/lib/Form/Data/ContentType/Translation/TranslationAddData.php
5126-
5127-
-
5128-
message: '#^PHPDoc tag @param for parameter \$contentType with type Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType\|null is not subtype of native type Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType\.$#'
5129-
identifier: parameter.phpDocType
5130-
count: 1
5131-
path: src/lib/Form/Data/ContentType/Translation/TranslationAddData.php
5132-
5133-
-
5134-
message: '#^PHPDoc tag @param for parameter \$language with type Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Language\|null is not subtype of native type Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Language\.$#'
5135-
identifier: parameter.phpDocType
5136-
count: 1
5137-
path: src/lib/Form/Data/ContentType/Translation/TranslationAddData.php
5138-
51395121
-
51405122
message: '#^Method Ibexa\\AdminUi\\Form\\Data\\ContentType\\Translation\\TranslationRemoveData\:\:__construct\(\) has parameter \$languageCodes with no value type specified in iterable type array\.$#'
51415123
identifier: missingType.iterableValue
51425124
count: 1
51435125
path: src/lib/Form/Data/ContentType/Translation/TranslationRemoveData.php
51445126

5145-
-
5146-
message: '#^PHPDoc tag @param for parameter \$contentType with type Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType\|null is not subtype of native type Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType\.$#'
5147-
identifier: parameter.phpDocType
5148-
count: 1
5149-
path: src/lib/Form/Data/ContentType/Translation/TranslationRemoveData.php
5150-
51515127
-
51525128
message: '#^Method Ibexa\\AdminUi\\Form\\Data\\ContentTypeGroup\\ContentTypeGroupCreateData\:\:setIdentifier\(\) has no return type specified\.$#'
51535129
identifier: missingType.return
@@ -5532,24 +5508,6 @@ parameters:
55325508
count: 1
55335509
path: src/lib/Form/Data/Location/AbstractLocationCopyData.php
55345510

5535-
-
5536-
message: '#^PHPDoc tag @param has invalid value \(\\Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\|\|null \$location\)\: Unexpected token "\|", expected type at offset 75 on line 2$#'
5537-
identifier: phpDoc.parseError
5538-
count: 1
5539-
path: src/lib/Form/Data/Location/AbstractLocationCopyData.php
5540-
5541-
-
5542-
message: '#^PHPDoc tag @param has invalid value \(\\Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\|\|null \$newParentLocation\)\: Unexpected token "\|", expected type at offset 75 on line 2$#'
5543-
identifier: phpDoc.parseError
5544-
count: 1
5545-
path: src/lib/Form/Data/Location/AbstractLocationCopyData.php
5546-
5547-
-
5548-
message: '#^PHPDoc tag @return has invalid value \(\\Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\|\|null\)\: Unexpected token "\|", expected type at offset 76 on line 2$#'
5549-
identifier: phpDoc.parseError
5550-
count: 2
5551-
path: src/lib/Form/Data/Location/AbstractLocationCopyData.php
5552-
55535511
-
55545512
message: '#^Method Ibexa\\AdminUi\\Form\\Data\\Location\\LocationMoveData\:\:setLocation\(\) has no return type specified\.$#'
55555513
identifier: missingType.return
@@ -7266,12 +7224,6 @@ parameters:
72667224
count: 1
72677225
path: src/lib/Form/Factory/ContentTypeFormFactory.php
72687226

7269-
-
7270-
message: '#^PHPDoc tag @param has invalid value \(\\Ibexa\\AdminUi\\Form\\Data\\ContentType\\ContentTypeEditData\)\: Unexpected token "\\n \* ", expected variable at offset 74 on line 2$#'
7271-
identifier: phpDoc.parseError
7272-
count: 1
7273-
path: src/lib/Form/Factory/ContentTypeFormFactory.php
7274-
72757227
-
72767228
message: '#^Parameter \#1 \$name of method Symfony\\Component\\Form\\FormFactoryInterface\:\:createNamed\(\) expects string, string\|null given\.$#'
72777229
identifier: argument.type
@@ -7716,24 +7668,12 @@ parameters:
77167668
count: 1
77177669
path: src/lib/Form/Factory/FormFactory.php
77187670

7719-
-
7720-
message: '#^PHPDoc tag @param for parameter \$data with type Ibexa\\AdminUi\\Form\\Data\\Search\\SearchData\|null is not subtype of native type Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\|null\.$#'
7721-
identifier: parameter.phpDocType
7722-
count: 1
7723-
path: src/lib/Form/Factory/FormFactory.php
7724-
77257671
-
77267672
message: '#^Parameter \#1 \$name of method Symfony\\Component\\Form\\FormFactoryInterface\:\:createNamed\(\) expects string, string\|null given\.$#'
77277673
identifier: argument.type
77287674
count: 42
77297675
path: src/lib/Form/Factory/FormFactory.php
77307676

7731-
-
7732-
message: '#^Parameter \$data of method Ibexa\\AdminUi\\Form\\Factory\\FormFactory\:\:createSearchForm\(\) has invalid type Ibexa\\AdminUi\\Form\\Data\\Search\\SearchData\.$#'
7733-
identifier: class.notFound
7734-
count: 1
7735-
path: src/lib/Form/Factory/FormFactory.php
7736-
77377677
-
77387678
message: '#^Property Ibexa\\AdminUi\\Form\\Factory\\FormFactory\:\:\$translator is never read, only written\.$#'
77397679
identifier: property.onlyWritten

src/bundle/Controller/ContentTypeController.php

Lines changed: 3 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,6 @@ public function __construct(
122122
}
123123

124124
/**
125-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $group
126-
* @param string $routeName
127-
* @param int $page
128-
*
129-
* @return \Symfony\Component\HttpFoundation\Response
130-
*
131125
* @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
132126
* @throws \Pagerfanta\Exception\OutOfRangeCurrentPageException
133127
* @throws \Pagerfanta\Exception\NotIntegerCurrentPageException
@@ -180,8 +174,6 @@ public function listAction(ContentTypeGroup $group, string $routeName, int $page
180174
}
181175

182176
/**
183-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $group
184-
*
185177
* @return \Symfony\Component\HttpFoundation\Response|\Ibexa\AdminUi\View\ContentTypeCreateView
186178
*
187179
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException
@@ -227,11 +219,6 @@ public function addAction(ContentTypeGroup $group)
227219
return $view;
228220
}
229221

230-
/**
231-
* @param \Symfony\Component\HttpFoundation\Request $request
232-
*
233-
* @return \Symfony\Component\HttpFoundation\Response
234-
*/
235222
public function addTranslationAction(Request $request): Response
236223
{
237224
$form = $this->contentTypeFormFactory->addContentTypeTranslation(
@@ -287,11 +274,6 @@ public function addTranslationAction(Request $request): Response
287274
]);
288275
}
289276

290-
/**
291-
* @param \Symfony\Component\HttpFoundation\Request $request
292-
*
293-
* @return \Symfony\Component\HttpFoundation\Response
294-
*/
295277
public function removeTranslationAction(Request $request): Response
296278
{
297279
$form = $this->contentTypeFormFactory->removeContentTypeTranslation(
@@ -349,11 +331,6 @@ public function removeTranslationAction(Request $request): Response
349331
}
350332

351333
/**
352-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $group
353-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType
354-
*
355-
* @return \Symfony\Component\HttpFoundation\Response
356-
*
357334
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException
358335
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException
359336
*/
@@ -415,11 +392,6 @@ public function editAction(Request $request, ContentTypeGroup $group, ContentTyp
415392
}
416393

417394
/**
418-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $group
419-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType
420-
*
421-
* @return \Symfony\Component\HttpFoundation\Response
422-
*
423395
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException
424396
*/
425397
public function copyAction(Request $request, ContentTypeGroup $group, ContentType $contentType): Response
@@ -472,12 +444,6 @@ public function copyAction(Request $request, ContentTypeGroup $group, ContentTyp
472444
}
473445

474446
/**
475-
* @param \Symfony\Component\HttpFoundation\Request $request
476-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $group
477-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft
478-
* @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $language
479-
* @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $baseLanguage
480-
*
481447
* @return \Symfony\Component\HttpFoundation\Response|\Ibexa\AdminUi\View\ContentTypeEditView
482448
*
483449
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException
@@ -486,8 +452,8 @@ public function updateAction(
486452
Request $request,
487453
ContentTypeGroup $group,
488454
ContentTypeDraft $contentTypeDraft,
489-
Language $language = null,
490-
Language $baseLanguage = null
455+
?Language $language = null,
456+
?Language $baseLanguage = null
491457
) {
492458
if (!$language) {
493459
$language = $this->getDefaultLanguage($contentTypeDraft);
@@ -599,12 +565,6 @@ public function addFieldDefinitionFormAction(
599565
}
600566

601567
/**
602-
* @param \Symfony\Component\HttpFoundation\Request $request
603-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $group
604-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType
605-
*
606-
* @return \Symfony\Component\HttpFoundation\Response
607-
*
608568
* @throws \Symfony\Component\Translation\Exception\InvalidArgumentException
609569
*/
610570
public function deleteAction(Request $request, ContentTypeGroup $group, ContentType $contentType): Response
@@ -638,11 +598,6 @@ public function deleteAction(Request $request, ContentTypeGroup $group, ContentT
638598
/**
639599
* Handles removing content types based on submitted form.
640600
*
641-
* @param \Symfony\Component\HttpFoundation\Request $request
642-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $group
643-
*
644-
* @return \Symfony\Component\HttpFoundation\Response
645-
*
646601
* @throws \Symfony\Component\Translation\Exception\InvalidArgumentException
647602
* @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
648603
* @throws \InvalidArgumentException
@@ -680,11 +635,6 @@ public function bulkDeleteAction(Request $request, ContentTypeGroup $group): Res
680635
}
681636

682637
/**
683-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $group
684-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType
685-
*
686-
* @return \Symfony\Component\HttpFoundation\Response
687-
*
688638
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException
689639
*/
690640
public function viewAction(
@@ -737,18 +687,10 @@ public function viewAction(
737687
]);
738688
}
739689

740-
/**
741-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup
742-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft
743-
* @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $language
744-
* @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $baseLanguage
745-
*
746-
* @return \Symfony\Component\Form\FormInterface
747-
*/
748690
public function createUpdateForm(
749691
ContentTypeGroup $contentTypeGroup,
750692
ContentTypeDraft $contentTypeDraft,
751-
Language $language = null,
693+
?Language $language = null,
752694
?Language $baseLanguage = null
753695
): FormInterface {
754696
$this->metaFieldDefinitionService->addMetaFieldDefinitions($contentTypeDraft, $language);
@@ -773,12 +715,6 @@ public function createUpdateForm(
773715
]);
774716
}
775717

776-
/**
777-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $group
778-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType
779-
*
780-
* @return \Symfony\Component\Form\FormInterface
781-
*/
782718
protected function createDeleteForm(ContentTypeGroup $group, ContentType $contentType): FormInterface
783719
{
784720
$formBuilder = $this->createFormBuilder(null, [
@@ -805,10 +741,6 @@ private function getContentTypesNumbers(array $contentTypes): array
805741
}
806742

807743
/**
808-
* @param int $userId
809-
*
810-
* @return string|null
811-
*
812744
* @throws \Symfony\Component\Translation\Exception\InvalidArgumentException
813745
*/
814746
private function getUserNameById(int $userId): ?string
@@ -828,10 +760,6 @@ private function getUserNameById(int $userId): ?string
828760
}
829761

830762
/**
831-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft
832-
*
833-
* @return \Ibexa\Contracts\Core\Repository\Values\Content\Language
834-
*
835763
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException
836764
*/
837765
private function getDefaultLanguage(ContentTypeDraft $contentTypeDraft): Language
@@ -850,10 +778,6 @@ private function getDefaultLanguage(ContentTypeDraft $contentTypeDraft): Languag
850778
}
851779

852780
/**
853-
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType
854-
*
855-
* @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft
856-
*
857781
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException
858782
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException
859783
*/

src/bundle/Templating/Twig/IconPathExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function getFunctions(): array
4444
];
4545
}
4646

47-
public function getIconPath(string $icon, string $set = null): string
47+
public function getIconPath(string $icon, ?string $set = null): string
4848
{
4949
return $this->iconPathResolver->resolve($icon, $set);
5050
}

src/lib/Behat/BrowserContext/ContentActionsMenuContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(ContentActionsMenu $contentActionsMenu)
2828
* @Given I perform the :buttonName action
2929
* @Given I perform the :buttonName action from the :groupName group
3030
*/
31-
public function clickEditActionBar(string $buttonName, string $groupName = null): void
31+
public function clickEditActionBar(string $buttonName, ?string $groupName = null): void
3232
{
3333
$this->contentActionsMenu->clickButton($buttonName, $groupName);
3434
}

src/lib/Behat/BrowserContext/ContentViewContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(
3939
* @Given I start creating a new Content :contentType
4040
* @Given I start creating a new Content :contentType in :language language
4141
*/
42-
public function startCreatingContent(string $contentType, string $language = null): void
42+
public function startCreatingContent(string $contentType, ?string $language = null): void
4343
{
4444
$this->contentViewPage->startCreatingContent($contentType, $language);
4545
}
@@ -107,7 +107,7 @@ public function startCreatingUser(string $contentTypeName = 'User'): void
107107
* @Given I start editing the current content
108108
* @Given I start editing the current content in :language language
109109
*/
110-
public function startEditingContent(string $language = null): void
110+
public function startEditingContent(?string $language = null): void
111111
{
112112
$this->contentViewPage->editContent($language);
113113
}

src/lib/Behat/BrowserContext/NavigationContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function iClickOnBreadcrumbLink(string $element): void
137137
/**
138138
* @Given I navigate to content :contentName of type :contentType in :path
139139
*/
140-
public function iNavigateToContent(string $contentName, string $contentType, string $path = null)
140+
public function iNavigateToContent(string $contentName, string $contentType, ?string $path = null)
141141
{
142142
$expectedContentPath = sprintf('%s/%s', $path, $contentName);
143143
$pathParts = explode('/', $expectedContentPath);

src/lib/Behat/Page/ContentViewPage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function __construct(
120120
$this->deleteContentDialog = $deleteContentDialog;
121121
}
122122

123-
public function startCreatingContent(string $contentTypeName, string $language = null)
123+
public function startCreatingContent(string $contentTypeName, ?string $language = null)
124124
{
125125
$this->contentActionsMenu->clickButton('Create content');
126126
$this->contentTypePicker->verifyIsLoaded();

src/lib/Component/LinkComponent.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,13 @@ class LinkComponent implements ComponentInterface
3535
/** @var string|null */
3636
protected $integrity;
3737

38-
/**
39-
* @param \Twig\Environment $twig
40-
* @param string $href
41-
* @param string $type
42-
* @param string $rel
43-
* @param string|null $crossorigin
44-
* @param string|null $integrity
45-
*/
4638
public function __construct(
4739
Environment $twig,
4840
string $href,
4941
string $type = 'text/css',
5042
string $rel = 'stylesheet',
51-
string $crossorigin = null,
52-
string $integrity = null
43+
?string $crossorigin = null,
44+
?string $integrity = null
5345
) {
5446
$this->twig = $twig;
5547
$this->href = $href;

0 commit comments

Comments
 (0)