Skip to content

Commit 682ca1a

Browse files
committed
Apply NotBlank only to the whole array
1 parent 558b149 commit 682ca1a

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Controller/Annotations/AbstractScalarParam.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ public function getConstraints()
5656
));
5757
}
5858

59-
if (false === $this->allowBlank) {
60-
$constraints[] = new NotBlank();
61-
}
62-
6359
// If the user wants to map the value, apply all constraints to every
6460
// value of the map
6561
if ($this->map) {
@@ -69,9 +65,10 @@ public function getConstraints()
6965
if (false === $this->nullable) {
7066
$constraints[] = new NotNull();
7167
}
72-
if (false === $this->allowBlank) {
73-
$constraints[] = new NotBlank();
74-
}
68+
}
69+
70+
if (false === $this->allowBlank) {
71+
$constraints[] = new NotBlank();
7572
}
7673

7774
return $constraints;

Tests/Controller/Annotations/AbstractScalarParamTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ public function testArrayWithBlankConstraintsWhenParamIsAnArray()
106106
$this->param->allowBlank = false;
107107
$this->assertEquals(array(new Constraints\All(array(
108108
new Constraints\NotNull(),
109-
new Constraints\NotBlank(),
110109
)), new Constraints\NotNull(), new Constraints\NotBlank()), $this->param->getConstraints());
111110
}
112111

0 commit comments

Comments
 (0)