It seems like $schema can also be of type false; however, parameter $source of DOMDocument::schemaValidateSource() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
26
if (!$xmlDocument->schemaValidateSource(/** @scrutinizer ignore-type */ $schema)) {
Loading history...
27
$errors = libxml_get_errors();
28
29
foreach ($errors as $error) {
30
throw new \Exception(static::displayError($error));
31
}
32
libxml_clear_errors();
33
throw new \Exception('INVALID XML');
34
}
35
}
36
37
/**
38
* @param $error
39
*
40
* @return string
41
*/
42
public static function displayError($error): string