diff --git a/src/Forms/CompositeValidator.php b/src/Forms/CompositeValidator.php index cc4c508c1a7..8864168d348 100644 --- a/src/Forms/CompositeValidator.php +++ b/src/Forms/CompositeValidator.php @@ -4,6 +4,7 @@ use InvalidArgumentException; use SilverStripe\Core\Validation\ValidationResult; +use SilverStripe\Dev\Deprecation; /** * CompositeValidator can contain between 0 and many different types of Validators. Each Validator is itself still @@ -30,6 +31,7 @@ * { * $compositeValidator->addValidator(RequiredFields::create(['AdditionalContent'])); * } + * @deprecated 5.4.0 Will be renamed to SilverStripe\Forms\Validation\CompositeValidator */ class CompositeValidator extends Validator { @@ -45,8 +47,12 @@ class CompositeValidator extends Validator */ public function __construct(array $validators = []) { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be renamed to SilverStripe\\Forms\\Validation\\CompositeValidator', + Deprecation::SCOPE_CLASS + ); $this->validators = array_values($validators ?? []); - parent::__construct(); } diff --git a/src/Forms/FieldsValidator.php b/src/Forms/FieldsValidator.php index 504cf6157f8..5a70dd76f7e 100644 --- a/src/Forms/FieldsValidator.php +++ b/src/Forms/FieldsValidator.php @@ -2,11 +2,25 @@ namespace SilverStripe\Forms; +use SilverStripe\Dev\Deprecation; + /** * Validates the internal state of all fields in the form. + * + * @deprecated 5.4.0 Will be replaced with functionality inside SilverStripe\Forms\Form::validate() */ class FieldsValidator extends Validator { + public function __construct() + { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be replaced with functionality inside SilverStripe\Forms\Form::validate()', + Deprecation::SCOPE_CLASS + ); + parent::__construct(); + } + public function php($data): bool { $fields = $this->form->Fields(); diff --git a/src/Forms/RequiredFields.php b/src/Forms/RequiredFields.php index d83e7dbf3c5..0ec173f5c1e 100644 --- a/src/Forms/RequiredFields.php +++ b/src/Forms/RequiredFields.php @@ -3,6 +3,7 @@ namespace SilverStripe\Forms; use SilverStripe\Core\ArrayLib; +use SilverStripe\Dev\Deprecation; /** * Required Fields allows you to set which fields need to be present before @@ -11,6 +12,8 @@ * * Validation is performed on a field by field basis through * {@link FormField::validate}. + * + * @deprecated 5.4.0 Will be renamed to SilverStripe\Forms\Validation\RequiredFieldsValidator */ class RequiredFields extends Validator { @@ -39,6 +42,11 @@ class RequiredFields extends Validator */ public function __construct() { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be renamed to SilverStripe\\Forms\\Validation\\RequiredFieldsValidator', + Deprecation::SCOPE_CLASS + ); $required = func_get_args(); if (isset($required[0]) && is_array($required[0])) { $required = $required[0]; diff --git a/src/Forms/Validator.php b/src/Forms/Validator.php index 786931ea87c..4a88c447412 100644 --- a/src/Forms/Validator.php +++ b/src/Forms/Validator.php @@ -6,11 +6,14 @@ use SilverStripe\Core\Extensible; use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Validation\ValidationResult; +use SilverStripe\Dev\Deprecation; /** * This validation class handles all form and custom form validation through the use of Required * fields. It relies on javascript for client-side validation, and marking fields after server-side * validation. It acts as a visitor to individual form fields. + * + * @deprecated 5.4.0 Will be renamed to SilverStripe\Forms\Validation\Validator */ abstract class Validator { @@ -20,6 +23,11 @@ abstract class Validator public function __construct() { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be renamed to SilverStripe\\Forms\\Validation\\Validator', + Deprecation::SCOPE_CLASS + ); $this->resetResult(); }