File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -412,10 +412,12 @@ public function setIsEmptyCallback(?callable $isEmptyCallback): static
412
412
413
413
/**
414
414
* Unsupported method.
415
+ *
416
+ * @throws BadMethodCallException
415
417
*/
416
418
public function getEventDispatcher ()
417
419
{
418
- return null ;
420
+ throw new BadMethodCallException ( ' Buttons do not support event dispatching. ' ) ;
419
421
}
420
422
421
423
/**
@@ -606,26 +608,32 @@ public function getFormFactory()
606
608
607
609
/**
608
610
* Unsupported method.
611
+ *
612
+ * @throws BadMethodCallException
609
613
*/
610
614
public function getAction ()
611
615
{
612
- return null ;
616
+ throw new BadMethodCallException ( ' Buttons do not support actions. ' ) ;
613
617
}
614
618
615
619
/**
616
620
* Unsupported method.
621
+ *
622
+ * @throws BadMethodCallException
617
623
*/
618
624
public function getMethod ()
619
625
{
620
- return null ;
626
+ throw new BadMethodCallException ( ' Buttons do not support methods. ' ) ;
621
627
}
622
628
623
629
/**
624
630
* Unsupported method.
631
+ *
632
+ * @throws BadMethodCallException
625
633
*/
626
634
public function getRequestHandler ()
627
635
{
628
- return null ;
636
+ throw new BadMethodCallException ( ' Buttons do not support request handlers. ' ) ;
629
637
}
630
638
631
639
/**
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
54
54
private ?string $ dataClass ;
55
55
private bool $ dataLocked = false ;
56
56
private ?FormFactoryInterface $ formFactory = null ;
57
- private ? string $ action = null ;
57
+ private string $ action ;
58
58
private string $ method = 'POST ' ;
59
59
private RequestHandlerInterface $ requestHandler ;
60
60
private bool $ autoInitialize = false ;
@@ -353,6 +353,10 @@ public function getDataLocked()
353
353
*/
354
354
public function getFormFactory ()
355
355
{
356
+ if (!isset ($ this ->formFactory )) {
357
+ throw new BadMethodCallException ('The form factory must be set before retrieving it. ' );
358
+ }
359
+
356
360
return $ this ->formFactory ;
357
361
}
358
362
You can’t perform that action at this time.
0 commit comments