File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed
src/Symfony/Component/Form Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -430,10 +430,12 @@ public function setIsEmptyCallback(?callable $isEmptyCallback)
430430
431431 /**
432432 * Unsupported method.
433+ *
434+ * @throws BadMethodCallException
433435 */
434436 public function getEventDispatcher ()
435437 {
436- return null ;
438+ throw new BadMethodCallException ( ' Buttons do not support event dispatching. ' ) ;
437439 }
438440
439441 /**
@@ -626,26 +628,32 @@ public function getFormFactory()
626628
627629 /**
628630 * Unsupported method.
631+ *
632+ * @throws BadMethodCallException
629633 */
630634 public function getAction ()
631635 {
632- return null ;
636+ throw new BadMethodCallException ( ' Buttons do not support actions. ' ) ;
633637 }
634638
635639 /**
636640 * Unsupported method.
641+ *
642+ * @throws BadMethodCallException
637643 */
638644 public function getMethod ()
639645 {
640- return null ;
646+ throw new BadMethodCallException ( ' Buttons do not support methods. ' ) ;
641647 }
642648
643649 /**
644650 * Unsupported method.
651+ *
652+ * @throws BadMethodCallException
645653 */
646654 public function getRequestHandler ()
647655 {
648- return null ;
656+ throw new BadMethodCallException ( ' Buttons do not support request handlers. ' ) ;
649657 }
650658
651659 /**
Original file line number Diff line number Diff line change @@ -88,11 +88,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
8888 */
8989 private $ formFactory ;
9090
91- /**
92- * @var string|null
93- */
94- private $ action ;
95-
91+ private $ action = '' ;
9692 private $ method = 'POST ' ;
9793
9894 /**
@@ -396,6 +392,10 @@ public function getDataLocked()
396392 */
397393 public function getFormFactory ()
398394 {
395+ if (!isset ($ this ->formFactory )) {
396+ throw new BadMethodCallException ('The form factory must be set before retrieving it. ' );
397+ }
398+
399399 return $ this ->formFactory ;
400400 }
401401
You can’t perform that action at this time.
0 commit comments