Merge pull request #1078 from GuySartorelli/patch-1

ENH Avoid use of 'new' keyword on injectable classes from this module.
This commit is contained in:
Daniel Hensby 2021-06-02 10:06:39 +01:00 committed by GitHub
commit edb3d4ca8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -118,7 +118,7 @@ class UserForm extends Form
*/
public function getFormFields()
{
$fields = new UserFormsFieldList();
$fields = UserFormsFieldList::create();
$target = $fields;
foreach ($this->controller->data()->Fields() as $field) {
@ -174,7 +174,7 @@ class UserForm extends Form
->filter('Required', true)
->column('Name');
$requiredNames = array_merge($requiredNames, $this->getEmailRecipientRequiredFields());
$required = new UserFormsRequiredFields($requiredNames);
$required = UserFormsRequiredFields::create($requiredNames);
$this->extend('updateRequiredFields', $required);
$required->setForm($this);
return $required;