Skip to content

Commit fafdbcd

Browse files
committed
Merge pull request #170 from localheinz/fix/capital
Fix: Start all messages with a capital letter
2 parents fded2a8 + 1e9f9b2 commit fafdbcd

File tree

5 files changed

+24
-24
lines changed

5 files changed

+24
-24
lines changed

src/JsonSchema/Constraints/EnumConstraint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ public function check($element, $schema = null, $path = null, $i = null)
4141
}
4242
}
4343

44-
$this->addError($path, "does not have a value in the enumeration " . print_r($schema->enum, true));
44+
$this->addError($path, "Does not have a value in the enumeration " . print_r($schema->enum, true));
4545
}
4646
}

src/JsonSchema/Constraints/NumberConstraint.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,40 +26,40 @@ public function check($element, $schema = null, $path = null, $i = null)
2626
if (isset($schema->exclusiveMinimum)) {
2727
if (isset($schema->minimum)) {
2828
if ($schema->exclusiveMinimum && $element === $schema->minimum) {
29-
$this->addError($path, "must have a minimum value greater than boundary value of " . $schema->minimum);
29+
$this->addError($path, "Must have a minimum value greater than boundary value of " . $schema->minimum);
3030
} else if ($element < $schema->minimum) {
31-
$this->addError($path, "must have a minimum value of " . $schema->minimum);
31+
$this->addError($path, "Must have a minimum value of " . $schema->minimum);
3232
}
3333
} else {
34-
$this->addError($path, "use of exclusiveMinimum requires presence of minimum");
34+
$this->addError($path, "Use of exclusiveMinimum requires presence of minimum");
3535
}
3636
} else if (isset($schema->minimum) && $element < $schema->minimum) {
37-
$this->addError($path, "must have a minimum value of " . $schema->minimum);
37+
$this->addError($path, "Must have a minimum value of " . $schema->minimum);
3838
}
3939

4040
// Verify maximum
4141
if (isset($schema->exclusiveMaximum)) {
4242
if (isset($schema->maximum)) {
4343
if ($schema->exclusiveMaximum && $element === $schema->maximum) {
44-
$this->addError($path, "must have a maximum value less than boundary value of " . $schema->maximum);
44+
$this->addError($path, "Must have a maximum value less than boundary value of " . $schema->maximum);
4545
} else if ($element > $schema->maximum) {
46-
$this->addError($path, "must have a maximum value of " . $schema->maximum);
46+
$this->addError($path, "Must have a maximum value of " . $schema->maximum);
4747
}
4848
} else {
49-
$this->addError($path, "use of exclusiveMaximum requires presence of maximum");
49+
$this->addError($path, "Use of exclusiveMaximum requires presence of maximum");
5050
}
5151
} else if (isset($schema->maximum) && $element > $schema->maximum) {
52-
$this->addError($path, "must have a maximum value of " . $schema->maximum);
52+
$this->addError($path, "Must have a maximum value of " . $schema->maximum);
5353
}
5454

5555
// Verify divisibleBy - Draft v3
5656
if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
57-
$this->addError($path, "is not divisible by " . $schema->divisibleBy);
57+
$this->addError($path, "Is not divisible by " . $schema->divisibleBy);
5858
}
5959

6060
// Verify multipleOf - Draft v4
6161
if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
62-
$this->addError($path, "must be a multiple of " . $schema->multipleOf);
62+
$this->addError($path, "Must be a multiple of " . $schema->multipleOf);
6363
}
6464

6565
$this->checkFormat($element, $schema, $path, $i);

src/JsonSchema/Constraints/ObjectConstraint.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function validateElement($element, $matches, $objectDefinition = null, $p
9292
// property requires presence of another
9393
$require = $this->getProperty($definition, 'requires');
9494
if ($require && !$this->getProperty($element, $require)) {
95-
$this->addError($path, "the presence of the property " . $i . " requires that " . $require . " also be present");
95+
$this->addError($path, "The presence of the property " . $i . " requires that " . $require . " also be present");
9696
}
9797

9898
if (!$definition) {
@@ -137,4 +137,4 @@ protected function getProperty($element, $property, $fallback = null)
137137

138138
return $fallback;
139139
}
140-
}
140+
}

src/JsonSchema/Constraints/StringConstraint.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ public function check($element, $schema = null, $path = null, $i = null)
2424
{
2525
// Verify maxLength
2626
if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
27-
$this->addError($path, "must be at most " . $schema->maxLength . " characters long");
27+
$this->addError($path, "Must be at most " . $schema->maxLength . " characters long");
2828
}
2929

3030
//verify minLength
3131
if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
32-
$this->addError($path, "must be at least " . $schema->minLength . " characters long");
32+
$this->addError($path, "Must be at least " . $schema->minLength . " characters long");
3333
}
3434

3535
// Verify a regex pattern
3636
if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#', $element)) {
37-
$this->addError($path, "does not match the regex pattern " . $schema->pattern);
37+
$this->addError($path, "Does not match the regex pattern " . $schema->pattern);
3838
}
3939

4040
$this->checkFormat($element, $schema, $path, $i);

src/JsonSchema/Constraints/UndefinedConstraint.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ protected function validateCommonProperties($value, $schema = null, $path = null
122122
// Draft 4 - Required is an array of strings - e.g. "required": ["foo", ...]
123123
foreach ($schema->required as $required) {
124124
if (!property_exists($value, $required)) {
125-
$this->addError($required, "the property " . $required . " is required");
125+
$this->addError($required, "The property " . $required . " is required");
126126
}
127127
}
128128
} else if (isset($schema->required) && !is_array($schema->required)) {
129129
// Draft 3 - Required attribute - e.g. "foo": {"type": "string", "required": true}
130130
if ( $schema->required && $value instanceof UndefinedConstraint) {
131-
$this->addError($path, "is missing and it is required");
131+
$this->addError($path, "Is missing and it is required");
132132
}
133133
}
134134
}
@@ -148,7 +148,7 @@ protected function validateCommonProperties($value, $schema = null, $path = null
148148

149149
// if no new errors were raised it must be a disallowed value
150150
if (count($this->getErrors()) == count($initErrors)) {
151-
$this->addError($path, "disallowed value was matched");
151+
$this->addError($path, "Disallowed value was matched");
152152
} else {
153153
$this->errors = $initErrors;
154154
}
@@ -160,7 +160,7 @@ protected function validateCommonProperties($value, $schema = null, $path = null
160160

161161
// if no new errors were raised then the instance validated against the "not" schema
162162
if (count($this->getErrors()) == count($initErrors)) {
163-
$this->addError($path, "matched a schema which it should not");
163+
$this->addError($path, "Matched a schema which it should not");
164164
} else {
165165
$this->errors = $initErrors;
166166
}
@@ -170,12 +170,12 @@ protected function validateCommonProperties($value, $schema = null, $path = null
170170
if (is_object($value)) {
171171
if (isset($schema->minProperties)) {
172172
if (count(get_object_vars($value)) < $schema->minProperties) {
173-
$this->addError($path, "must contain a minimum of " . $schema->minProperties . " properties");
173+
$this->addError($path, "Must contain a minimum of " . $schema->minProperties . " properties");
174174
}
175175
}
176176
if (isset($schema->maxProperties)) {
177177
if (count(get_object_vars($value)) > $schema->maxProperties) {
178-
$this->addError($path, "must contain no more than " . $schema->maxProperties . " properties");
178+
$this->addError($path, "Must contain no more than " . $schema->maxProperties . " properties");
179179
}
180180
}
181181
}
@@ -209,7 +209,7 @@ protected function validateOfProperties($value, $schema, $path, $i = "")
209209
$isValid = $isValid && (count($this->getErrors()) == count($initErrors));
210210
}
211211
if (!$isValid) {
212-
$this->addError($path, "failed to match all schemas");
212+
$this->addError($path, "Failed to match all schemas");
213213
}
214214
}
215215

@@ -224,7 +224,7 @@ protected function validateOfProperties($value, $schema, $path, $i = "")
224224
}
225225
}
226226
if (!$isValid) {
227-
$this->addError($path, "failed to match at least one schema");
227+
$this->addError($path, "Failed to match at least one schema");
228228
} else {
229229
$this->errors = $startErrors;
230230
}

0 commit comments

Comments
 (0)