upgraded dependencies
This commit is contained in:
@@ -23,68 +23,24 @@ class FileLocator extends BaseFileLocator
|
||||
{
|
||||
private $kernel;
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 4.4
|
||||
*/
|
||||
private $path;
|
||||
|
||||
public function __construct(KernelInterface $kernel/* , string $path = null, array $paths = [], bool $triggerDeprecation = true */)
|
||||
public function __construct(KernelInterface $kernel)
|
||||
{
|
||||
$this->kernel = $kernel;
|
||||
|
||||
if (2 <= \func_num_args()) {
|
||||
$this->path = func_get_arg(1);
|
||||
$paths = 3 <= \func_num_args() ? func_get_arg(2) : [];
|
||||
if (null !== $this->path) {
|
||||
$paths[] = $this->path;
|
||||
}
|
||||
|
||||
if (4 !== \func_num_args() || func_get_arg(3)) {
|
||||
@trigger_error(sprintf('Passing more than one argument to %s is deprecated since Symfony 4.4 and will be removed in 5.0.', __METHOD__), \E_USER_DEPRECATED);
|
||||
}
|
||||
} else {
|
||||
$paths = [];
|
||||
}
|
||||
|
||||
parent::__construct($paths);
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function locate($file, $currentPath = null, $first = true)
|
||||
public function locate(string $file, string $currentPath = null, bool $first = true)
|
||||
{
|
||||
if (isset($file[0]) && '@' === $file[0]) {
|
||||
return $this->kernel->locateResource($file, $this->path, $first, false);
|
||||
$resource = $this->kernel->locateResource($file);
|
||||
|
||||
return $first ? $resource : [$resource];
|
||||
}
|
||||
|
||||
$locations = parent::locate($file, $currentPath, $first);
|
||||
|
||||
if (isset($file[0]) && !(
|
||||
'/' === $file[0] || '\\' === $file[0]
|
||||
|| (\strlen($file) > 3 && ctype_alpha($file[0]) && ':' === $file[1] && ('\\' === $file[2] || '/' === $file[2]))
|
||||
|| null !== parse_url($file, \PHP_URL_SCHEME)
|
||||
)) {
|
||||
$deprecation = false;
|
||||
|
||||
// no need to trigger deprecations when the loaded file is given as absolute path
|
||||
foreach ($this->paths as $deprecatedPath) {
|
||||
foreach ((array) $locations as $location) {
|
||||
if (null !== $currentPath && str_starts_with($location, $currentPath)) {
|
||||
return $locations;
|
||||
}
|
||||
|
||||
if (str_starts_with($location, $deprecatedPath) && (null === $currentPath || !str_contains($location, $currentPath))) {
|
||||
$deprecation = sprintf('Loading the file "%s" from the global resource directory "%s" is deprecated since Symfony 4.4 and will be removed in 5.0.', $file, $deprecatedPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($deprecation) {
|
||||
@trigger_error($deprecation, \E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
return $locations;
|
||||
return parent::locate($file, $currentPath, $first);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user