Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b04345d

Browse filesBrowse files
committed
Fix exception messages and tests
1 parent 39439ff commit b04345d
Copy full SHA for b04345d

File tree

2 files changed

+8
-8
lines changed
Filter options

2 files changed

+8
-8
lines changed

‎src/Symfony/Component/Validator/Constraint.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraint.php
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function __construct($options = null)
115115

116116
if (\is_array($options) && isset($options['value']) && !property_exists($this, 'value')) {
117117
if (null === $defaultOption) {
118-
throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint %s', \get_class($this)));
118+
throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', \get_class($this)));
119119
}
120120

121121
$options[$defaultOption] = $options['value'];
@@ -136,7 +136,7 @@ public function __construct($options = null)
136136
}
137137
} elseif (null !== $options && !(\is_array($options) && 0 === \count($options))) {
138138
if (null === $defaultOption) {
139-
throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint %s', \get_class($this)));
139+
throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', \get_class($this)));
140140
}
141141

142142
if (\array_key_exists($defaultOption, $knownOptions)) {
@@ -148,11 +148,11 @@ public function __construct($options = null)
148148
}
149149

150150
if (\count($invalidOptions) > 0) {
151-
throw new InvalidOptionsException(sprintf('The options "%s" do not exist in constraint %s', implode('", "', $invalidOptions), \get_class($this)), $invalidOptions);
151+
throw new InvalidOptionsException(sprintf('The options "%s" do not exist in constraint "%s".', implode('", "', $invalidOptions), \get_class($this)), $invalidOptions);
152152
}
153153

154154
if (\count($missingOptions) > 0) {
155-
throw new MissingOptionsException(sprintf('The options "%s" must be set for constraint %s', implode('", "', array_keys($missingOptions)), \get_class($this)), array_keys($missingOptions));
155+
throw new MissingOptionsException(sprintf('The options "%s" must be set for constraint "%s".', implode('", "', array_keys($missingOptions)), \get_class($this)), array_keys($missingOptions));
156156
}
157157
}
158158

@@ -176,7 +176,7 @@ public function __set($option, $value)
176176
return;
177177
}
178178

179-
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, \get_class($this)), [$option]);
179+
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, \get_class($this)), [$option]);
180180
}
181181

182182
/**
@@ -202,7 +202,7 @@ public function __get($option)
202202
return $this->groups;
203203
}
204204

205-
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, \get_class($this)), [$option]);
205+
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, \get_class($this)), [$option]);
206206
}
207207

208208
/**

‎src/Symfony/Component/Validator/Tests/ConstraintTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/ConstraintTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public function testOptionsAsDefaultOption()
225225

226226
/**
227227
* @expectedException \Symfony\Component\Validator\Exception\InvalidOptionsException
228-
* @expectedExceptionMessage The options "0", "5" do not exist
228+
* @expectedExceptionMessage The options "0", "5" do not exist in constraint "Symfony\Component\Validator\Tests\Fixtures\ConstraintA".
229229
*/
230230
public function testInvalidOptions()
231231
{
@@ -245,7 +245,7 @@ public function testOptionsWithInvalidInternalPointer()
245245

246246
/**
247247
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
248-
* @expectedExceptionMessage No default option is configured for constraint Symfony\Component\Validator\Tests\Fixtures\ConstraintB
248+
* @expectedExceptionMessage No default option is configured for constraint "Symfony\Component\Validator\Tests\Fixtures\ConstraintB".
249249
*/
250250
public function testAnnotationSetUndefinedDefaultOption()
251251
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.