From ffda95334f069c5bcbfed476153aee55bf29aa49 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Fri, 11 Dec 2015 01:30:07 +0100 Subject: [PATCH] Dead code removal (constructor type-hints are sufficient) Thanks to @lcobucci for making me notice this. --- forms/Form.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/forms/Form.php b/forms/Form.php index ba2ada081..aa1cf4fe4 100644 --- a/forms/Form.php +++ b/forms/Form.php @@ -229,21 +229,11 @@ class Form extends RequestHandler { * @param FieldList $fields All of the fields in the form - a {@link FieldList} of {@link FormField} objects. * @param FieldList $actions All of the action buttons in the form - a {@link FieldLis} of * {@link FormAction} objects - * @param Validator $validator Override the default validator instance (Default: {@link RequiredFields}) + * @param Validator|null $validator Override the default validator instance (Default: {@link RequiredFields}) */ - public function __construct($controller, $name, FieldList $fields, FieldList $actions, $validator = null) { + public function __construct($controller, $name, FieldList $fields, FieldList $actions, Validator $validator = null) { parent::__construct(); - if(!$fields instanceof FieldList) { - throw new InvalidArgumentException('$fields must be a valid FieldList instance'); - } - if(!$actions instanceof FieldList) { - throw new InvalidArgumentException('$actions must be a valid FieldList instance'); - } - if($validator && !$validator instanceof Validator) { - throw new InvalidArgumentException('$validator must be a Validator instance'); - } - $fields->setForm($this); $actions->setForm($this);