Skip to content

[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

Conversation

Simperfit
Copy link
Contributor

Q A
Branch? 4.4
Bug fix? no
New feature? no
BC breaks? no
Deprecations? yes
Tests pass? yes
Fixed tickets #31915
License MIT
Doc PR none

@Tobion is this what you had in mind ?

@Simperfit Simperfit force-pushed the deprecated/add-deprecation-for-global-dir branch from 78bd10a to 1d9cd50 Compare June 8, 2019 16:39
@nicolas-grekas nicolas-grekas added this to the next milestone Jun 9, 2019
@Simperfit Simperfit force-pushed the deprecated/add-deprecation-for-global-dir branch 4 times, most recently from 5ee876a to fe45176 Compare June 14, 2019 06:00
@Simperfit
Copy link
Contributor Author

@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.

@Simperfit
Copy link
Contributor Author

cc @fabpot

@Simperfit Simperfit force-pushed the deprecated/add-deprecation-for-global-dir branch from fe45176 to 1727473 Compare June 29, 2019 08:35
@Simperfit Simperfit force-pushed the deprecated/add-deprecation-for-global-dir branch 6 times, most recently from 3ee4d4b to 588fa39 Compare June 29, 2019 15:20
@Simperfit Simperfit force-pushed the deprecated/add-deprecation-for-global-dir branch from 588fa39 to fc36e9f Compare July 16, 2019 16:04
@Simperfit
Copy link
Contributor Author

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))) {
Copy link
Contributor

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>
Copy link
Contributor

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
Copy link
Contributor

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')) {
Copy link
Contributor

@Tobion Tobion Jul 30, 2019

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?

@Tobion
Copy link
Contributor

Tobion commented Aug 20, 2019

Closing in favor of #33258

@Tobion Tobion closed this Aug 20, 2019
nicolas-grekas added a commit that referenced this pull request Aug 21, 2019
…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
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants