Merge pull request #4839 from Ocramius/patch-1

Dead code removal (constructor type-hints are sufficient)
This commit is contained in:
Damian Mooyman 2015-12-11 13:46:44 +13:00
commit 79b86c304e

View File

@ -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);