mirror of
https://github.com/Respect/Validation.git
synced 2024-06-04 06:42:22 +02:00
Upgrade "symfony/validator" version
This commit is contained in:
parent
867f12b8d3
commit
07a120d058
|
@ -21,7 +21,7 @@
|
|||
"malukenho/docheader": "^0.1.4",
|
||||
"mikey179/vfsStream": "^1.6",
|
||||
"phpunit/phpunit": "^5.6",
|
||||
"symfony/validator": "~2.6.9",
|
||||
"symfony/validator": "^3.0",
|
||||
"zendframework/zend-validator": "^2.0"
|
||||
},
|
||||
"suggest": {
|
||||
|
|
|
@ -9,9 +9,7 @@ are preserved.
|
|||
v::sf('Time')->validate('15:00:00');
|
||||
```
|
||||
|
||||
|
||||
You must add `"symfony/validator": "~2.6"` to your `require` property on composer.json file.
|
||||
|
||||
Respect\Validation supports version >=3.0.0 of Symfony Validator.
|
||||
|
||||
***
|
||||
See also:
|
||||
|
|
|
@ -23,13 +23,13 @@ class Sf extends AbstractRule
|
|||
public $name;
|
||||
private $constraint;
|
||||
|
||||
public function __construct($name, $params = [])
|
||||
public function __construct($name, array $params = [])
|
||||
{
|
||||
$this->name = ucfirst($name);
|
||||
$this->constraint = $this->createSymfonyConstraint($this->name, $params);
|
||||
}
|
||||
|
||||
private function createSymfonyConstraint($constraintName, $constraintConstructorParameters = [])
|
||||
private function createSymfonyConstraint($constraintName, array $constraintConstructorParameters = [])
|
||||
{
|
||||
$fullClassName = sprintf(self::SYMFONY_CONSTRAINT_NAMESPACE, $constraintName);
|
||||
try {
|
||||
|
@ -50,7 +50,7 @@ class Sf extends AbstractRule
|
|||
{
|
||||
$validator = Validation::createValidator(); // You gotta love those Symfony namings
|
||||
|
||||
return $validator->validateValue($valueToValidate, $symfonyConstraint);
|
||||
return $validator->validate($valueToValidate, $symfonyConstraint);
|
||||
}
|
||||
|
||||
public function assert($input)
|
||||
|
|
Loading…
Reference in a new issue