fix merge
This commit is contained in:
parent
23fac65a3c
commit
706706b3c7
@ -227,20 +227,8 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function locateResource(string $name/*, $dir = null, $first = true, $triggerDeprecation = true*/)
|
||||
public function locateResource(string $name)
|
||||
{
|
||||
if (2 <= \func_num_args()) {
|
||||
$dir = func_get_arg(1);
|
||||
$first = 3 <= \func_num_args() ? func_get_arg(2) : true;
|
||||
|
||||
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 {
|
||||
$dir = null;
|
||||
$first = true;
|
||||
}
|
||||
|
||||
if ('@' !== $name[0]) {
|
||||
throw new \InvalidArgumentException(sprintf('A resource name must start with @ ("%s" given).', $name));
|
||||
}
|
||||
@ -255,27 +243,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
list($bundleName, $path) = explode('/', $bundleName, 2);
|
||||
}
|
||||
|
||||
$isResource = 0 === strpos($path, 'Resources') && null !== $dir;
|
||||
$overridePath = substr($path, 9);
|
||||
$bundle = $this->getBundle($bundleName);
|
||||
$files = [];
|
||||
|
||||
if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) {
|
||||
$files[] = $file;
|
||||
|
||||
// see https://symfony.com/doc/current/bundles/override.html on how to overwrite parts of a bundle
|
||||
@trigger_error(sprintf('Overwriting the resource "%s" with "%s" is deprecated since Symfony 4.4 and will be removed in 5.0.', $name, $file), E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
if (file_exists($file = $bundle->getPath().'/'.$path)) {
|
||||
if ($first && !$isResource) {
|
||||
return $file;
|
||||
}
|
||||
$files[] = $file;
|
||||
}
|
||||
|
||||
if (\count($files) > 0) {
|
||||
return $first && $isResource ? $files[0] : $files;
|
||||
return $file;
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException(sprintf('Unable to find file "%s".', $name));
|
||||
|
Reference in New Issue
Block a user