File tree 4 files changed +10
-9
lines changed
4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -51,8 +51,9 @@ protected function getSchemaFile(): string
51
51
if (false === \is_string ($ schemaFile )) {
52
52
throw new Exceptions \FailedLoadingSchemaException ("Schema file unknown for specVersion: $ specVersion ->name " );
53
53
}
54
- if (is_file ($ schemaFile ) && is_readable ($ schemaFile )) {
55
- return realpath ($ schemaFile );
54
+ $ schemaPath = realpath ($ schemaFile );
55
+ if (\is_string ($ schemaPath ) && is_file ($ schemaPath ) && is_readable ($ schemaPath )) {
56
+ return $ schemaPath ;
56
57
}
57
58
// @codeCoverageIgnoreStart
58
59
throw new Exceptions \FailedLoadingSchemaException ("Schema file not readable: $ schemaFile " );
Original file line number Diff line number Diff line change @@ -37,12 +37,12 @@ class JsonValidationError extends ValidationError
37
37
public static function fromSchemaValidationError (JsonSchema \Errors \ValidationError $ error ): static
38
38
{
39
39
$ formatter = new JsonSchema \Errors \ErrorFormatter ();
40
- $ instance = new static (
41
- json_encode (
42
- $ formatter ->format ($ error , true ),
43
- \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES
44
- )
40
+ $ message = json_encode (
41
+ $ formatter ->format ($ error , true ),
42
+ \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES
45
43
);
44
+ \assert (\is_string ($ message ));
45
+ $ instance = new static ($ message );
46
46
$ instance ->error = $ error ;
47
47
48
48
return $ instance ;
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ private function validateDomWithSchema(DOMDocument $doc): ?LibXMLError
88
88
libxml_clear_errors ();
89
89
90
90
$ valid = $ doc ->schemaValidate ($ schema );
91
- $ error = $ valid ? null : libxml_get_last_error ();
91
+ $ error = $ valid ? null : ( libxml_get_last_error () ?: null );
92
92
93
93
libxml_clear_errors ();
94
94
libxml_use_internal_errors ($ prevXmlUIE );
Original file line number Diff line number Diff line change 7
7
},
8
8
"require-dev" : {
9
9
"roave/security-advisories" : " dev-latest" ,
10
- "vimeo/psalm" : " 5.26.1 "
10
+ "vimeo/psalm" : " ^6.0.0 "
11
11
},
12
12
"prefer-stable" : true ,
13
13
"config" : {
You can’t perform that action at this time.
0 commit comments