function Loader::toAbsolutePath
@psalm-return non-empty-string
8 calls to Loader::toAbsolutePath()
- Loader::codeCoverage in vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Loader.php - Loader::logging in vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Loader.php - Loader::php in vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Loader.php - Loader::phpunit in vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Loader.php - Loader::readFilterDirectories in vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Loader.php
File
-
vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Loader.php, line 220
Class
- Loader
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\TextUI\XmlConfigurationCode
private function toAbsolutePath(string $filename, string $path) : string {
$path = trim($path);
if (str_starts_with($path, '/')) {
return $path;
}
// Matches the following on Windows:
// - \\NetworkComputer\Path
// - \\.\D:
// - \\.\c:
// - C:\Windows
// - C:\windows
// - C:/windows
// - c:/windows
if (defined('PHP_WINDOWS_VERSION_BUILD') && !empty($path) && ($path[0] === '\\' || strlen($path) >= 3 && preg_match('#^[A-Z]:[/\\\\]#i', substr($path, 0, 3)))) {
return $path;
}
if (str_contains($path, '://')) {
return $path;
}
return dirname($filename) . DIRECTORY_SEPARATOR . $path;
}