Skip to content

Commit 5114272

Browse files
committed
IBX-9060: Specified iterable value types and generic return types to satisfy PHPStan
1 parent d30f7ad commit 5114272

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

src/bundle/Form/Data/SearchQueryData.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,24 @@
1212

1313
final class SearchQueryData
1414
{
15+
/** @var string[] */
1516
private array $statuses = [];
1617

1718
private ?string $type = null;
1819

1920
private ?DateRangeData $createdRange = null;
2021

22+
/**
23+
* @return string[]
24+
*/
2125
public function getStatuses(): array
2226
{
2327
return $this->statuses;
2428
}
2529

30+
/**
31+
* @param string[] $statuses
32+
*/
2633
public function setStatuses(array $statuses): void
2734
{
2835
$this->statuses = $statuses;

src/bundle/Form/Type/SearchType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
use Symfony\Component\Form\FormBuilderInterface;
1616
use Symfony\Component\OptionsResolver\OptionsResolver;
1717

18+
/**
19+
* @extends AbstractType<SearchQueryData>
20+
*/
1821
final class SearchType extends AbstractType
1922
{
2023
public function buildForm(FormBuilderInterface $builder, array $options): void

src/lib/Form/Data/Notification/NotificationSelectionData.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,28 @@
1010

1111
class NotificationSelectionData
1212
{
13+
/** @var \Ibexa\Contracts\Core\Repository\Values\Notification\Notification[] */
1314
private array $notifications;
1415

16+
/**
17+
* @param \Ibexa\Contracts\Core\Repository\Values\Notification\Notification[] $notifications
18+
*/
1519
public function __construct(array $notifications = [])
1620
{
1721
$this->notifications = $notifications;
1822
}
1923

24+
/**
25+
* @return \Ibexa\Contracts\Core\Repository\Values\Notification\Notification[]
26+
*/
2027
public function getNotifications(): array
2128
{
2229
return $this->notifications;
2330
}
2431

32+
/**
33+
* @param \Ibexa\Contracts\Core\Repository\Values\Notification\Notification[] $notifications
34+
*/
2535
public function setNotifications(array $notifications): void
2636
{
2737
$this->notifications = $notifications;

src/lib/Form/Factory/FormFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ public function removeContentDraft(
10701070
* @param \Ibexa\AdminUi\Form\Data\Notification\NotificationSelectionData|null $data
10711071
* @param string|null $name
10721072
*
1073-
* @return \Symfony\Component\Form\FormInterface
1073+
* @return \Symfony\Component\Form\FormInterface<\Ibexa\AdminUi\Form\Data\Notification\NotificationSelectionData|null>
10741074
*/
10751075
public function deleteNotification(
10761076
NotificationSelectionData $data = null,
@@ -1141,7 +1141,7 @@ public function deleteURLWildcard(
11411141
?URLWildcardDeleteData $data = null,
11421142
?string $name = null
11431143
): FormInterface {
1144-
$name = $name ?: StringUtil::fqcnToBlockPrefix(URLWildcardDeleteType::class);
1144+
$name = (string)($name ?: StringUtil::fqcnToBlockPrefix(URLWildcardDeleteType::class));
11451145

11461146
return $this->formFactory->createNamed(
11471147
$name,

src/lib/Form/Type/Notification/NotificationSelectionType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
use Symfony\Component\Form\FormBuilderInterface;
1717
use Symfony\Component\OptionsResolver\OptionsResolver;
1818

19+
/**
20+
* @extends AbstractType<NotificationSelectionData>
21+
*/
1922
class NotificationSelectionType extends AbstractType
2023
{
2124
public function buildForm(FormBuilderInterface $builder, array $options): void

0 commit comments

Comments
 (0)