-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
[HttpKernel] add a deprecation for global dir #31958
Conversation
b6a8551
to
78bd10a
Compare
78bd10a
to
1d9cd50
Compare
5ee876a
to
fe45176
Compare
@Tobion @nicolas-grekas I've changed things a little bit, prepared the removels of the constructor argument like said and move the deprecation where it actually loads the file testing if it's load it globally or not, hope that's what you had in mind. |
cc @fabpot |
fe45176
to
1727473
Compare
3ee4d4b
to
588fa39
Compare
588fa39
to
fc36e9f
Compare
Status: Needs review |
{ | ||
$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 comment
The reason will be displayed to describe this comment to others. Learn more.
you can use func_num_args here
@@ -87,7 +87,7 @@ | |||
|
|||
<service id="file_locator" class="Symfony\Component\HttpKernel\Config\FileLocator"> | |||
<argument type="service" id="kernel" /> | |||
<argument>%kernel.root_dir%/Resources</argument> |
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?
@@ -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 comment
The 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
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
$dir
would normally be %kernel.root_dir%/Resources
. I don't see when it would ever start with app
or src
? What is this supposed to do? Do we not always want to trigger a deprecation if a bundle overwrite is found?
Closing in favor of #33258 |
…om (Tobion) This PR was merged into the 4.4 branch. Discussion ---------- [HttpKernel] deprecate global dir to load resources from | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #31915 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | Replaces #31958 Here two example deprecations by adding files in the deprecated locations: ``` Overwriting the resource "@AcmeBundle/Resources/config/routing.yaml" with "/vagrant/src/Resources/AcmeBundle/config/routing.yaml" is deprecated since Symfony 4.4 and will be removed in 5.0. Loading the file "foobar.yaml" from the global resource directory "/vagrant/src" is deprecated since Symfony 4.4 and will be removed in 5.0. ``` Commits ------- aa82566 [HttpKernel] deprecate global dir to load resources from
@Tobion is this what you had in mind ?