mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Allow backslash after drive name (#1917)
* Allow backslash after drive name
Before, paths like `C:/path/to/something` were considered absolute, but
`C:\path/to/something` were not
Refs vimeo/psalm#1913
* Revert "Mark testPluginFilenameCanBeAbsolute incomplete on Windows (#1914)"
This reverts commit 210ac39d00
.
This commit is contained in:
parent
0dfbf483cb
commit
6a74cf96a1
@ -16,7 +16,7 @@ function isAbsolutePath($path)
|
||||
$regex = '%^(?<wrappers>(?:[[:print:]]{2,}://)*)';
|
||||
|
||||
// Optional root prefix.
|
||||
$regex .= '(?<root>(?:[[:alpha:]]:/|/)?)';
|
||||
$regex .= '(?<root>(?:[[:alpha:]]:[\\\/]|[\\\/])?)';
|
||||
|
||||
// Actual path.
|
||||
$regex .= '(?<path>(?:[[:print:]]*))$%';
|
||||
|
@ -4,7 +4,6 @@ namespace Psalm\Tests\Config;
|
||||
use function define;
|
||||
use function defined;
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
use const PHP_OS;
|
||||
use function dirname;
|
||||
use function get_class;
|
||||
use function getcwd;
|
||||
@ -18,7 +17,6 @@ use Psalm\PluginRegistrationSocket;
|
||||
use Psalm\Tests\Internal\Provider;
|
||||
use Psalm\Tests\TestConfig;
|
||||
use function sprintf;
|
||||
use function stripos;
|
||||
|
||||
class PluginTest extends \Psalm\Tests\TestCase
|
||||
{
|
||||
@ -821,10 +819,6 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
*/
|
||||
public function testPluginFilenameCanBeAbsolute()
|
||||
{
|
||||
if ($this->runningOnWindows()) {
|
||||
$this->markTestIncomplete('Test fails on Windows - see https://github.com/vimeo/psalm/issues/1913');
|
||||
}
|
||||
|
||||
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
|
||||
TestConfig::loadFromXML(
|
||||
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR,
|
||||
@ -871,9 +865,4 @@ class PluginTest extends \Psalm\Tests\TestCase
|
||||
|
||||
$this->project_analyzer->getCodebase()->config->initializePlugins($this->project_analyzer);
|
||||
}
|
||||
|
||||
private function runningOnWindows(): bool
|
||||
{
|
||||
return stripos(PHP_OS, 'WIN') === 0;
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,10 @@ class IsAbsolutePathTest extends TestCase
|
||||
['relative/path/to/something', false],
|
||||
['relative/path/to/something/file.php', false],
|
||||
['c:/path/to/something', true],
|
||||
['C:\path\to\something', true],
|
||||
['C:\path/to\something', true],
|
||||
['\path\to\something', true],
|
||||
['C:\path/to\..\..\something', true],
|
||||
['file://c:/path/to/something', true],
|
||||
['zlib://c:/path/to/something', true],
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user