class SchemaFinder
@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\SchemaFinder
Expanded class hierarchy of SchemaFinder
File
-
vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ SchemaFinder.php, line 25
Namespace
PHPUnit\TextUI\XmlConfigurationView source
final class SchemaFinder {
/**
* @psalm-return non-empty-list<non-empty-string>
*/
public function available() : array {
$result = [
Version::series(),
];
foreach (new DirectoryIterator($this->path() . 'schema') as $file) {
if ($file->isDot()) {
continue;
}
$version = $file->getBasename('.xsd');
assert(!empty($version));
$result[] = $version;
}
rsort($result);
return $result;
}
/**
* @throws CannotFindSchemaException
*/
public function find(string $version) : string {
if ($version === Version::series()) {
$filename = $this->path() . 'phpunit.xsd';
}
else {
$filename = $this->path() . 'schema/' . $version . '.xsd';
}
if (!is_file($filename)) {
throw new CannotFindSchemaException(sprintf('Schema for PHPUnit %s is not available', $version));
}
return $filename;
}
private function path() : string {
if (defined('__PHPUNIT_PHAR_ROOT__')) {
return __PHPUNIT_PHAR_ROOT__ . '/';
}
return __DIR__ . '/../../../../';
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
SchemaFinder::available | public | function | @psalm-return non-empty-list<non-empty-string> |
SchemaFinder::find | public | function | |
SchemaFinder::path | private | function |