Skip to content

Commit cdf0ba8

Browse files
committed
Merge branch '3.2' into 3.3
* 3.2: Misspelled word Display a better error design when the toolbar cannot be displayed do not validate empty values [Cache] fix cleanup of expired items for PdoAdapter [Console] fix description of INF default values [PropertyAccess] Fix TypeError discard [Validator] Throw exception on Comparison constraints null options Identify tty tests in Component/Process [Workflow] Added more events to the announce function [Validator] Remove property path suggestion for using the Expression validator [WebProfilerBundle] Fix css trick used for offsetting html anchor from fixed header [Security] Fix annotation
2 parents d693f16 + 7a1ff34 commit cdf0ba8

13 files changed

+29
-19
lines changed

Constraints/AbstractComparison.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ abstract class AbstractComparison extends Constraint
3030
*/
3131
public function __construct($options = null)
3232
{
33+
if (null === $options) {
34+
$options = array();
35+
}
36+
3337
if (is_array($options) && !isset($options['value'])) {
3438
throw new ConstraintDefinitionException(sprintf(
3539
'The %s constraint requires the "value" option to be set.',

Constraints/UrlValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function validate($value, Constraint $constraint)
4747
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Url');
4848
}
4949

50-
if (null === $value) {
50+
if (null === $value || '' === $value) {
5151
return;
5252
}
5353

Resources/translations/validators.fr.xlf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@
7676
</trans-unit>
7777
<trans-unit id="19">
7878
<source>This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.</source>
79-
<target>Cette chaine est trop longue. Elle doit avoir au maximum {{ limit }} caractère.|Cette chaine est trop longue. Elle doit avoir au maximum {{ limit }} caractères.</target>
79+
<target>Cette chaîne est trop longue. Elle doit avoir au maximum {{ limit }} caractère.|Cette chaîne est trop longue. Elle doit avoir au maximum {{ limit }} caractères.</target>
8080
</trans-unit>
8181
<trans-unit id="20">
8282
<source>This value should be {{ limit }} or more.</source>
8383
<target>Cette valeur doit être supérieure ou égale à {{ limit }}.</target>
8484
</trans-unit>
8585
<trans-unit id="21">
8686
<source>This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.</source>
87-
<target>Cette chaine est trop courte. Elle doit avoir au minimum {{ limit }} caractère.|Cette chaine est trop courte. Elle doit avoir au minimum {{ limit }} caractères.</target>
87+
<target>Cette chaîne est trop courte. Elle doit avoir au minimum {{ limit }} caractère.|Cette chaîne est trop courte. Elle doit avoir au minimum {{ limit }} caractères.</target>
8888
</trans-unit>
8989
<trans-unit id="22">
9090
<source>This value should not be blank.</source>
@@ -180,7 +180,7 @@
180180
</trans-unit>
181181
<trans-unit id="48">
182182
<source>This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.</source>
183-
<target>Cette chaine doit avoir exactement {{ limit }} caractère.|Cette chaine doit avoir exactement {{ limit }} caractères.</target>
183+
<target>Cette chaîne doit avoir exactement {{ limit }} caractère.|Cette chaîne doit avoir exactement {{ limit }} caractères.</target>
184184
</trans-unit>
185185
<trans-unit id="49">
186186
<source>The file was only partially uploaded.</source>

Tests/Constraints/AbstractComparisonValidatorTestCase.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,21 @@ protected static function addPhp5Dot5Comparisons(array $comparisons)
6565
return $result;
6666
}
6767

68+
public function provideInvalidConstraintOptions()
69+
{
70+
return array(
71+
array(null),
72+
array(array()),
73+
);
74+
}
75+
6876
/**
77+
* @dataProvider provideInvalidConstraintOptions
6978
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
7079
*/
71-
public function testThrowsConstraintExceptionIfNoValueOrProperty()
80+
public function testThrowsConstraintExceptionIfNoValueOrProperty($options)
7281
{
73-
$comparison = $this->createConstraint(array());
74-
75-
$this->validator->validate('some value', $comparison);
82+
$this->createConstraint($options);
7683
}
7784

7885
/**
@@ -163,11 +170,11 @@ public function provideAllInvalidComparisons()
163170
abstract public function provideInvalidComparisons();
164171

165172
/**
166-
* @param array $options Options for the constraint
173+
* @param array|null $options Options for the constraint
167174
*
168175
* @return Constraint
169176
*/
170-
abstract protected function createConstraint(array $options);
177+
abstract protected function createConstraint(array $options = null);
171178

172179
/**
173180
* @return string|null

Tests/Constraints/EqualToValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function createValidator()
2424
return new EqualToValidator();
2525
}
2626

27-
protected function createConstraint(array $options)
27+
protected function createConstraint(array $options = null)
2828
{
2929
return new EqualTo($options);
3030
}

Tests/Constraints/GreaterThanOrEqualValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function createValidator()
2424
return new GreaterThanOrEqualValidator();
2525
}
2626

27-
protected function createConstraint(array $options)
27+
protected function createConstraint(array $options = null)
2828
{
2929
return new GreaterThanOrEqual($options);
3030
}

Tests/Constraints/GreaterThanValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function createValidator()
2424
return new GreaterThanValidator();
2525
}
2626

27-
protected function createConstraint(array $options)
27+
protected function createConstraint(array $options = null)
2828
{
2929
return new GreaterThan($options);
3030
}

Tests/Constraints/IdenticalToValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function createValidator()
2424
return new IdenticalToValidator();
2525
}
2626

27-
protected function createConstraint(array $options)
27+
protected function createConstraint(array $options = null)
2828
{
2929
return new IdenticalTo($options);
3030
}

Tests/Constraints/LessThanOrEqualValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function createValidator()
2424
return new LessThanOrEqualValidator();
2525
}
2626

27-
protected function createConstraint(array $options)
27+
protected function createConstraint(array $options = null)
2828
{
2929
return new LessThanOrEqual($options);
3030
}

Tests/Constraints/LessThanValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function createValidator()
2424
return new LessThanValidator();
2525
}
2626

27-
protected function createConstraint(array $options)
27+
protected function createConstraint(array $options = null)
2828
{
2929
return new LessThan($options);
3030
}

Tests/Constraints/NotEqualToValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function createValidator()
2424
return new NotEqualToValidator();
2525
}
2626

27-
protected function createConstraint(array $options)
27+
protected function createConstraint(array $options = null)
2828
{
2929
return new NotEqualTo($options);
3030
}

Tests/Constraints/NotIdenticalToValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function createValidator()
2424
return new NotIdenticalToValidator();
2525
}
2626

27-
protected function createConstraint(array $options)
27+
protected function createConstraint(array $options = null)
2828
{
2929
return new NotIdenticalTo($options);
3030
}

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"symfony/yaml": "",
4747
"symfony/config": "",
4848
"egulias/email-validator": "Strict (RFC compliant) email validation",
49-
"symfony/property-access": "For using the Expression validator",
5049
"symfony/expression-language": "For using the Expression validator"
5150
},
5251
"autoload": {

0 commit comments

Comments
 (0)