-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[HttpKernel] add a deprecation for global dir #31958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,12 +29,14 @@ class FileLocator extends BaseFileLocator | |
* @param string|null $path The path the global resource directory | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the phpdoc should be removed if it's not inteded to be used anymore |
||
* @param array $paths An array of paths where to look for resources | ||
*/ | ||
public function __construct(KernelInterface $kernel, string $path = null, array $paths = []) | ||
public function __construct(KernelInterface $kernel, $paths = []) | ||
{ | ||
$this->kernel = $kernel; | ||
if (null !== $path) { | ||
if (3 === \count(\func_get_args()) && \is_string(func_get_arg(1)) && null !== ($path = func_get_arg(1))) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can use func_num_args here |
||
$paths = func_get_arg(2); | ||
Simperfit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
$this->path = $path; | ||
$paths[] = $path; | ||
@trigger_error(sprintf('Using "$path" for a global resource directory in %s is deprecated since Symfony 4.4 and will be removed in 5.0.', __METHOD__), E_USER_DEPRECATED); | ||
} | ||
|
||
parent::__construct($paths); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -261,6 +261,9 @@ public function locateResource($name, $dir = null, $first = true) | |
$files = []; | ||
|
||
if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) { | ||
if (0 === strpos($dir, 'app') || 0 === strpos($dir, 'src')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
@trigger_error('Using the global fallback to load resources is deprecated since Symfony 4.4 and will be removed in 5.0.', E_USER_DEPRECATED); | ||
} | ||
$files[] = $file; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you removed this argument. how does
%kernel.root_dir%/Resources
still work then?