Skip to content
Permalink
Browse files

Deprecated Psalm\isAbsolutPath in favor of Webmozart\PathUtil\Path::i…

…sAbsolute (#1921)
  • Loading branch information...
weirdan authored and muglug committed Jul 8, 2019
1 parent 6a74cf9 commit 173a40e76939a20b935b23148b4e248dc708adcd
Showing with 6 additions and 62 deletions.
  1. +2 −1 src/Psalm/Config.php
  2. +4 −21 src/functions.php
  3. +0 −40 tests/IsAbsolutePathTest.php
@@ -1,6 +1,7 @@
<?php
namespace Psalm;
use Webmozart\PathUtil\Path;
use function array_merge;
use function array_pop;
use function array_unique;
@@ -832,7 +833,7 @@ private static function fromXmlAndPaths(string $base_dir, string $file_contents,
foreach ($config_xml->plugins->plugin as $plugin) {
$plugin_file_name = (string) $plugin['filename'];
$path = isAbsolutePath($plugin_file_name)
$path = Path::isAbsolute($plugin_file_name)
? $plugin_file_name
: $config->base_dir . $plugin_file_name;
@@ -2,34 +2,17 @@
namespace Psalm;
use InvalidArgumentException;
use Webmozart\PathUtil\Path;
use function preg_match;
use function sprintf;
/**
* @param string $path
*
* @return bool
*
* @deprecated Use {@see Webmozart\PathUtil\Path::isAbsolute} instead
*/
function isAbsolutePath($path)
{
// Optional wrapper(s).
$regex = '%^(?<wrappers>(?:[[:print:]]{2,}://)*)';
// Optional root prefix.
$regex .= '(?<root>(?:[[:alpha:]]:[\\\/]|[\\\/])?)';
// Actual path.
$regex .= '(?<path>(?:[[:print:]]*))$%';
$parts = [];
if (!preg_match($regex, $path, $parts)) {
throw new InvalidArgumentException(sprintf('Path is not valid, "%s" given.', $path));
}
if ('' !== $parts['root']) {
return true;
}
return false;
return Path::isAbsolute($path);
}

This file was deleted.

0 comments on commit 173a40e

Please sign in to comment.
You can’t perform that action at this time.