class SchemaDetector
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
@internal This class is not covered by the backward compatibility promise for PHPUnit
Hierarchy
- class \PHPUnit\TextUI\XmlConfiguration\SchemaDetector
Expanded class hierarchy of SchemaDetector
1 file declares its use of SchemaDetector
- Merger.php in vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Merger.php
File
-
vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ SchemaDetector/ SchemaDetector.php, line 20
Namespace
PHPUnit\TextUI\XmlConfigurationView source
final class SchemaDetector {
/**
* @throws XmlException
*/
public function detect(string $filename) : SchemaDetectionResult {
$document = (new Loader())->loadFile($filename);
$schemaFinder = new SchemaFinder();
foreach ($schemaFinder->available() as $candidate) {
$schema = (new SchemaFinder())->find($candidate);
if (!(new Validator())->validate($document, $schema)
->hasValidationErrors()) {
return new SuccessfulSchemaDetectionResult($candidate);
}
}
return new FailedSchemaDetectionResult();
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
SchemaDetector::detect | public | function |