Skip to content

Commit

Permalink
API Deprecate renamed validators
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Dec 3, 2024
1 parent 4d78f78 commit b37542b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Forms/FieldsValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@

namespace SilverStripe\Forms;

use SilverStripe\Dev\Deprecation;

/**
* Validates the internal state of all fields in the form.
*
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it
*/
class FieldsValidator extends Validator
{
public function __construct()
{
Deprecation::noticeWithNoReplacment('5.4.0', scope: Deprecation::SCOPE_CLASS);
parent::__construct();
}

public function php($data): bool
{
$valid = true;
Expand Down
4 changes: 4 additions & 0 deletions src/Forms/RequiredFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace SilverStripe\Forms;

use SilverStripe\ORM\ArrayLib;
use SilverStripe\Dev\Deprecation;

/**
* Required Fields allows you to set which fields need to be present before
Expand All @@ -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\RequiredFieldsValidator
*/
class RequiredFields extends Validator
{
Expand All @@ -28,6 +31,7 @@ class RequiredFields extends Validator
*/
public function __construct()
{
Deprecation::noticeWithNoReplacment('5.4.0', 'Will be renamed to SilverStripe\\Forms\\RequiredFieldsValidator', Deprecation::SCOPE_CLASS);
$required = func_get_args();
if (isset($required[0]) && is_array($required[0])) {
$required = $required[0];
Expand Down

0 comments on commit b37542b

Please sign in to comment.