1717use Symfony \UX \TwigComponent \Attribute \PreMount ;
1818
1919/**
20- * @phpstan-type DropdownItem array{
20+ * @phpstan-type TDropdownItem array{
2121 * id: string,
2222 * label: string
2323 * }
2424 */
2525abstract class AbstractDropdown
2626{
27- private const TRANSLATION_DOMAIN = 'ibexa_design_system_twig ' ;
27+ private const string TRANSLATION_DOMAIN = 'ibexa_design_system_twig ' ;
2828
2929 public string $ name ;
3030
3131 public bool $ disabled = false ;
3232
3333 public bool $ error = false ;
3434
35- /** @var array<DropdownItem > */
35+ /** @var array<TDropdownItem > */
3636 public array $ items = [];
3737
3838 public string $ placeholder ;
@@ -100,7 +100,7 @@ abstract protected function configurePropsResolver(OptionsResolver $resolver): v
100100 * @param Options<array<string, mixed>> $options
101101 * @param array<int, mixed> $items
102102 *
103- * @return array<int, DropdownItem >
103+ * @return array<int, TDropdownItem >
104104 */
105105 private static function normalizeItems (Options $ options , array $ items ): array
106106 {
@@ -112,7 +112,7 @@ private static function normalizeItems(Options $options, array $items): array
112112 ->setAllowedTypes ('label ' , 'string ' );
113113
114114 foreach ($ items as $ index => $ item ) {
115- if (!\ is_array ($ item )) {
115+ if (!is_array ($ item )) {
116116 throw new InvalidOptionsException (
117117 sprintf (
118118 'Each dropdown item must be an array, "%s" given at index %d. ' ,
@@ -122,9 +122,7 @@ private static function normalizeItems(Options $options, array $items): array
122122 );
123123 }
124124
125- $ resolvedItem = $ itemResolver ->resolve ($ item );
126-
127- $ items [$ index ] = $ resolvedItem ;
125+ $ items [$ index ] = $ itemResolver ->resolve ($ item );
128126 }
129127
130128 return $ items ;
0 commit comments