Skip to content

Commit 884497a

Browse files
committed
Change default from null to Validator::ERROR_ALL
No functional changes, this is just a better hint to the user for what the default case actually is.
1 parent d026cc0 commit 884497a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/JsonSchema/Constraints/BaseConstraint.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ public function addErrors(array $errors)
7777
}
7878
}
7979

80-
public function getErrors($errorContext = null)
80+
public function getErrors($errorContext = Validator::ERROR_ALL)
8181
{
82-
if ($errorContext === null) {
82+
if ($errorContext === Validator::ERROR_ALL) {
8383
return $this->errors;
8484
}
8585

@@ -90,9 +90,9 @@ public function getErrors($errorContext = null)
9090
});
9191
}
9292

93-
public function numErrors($errorContext = null)
93+
public function numErrors($errorContext = Validator::ERROR_ALL)
9494
{
95-
if ($errorContext === null) {
95+
if ($errorContext === Validator::ERROR_ALL) {
9696
return count($this->errors);
9797
}
9898

src/JsonSchema/Validator.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class Validator extends BaseConstraint
2626
const SCHEMA_MEDIA_TYPE = 'application/schema+json';
2727

2828
const ERROR_NONE = 0x00000000;
29+
const ERROR_ALL = ~self::ERROR_NONE;
2930
const ERROR_DOCUMENT_VALIDATION = 0x00000001;
3031
const ERROR_SCHEMA_VALIDATION = 0x00000002;
3132

0 commit comments

Comments
 (0)