Augmentation vers version 3.3.0
This commit is contained in:
12
vendor/symfony/config/FileLocator.php
vendored
12
vendor/symfony/config/FileLocator.php
vendored
@@ -11,6 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Config;
|
||||
|
||||
use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException;
|
||||
|
||||
/**
|
||||
* FileLocator uses an array of pre-defined paths to find files.
|
||||
*
|
||||
@@ -23,7 +25,7 @@ class FileLocator implements FileLocatorInterface
|
||||
/**
|
||||
* @param string|array $paths A path or an array of paths where to look for resources
|
||||
*/
|
||||
public function __construct($paths = array())
|
||||
public function __construct($paths = [])
|
||||
{
|
||||
$this->paths = (array) $paths;
|
||||
}
|
||||
@@ -39,7 +41,7 @@ class FileLocator implements FileLocatorInterface
|
||||
|
||||
if ($this->isAbsolutePath($name)) {
|
||||
if (!file_exists($name)) {
|
||||
throw new \InvalidArgumentException(sprintf('The file "%s" does not exist.', $name));
|
||||
throw new FileLocatorFileNotFoundException(sprintf('The file "%s" does not exist.', $name), 0, null, [$name]);
|
||||
}
|
||||
|
||||
return $name;
|
||||
@@ -52,7 +54,7 @@ class FileLocator implements FileLocatorInterface
|
||||
}
|
||||
|
||||
$paths = array_unique($paths);
|
||||
$filepaths = array();
|
||||
$filepaths = $notfound = [];
|
||||
|
||||
foreach ($paths as $path) {
|
||||
if (@file_exists($file = $path.\DIRECTORY_SEPARATOR.$name)) {
|
||||
@@ -60,11 +62,13 @@ class FileLocator implements FileLocatorInterface
|
||||
return $file;
|
||||
}
|
||||
$filepaths[] = $file;
|
||||
} else {
|
||||
$notfound[] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$filepaths) {
|
||||
throw new \InvalidArgumentException(sprintf('The file "%s" does not exist (in: %s).', $name, implode(', ', $paths)));
|
||||
throw new FileLocatorFileNotFoundException(sprintf('The file "%s" does not exist (in: %s).', $name, implode(', ', $paths)), 0, null, $notfound);
|
||||
}
|
||||
|
||||
return $filepaths;
|
||||
|
||||
Reference in New Issue
Block a user