Skip to content

Commit cb76849

Browse files
committed
Add missing return types
1 parent 8428ce6 commit cb76849

File tree

8 files changed

+111
-3
lines changed

8 files changed

+111
-3
lines changed

AbstractType.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,17 @@ public function configureOptions(OptionsResolver $resolver)
4848
{
4949
}
5050

51+
/**
52+
* @return string
53+
*/
5154
public function getBlockPrefix()
5255
{
5356
return StringUtil::fqcnToBlockPrefix(static::class) ?: '';
5457
}
5558

59+
/**
60+
* @return string|null
61+
*/
5662
public function getParent()
5763
{
5864
return FormType::class;

ButtonBuilder.php

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public function __construct(?string $name, array $options = [])
5252
/**
5353
* Unsupported method.
5454
*
55+
* @return never
56+
*
5557
* @throws BadMethodCallException
5658
*/
5759
public function add(string|FormBuilderInterface $child, string $type = null, array $options = []): static
@@ -62,6 +64,8 @@ public function add(string|FormBuilderInterface $child, string $type = null, arr
6264
/**
6365
* Unsupported method.
6466
*
67+
* @return never
68+
*
6569
* @throws BadMethodCallException
6670
*/
6771
public function create(string $name, string $type = null, array $options = []): FormBuilderInterface
@@ -72,6 +76,8 @@ public function create(string $name, string $type = null, array $options = []):
7276
/**
7377
* Unsupported method.
7478
*
79+
* @return never
80+
*
7581
* @throws BadMethodCallException
7682
*/
7783
public function get(string $name): FormBuilderInterface
@@ -82,6 +88,8 @@ public function get(string $name): FormBuilderInterface
8288
/**
8389
* Unsupported method.
8490
*
91+
* @return never
92+
*
8593
* @throws BadMethodCallException
8694
*/
8795
public function remove(string $name): static
@@ -116,6 +124,8 @@ public function getForm(): Button
116124
/**
117125
* Unsupported method.
118126
*
127+
* @return never
128+
*
119129
* @throws BadMethodCallException
120130
*/
121131
public function addEventListener(string $eventName, callable $listener, int $priority = 0): static
@@ -126,6 +136,8 @@ public function addEventListener(string $eventName, callable $listener, int $pri
126136
/**
127137
* Unsupported method.
128138
*
139+
* @return never
140+
*
129141
* @throws BadMethodCallException
130142
*/
131143
public function addEventSubscriber(EventSubscriberInterface $subscriber): static
@@ -136,6 +148,8 @@ public function addEventSubscriber(EventSubscriberInterface $subscriber): static
136148
/**
137149
* Unsupported method.
138150
*
151+
* @return never
152+
*
139153
* @throws BadMethodCallException
140154
*/
141155
public function addViewTransformer(DataTransformerInterface $viewTransformer, bool $forcePrepend = false): static
@@ -146,6 +160,8 @@ public function addViewTransformer(DataTransformerInterface $viewTransformer, bo
146160
/**
147161
* Unsupported method.
148162
*
163+
* @return never
164+
*
149165
* @throws BadMethodCallException
150166
*/
151167
public function resetViewTransformers(): static
@@ -156,6 +172,8 @@ public function resetViewTransformers(): static
156172
/**
157173
* Unsupported method.
158174
*
175+
* @return never
176+
*
159177
* @throws BadMethodCallException
160178
*/
161179
public function addModelTransformer(DataTransformerInterface $modelTransformer, bool $forceAppend = false): static
@@ -166,6 +184,8 @@ public function addModelTransformer(DataTransformerInterface $modelTransformer,
166184
/**
167185
* Unsupported method.
168186
*
187+
* @return never
188+
*
169189
* @throws BadMethodCallException
170190
*/
171191
public function resetModelTransformers(): static
@@ -196,6 +216,8 @@ public function setAttributes(array $attributes): static
196216
/**
197217
* Unsupported method.
198218
*
219+
* @return never
220+
*
199221
* @throws BadMethodCallException
200222
*/
201223
public function setDataMapper(DataMapperInterface $dataMapper = null): static
@@ -222,6 +244,8 @@ public function setDisabled(bool $disabled): static
222244
/**
223245
* Unsupported method.
224246
*
247+
* @return never
248+
*
225249
* @throws BadMethodCallException
226250
*/
227251
public function setEmptyData(mixed $emptyData): static
@@ -232,6 +256,8 @@ public function setEmptyData(mixed $emptyData): static
232256
/**
233257
* Unsupported method.
234258
*
259+
* @return never
260+
*
235261
* @throws BadMethodCallException
236262
*/
237263
public function setErrorBubbling(bool $errorBubbling): static
@@ -242,6 +268,8 @@ public function setErrorBubbling(bool $errorBubbling): static
242268
/**
243269
* Unsupported method.
244270
*
271+
* @return never
272+
*
245273
* @throws BadMethodCallException
246274
*/
247275
public function setRequired(bool $required): static
@@ -252,6 +280,8 @@ public function setRequired(bool $required): static
252280
/**
253281
* Unsupported method.
254282
*
283+
* @return never
284+
*
255285
* @throws BadMethodCallException
256286
*/
257287
public function setPropertyPath(string|PropertyPathInterface|null $propertyPath): static
@@ -262,6 +292,8 @@ public function setPropertyPath(string|PropertyPathInterface|null $propertyPath)
262292
/**
263293
* Unsupported method.
264294
*
295+
* @return never
296+
*
265297
* @throws BadMethodCallException
266298
*/
267299
public function setMapped(bool $mapped): static
@@ -272,6 +304,8 @@ public function setMapped(bool $mapped): static
272304
/**
273305
* Unsupported method.
274306
*
307+
* @return never
308+
*
275309
* @throws BadMethodCallException
276310
*/
277311
public function setByReference(bool $byReference): static
@@ -282,6 +316,8 @@ public function setByReference(bool $byReference): static
282316
/**
283317
* Unsupported method.
284318
*
319+
* @return never
320+
*
285321
* @throws BadMethodCallException
286322
*/
287323
public function setCompound(bool $compound): static
@@ -304,6 +340,8 @@ public function setType(ResolvedFormTypeInterface $type): static
304340
/**
305341
* Unsupported method.
306342
*
343+
* @return never
344+
*
307345
* @throws BadMethodCallException
308346
*/
309347
public function setData(mixed $data): static
@@ -314,6 +352,8 @@ public function setData(mixed $data): static
314352
/**
315353
* Unsupported method.
316354
*
355+
* @return never
356+
*
317357
* @throws BadMethodCallException
318358
*/
319359
public function setDataLocked(bool $locked): static
@@ -324,6 +364,8 @@ public function setDataLocked(bool $locked): static
324364
/**
325365
* Unsupported method.
326366
*
367+
* @return never
368+
*
327369
* @throws BadMethodCallException
328370
*/
329371
public function setFormFactory(FormFactoryInterface $formFactory)
@@ -334,6 +376,8 @@ public function setFormFactory(FormFactoryInterface $formFactory)
334376
/**
335377
* Unsupported method.
336378
*
379+
* @return never
380+
*
337381
* @throws BadMethodCallException
338382
*/
339383
public function setAction(string $action): static
@@ -344,6 +388,8 @@ public function setAction(string $action): static
344388
/**
345389
* Unsupported method.
346390
*
391+
* @return never
392+
*
347393
* @throws BadMethodCallException
348394
*/
349395
public function setMethod(string $method): static
@@ -354,6 +400,8 @@ public function setMethod(string $method): static
354400
/**
355401
* Unsupported method.
356402
*
403+
* @return never
404+
*
357405
* @throws BadMethodCallException
358406
*/
359407
public function setRequestHandler(RequestHandlerInterface $requestHandler): static
@@ -380,6 +428,8 @@ public function setAutoInitialize(bool $initialize): static
380428
/**
381429
* Unsupported method.
382430
*
431+
* @return never
432+
*
383433
* @throws BadMethodCallException
384434
*/
385435
public function setInheritData(bool $inheritData): static
@@ -402,6 +452,8 @@ public function getFormConfig(): FormConfigInterface
402452
/**
403453
* Unsupported method.
404454
*
455+
* @return never
456+
*
405457
* @throws BadMethodCallException
406458
*/
407459
public function setIsEmptyCallback(?callable $isEmptyCallback): static
@@ -412,6 +464,8 @@ public function setIsEmptyCallback(?callable $isEmptyCallback): static
412464
/**
413465
* Unsupported method.
414466
*
467+
* @return never
468+
*
415469
* @throws BadMethodCallException
416470
*/
417471
public function getEventDispatcher(): EventDispatcherInterface
@@ -570,6 +624,8 @@ public function getDataLocked(): bool
570624

571625
/**
572626
* Unsupported method.
627+
*
628+
* @return never
573629
*/
574630
public function getFormFactory(): FormFactoryInterface
575631
{
@@ -579,6 +635,8 @@ public function getFormFactory(): FormFactoryInterface
579635
/**
580636
* Unsupported method.
581637
*
638+
* @return never
639+
*
582640
* @throws BadMethodCallException
583641
*/
584642
public function getAction(): string
@@ -589,6 +647,8 @@ public function getAction(): string
589647
/**
590648
* Unsupported method.
591649
*
650+
* @return never
651+
*
592652
* @throws BadMethodCallException
593653
*/
594654
public function getMethod(): string
@@ -599,6 +659,8 @@ public function getMethod(): string
599659
/**
600660
* Unsupported method.
601661
*
662+
* @return never
663+
*
602664
* @throws BadMethodCallException
603665
*/
604666
public function getRequestHandler(): RequestHandlerInterface
@@ -649,6 +711,8 @@ public function getOption(string $name, mixed $default = null): mixed
649711
/**
650712
* Unsupported method.
651713
*
714+
* @return never
715+
*
652716
* @throws BadMethodCallException
653717
*/
654718
public function getIsEmptyCallback(): ?callable

Extension/Core/DataAccessor/PropertyPathAccessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function isWritable(object|array $data, FormInterface $form): bool
7474
return null !== $form->getPropertyPath();
7575
}
7676

77-
private function getPropertyValue(object|array $data, PropertyPathInterface $propertyPath)
77+
private function getPropertyValue(object|array $data, PropertyPathInterface $propertyPath): mixed
7878
{
7979
try {
8080
return $this->propertyAccessor->getValue($data, $propertyPath);

Extension/Core/Type/ChoiceType.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ public function __construct(ChoiceListFactoryInterface $choiceListFactory = null
6262
$this->translator = $translator;
6363
}
6464

65+
/**
66+
* @return void
67+
*/
6568
public function buildForm(FormBuilderInterface $builder, array $options)
6669
{
6770
$unknownValues = [];
@@ -215,6 +218,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
215218
}, 256);
216219
}
217220

221+
/**
222+
* @return void
223+
*/
218224
public function buildView(FormView $view, FormInterface $form, array $options)
219225
{
220226
$choiceTranslationDomain = $options['choice_translation_domain'];
@@ -269,6 +275,9 @@ public function buildView(FormView $view, FormInterface $form, array $options)
269275
}
270276
}
271277

278+
/**
279+
* @return void
280+
*/
272281
public function finishView(FormView $view, FormInterface $form, array $options)
273282
{
274283
if ($options['expanded']) {
@@ -286,6 +295,9 @@ public function finishView(FormView $view, FormInterface $form, array $options)
286295
}
287296
}
288297

298+
/**
299+
* @return void
300+
*/
289301
public function configureOptions(OptionsResolver $resolver)
290302
{
291303
$emptyData = static function (Options $options) {
@@ -383,7 +395,7 @@ public function getBlockPrefix(): string
383395
/**
384396
* Adds the sub fields for an expanded choice field.
385397
*/
386-
private function addSubForms(FormBuilderInterface $builder, array $choiceViews, array $options)
398+
private function addSubForms(FormBuilderInterface $builder, array $choiceViews, array $options): void
387399
{
388400
foreach ($choiceViews as $name => $choiceView) {
389401
// Flatten groups
@@ -401,7 +413,7 @@ private function addSubForms(FormBuilderInterface $builder, array $choiceViews,
401413
}
402414
}
403415

404-
private function addSubForm(FormBuilderInterface $builder, string $name, ChoiceView $choiceView, array $options)
416+
private function addSubForm(FormBuilderInterface $builder, string $name, ChoiceView $choiceView, array $options): void
405417
{
406418
$choiceOpts = [
407419
'value' => $choiceView->value,

0 commit comments

Comments
 (0)