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 ad2d3fc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Forms/FieldsValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@

namespace SilverStripe\Forms;

use SilverStripe\Dev\Deprecation;

/**
* Validates the internal state of all fields in the form.
*/
class FieldsValidator extends Validator
{
/**
* @deprecated 5.4.0 Will be renamed to SilverStripe\Forms\FormFieldsValidator
*/
public function __construct()
{
Deprecation::noticeWithNoReplacment('5.4.0', 'Will be renamed to SilverStripe\\Forms\\FormFieldsValidator', 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 @@ -25,9 +26,12 @@ class RequiredFields extends Validator
/**
* Pass each field to be validated as a separate argument to the constructor
* of this object. (an array of elements are ok).
*
* @deprecated 5.4.0 Will be renamed to SilverStripe\Forms\RequiredFieldsValidator
*/
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 ad2d3fc

Please sign in to comment.