Skip to content

Commit d50df48

Browse files
Merge branch '5.4' into 6.0
* 5.4: [Security] Deprecate legacy remember me services [Form] Fix return types in form builder
2 parents 59330eb + 38b92e4 commit d50df48

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

ButtonBuilder.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,10 +412,12 @@ public function setIsEmptyCallback(?callable $isEmptyCallback): static
412412

413413
/**
414414
* Unsupported method.
415+
*
416+
* @throws BadMethodCallException
415417
*/
416418
public function getEventDispatcher()
417419
{
418-
return null;
420+
throw new BadMethodCallException('Buttons do not support event dispatching.');
419421
}
420422

421423
/**
@@ -606,26 +608,32 @@ public function getFormFactory()
606608

607609
/**
608610
* Unsupported method.
611+
*
612+
* @throws BadMethodCallException
609613
*/
610614
public function getAction()
611615
{
612-
return null;
616+
throw new BadMethodCallException('Buttons do not support actions.');
613617
}
614618

615619
/**
616620
* Unsupported method.
621+
*
622+
* @throws BadMethodCallException
617623
*/
618624
public function getMethod()
619625
{
620-
return null;
626+
throw new BadMethodCallException('Buttons do not support methods.');
621627
}
622628

623629
/**
624630
* Unsupported method.
631+
*
632+
* @throws BadMethodCallException
625633
*/
626634
public function getRequestHandler()
627635
{
628-
return null;
636+
throw new BadMethodCallException('Buttons do not support request handlers.');
629637
}
630638

631639
/**

FormConfigBuilder.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
5454
private ?string $dataClass;
5555
private bool $dataLocked = false;
5656
private ?FormFactoryInterface $formFactory = null;
57-
private ?string $action = null;
57+
private string $action;
5858
private string $method = 'POST';
5959
private RequestHandlerInterface $requestHandler;
6060
private bool $autoInitialize = false;
@@ -353,6 +353,10 @@ public function getDataLocked()
353353
*/
354354
public function getFormFactory()
355355
{
356+
if (!isset($this->formFactory)) {
357+
throw new BadMethodCallException('The form factory must be set before retrieving it.');
358+
}
359+
356360
return $this->formFactory;
357361
}
358362

0 commit comments

Comments
 (0)