Skip to content

Commit 8c15bd4

Browse files
committed
Type all iterable
1 parent 34bb109 commit 8c15bd4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+376
-28
lines changed

phpstan.neon.dist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ parameters:
1919
- '#Property EasyCorp\\Bundle\\EasyAdminBundle\\Twig\\EasyAdminTwigExtension::\$uxIconRuntime has unknown class Symfony\\UX\\Icons\\Twig\\UXIconRuntime as its type#'
2020
- '#Parameter \$uxIconRuntime of method EasyCorp\\Bundle\\EasyAdminBundle\\Twig\\EasyAdminTwigExtension::__construct\(\) has invalid type Symfony\\UX\\Icons\\Twig\\UXIconRuntime#'
2121
- '#Call to method renderIcon\(\) on an unknown class Symfony\\UX\\Icons\\Twig\\UXIconRuntime#'
22-
-
23-
identifier: missingType.iterableValue
2422
-
2523
identifier: missingType.generics
2624
treatPhpDocTypesAsCertain: false

src/Attribute/AdminAction.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#[\Attribute(\Attribute::TARGET_METHOD)]
99
class AdminAction
1010
{
11+
/**
12+
* @param array<string> $methods
13+
*/
1114
public function __construct(
1215
public ?string $routePath = null,
1316
public ?string $routeName = null,

src/Config/Actions.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ public function remove(string $pageName, string $actionName): self
7575
return $this;
7676
}
7777

78+
/**
79+
* @param array<string> $orderedActionNames
80+
*/
7881
public function reorder(string $pageName, array $orderedActionNames): self
7982
{
8083
$newActionOrder = [];
@@ -109,7 +112,7 @@ public function setPermission(string $actionName, string|Expression $permission)
109112
}
110113

111114
/**
112-
* @param array $permissions Syntax: ['actionName' => 'actionPermission', ...]
115+
* @param array<string, string|Expression> $permissions Syntax: ['actionName' => 'actionPermission', ...]
113116
*/
114117
public function setPermissions(array $permissions): self
115118
{

src/Config/Asset.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ public function htmlAttr(string $attrName, string $attrValue): self
107107
return $this;
108108
}
109109

110+
/**
111+
* @param array<string, string> $attrNamesAndValues
112+
*/
110113
public function htmlAttrs(array $attrNamesAndValues): self
111114
{
112115
foreach ($attrNamesAndValues as $attrName => $attrValue) {

src/Config/Dashboard.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ public function setDefaultColorScheme(string $colorScheme): self
110110
return $this;
111111
}
112112

113+
/**
114+
* @param array<Locale|string> $locales
115+
*/
113116
public function setLocales(array $locales): self
114117
{
115118
$localeDtos = [];

src/Config/Menu/MenuItemTrait.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,13 @@ public function setLinkTarget(string $target): self
5858
}
5959

6060
/**
61-
* @param mixed $content This is rendered as the value of the badge; it can be anything that can be cast to
62-
* a string (numbers, stringable objects, etc.)
63-
* @param string $style Pass one of these values for predefined styles: 'primary', 'secondary', 'success',
64-
* 'danger', 'warning', 'info', 'light', 'dark'
65-
* Otherwise, the passed value is applied "as is" to the `style` attribute of the HTML
66-
* element of the badge
61+
* @param mixed $content This is rendered as the value of the badge; it can be anything that can be cast to
62+
* a string (numbers, stringable objects, etc.)
63+
* @param string $style Pass one of these values for predefined styles: 'primary', 'secondary', 'success',
64+
* 'danger', 'warning', 'info', 'light', 'dark'
65+
* Otherwise, the passed value is applied "as is" to the `style` attribute of the HTML
66+
* element of the badge
67+
* @param array<string, mixed> $htmlAttributes
6768
*/
6869
public function setBadge(/* \Stringable|string|int|float|bool|null */ $content, string $style = 'secondary', array $htmlAttributes = []): self
6970
{

src/Config/Menu/RouteMenuItem.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ final class RouteMenuItem implements MenuItemInterface
1515
{
1616
use MenuItemTrait;
1717

18+
/**
19+
* @param array<string, mixed> $routeParameters
20+
*/
1821
public function __construct(TranslatableInterface|string $label, ?string $icon, string $routeName, array $routeParameters)
1922
{
2023
$this->dto = new MenuItemDto();

src/Config/MenuItem.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ public static function linkToLogout(TranslatableInterface|string $label, ?string
5454
}
5555

5656
/**
57-
* @param string|null $icon The full CSS classes of the FontAwesome icon to render (see https://fontawesome.com/v6/search?m=free)
57+
* @param string|null $icon The full CSS classes of the FontAwesome icon to render (see https://fontawesome.com/v6/search?m=free)
58+
* @param array<string, mixed> $routeParameters
5859
*/
5960
public static function linkToRoute(TranslatableInterface|string $label, ?string $icon, string $routeName, array $routeParameters = []): RouteMenuItem
6061
{

src/Context/ExceptionContext.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ final class ExceptionContext
1111
{
1212
private string $publicMessage;
1313
private string $debugMessage;
14+
/** @var array<string> */
1415
private array $parameters;
1516
private int $statusCode;
1617

18+
/**
19+
* @param array<string> $parameters
20+
*/
1721
public function __construct(string $publicMessage, string $debugMessage = '', array $parameters = [], int $statusCode = 500)
1822
{
1923
$this->publicMessage = $publicMessage;
@@ -32,11 +36,17 @@ public function getDebugMessage(): string
3236
return $this->debugMessage;
3337
}
3438

39+
/**
40+
* @return array<string>
41+
*/
3542
public function getParameters(): array
3643
{
3744
return $this->parameters;
3845
}
3946

47+
/**
48+
* @return array<string>
49+
*/
4050
public function getTranslationParameters(): array
4151
{
4252
return array_map(

src/Contracts/Filter/FilterConfiguratorInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
*/
1313
interface FilterConfiguratorInterface
1414
{
15+
/**
16+
* @param AdminContext $context This will change to AdminContextInterface in the next major version
17+
*/
1518
public function supports(FilterDto $filterDto, ?FieldDto $fieldDto, EntityDto $entityDto, AdminContext $context): bool;
1619

20+
/**
21+
* @param AdminContext $context This will change to AdminContextInterface in the next major version
22+
*/
1723
public function configure(FilterDto $filterDto, ?FieldDto $fieldDto, EntityDto $entityDto, AdminContext $context): void;
1824
}

0 commit comments

Comments
 (0)