Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Bundles] Rename getPublicPath() as getPublicDir() #32452

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

Merged
merged 1 commit into from
Jul 12, 2019

Conversation

javiereguiluz
Copy link
Member

Q A
Branch? 4.4
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR I'll add this if approved

While documenting #31975 (see symfony/symfony-docs#11930) I realized that the getPublicPath() method name is not consistent with the rest of Symfony.

In Symfony, "path" is usually associated to routes and we use "dir" for things similar to this:

So, this PR proposes to rename getPublicPath() as getPublicDir()

@javiereguiluz javiereguiluz added this to the next milestone Jul 9, 2019
@fabpot
Copy link
Member

fabpot commented Jul 9, 2019

One difference though is that getCacheDir() and getLogDir() are returning absolute paths. Here, we return relative paths.

@javiereguiluz
Copy link
Member Author

I haven't thought about that 🤔 To me, "dir" can mean both relative and absolute, such as in this example:

composer-dir

But if this is confusing to people, we can close this.

@linaori
Copy link
Contributor

linaori commented Jul 9, 2019

As dir stands for directory, it doesn't assume absolute or relative paths

A directory is a "folder", a place where you can put files or other directories (and special files, devices, symlinks...). It is a container for filesystem objects.

A path is a string that specify how to reach a filesystem object (and this object can be a file, a directory, a special file, ...).

Example: you have (probably, depending on your system) a file where system messages are logged, called syslog.

[ ... ]

https://unix.stackexchange.com/questions/131561/what-is-the-difference-between-path-and-directory

Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough

@trigger_error('Not defining "getPublicPath()" method is deprecated since Symfony 4.4 and will not be supported in 5.0.', E_USER_DEPRECATED);
$publicPath = 'Resources/public';
if (!method_exists($bundle, 'getPublicDir')) {
@trigger_error(sprintf('Not defining "getPublicDir()" method in the "%s" class is deprecated since Symfony 4.4 and will not be supported in 5.0.', get_class($bundle)), E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\get_class, as reported by fabbot

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GTM once fabbot is green :)

@fabpot
Copy link
Member

fabpot commented Jul 12, 2019

Thank you @javiereguiluz.

@fabpot fabpot merged commit 4ab2f99 into symfony:4.4 Jul 12, 2019
fabpot added a commit that referenced this pull request Jul 12, 2019
…ereguiluz)

This PR was squashed before being merged into the 4.4 branch (closes #32452).

Discussion
----------

[Bundles] Rename getPublicPath() as getPublicDir()

| 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? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | -
| License       | MIT
| Doc PR        | I'll add this if approved

While documenting #31975 (see symfony/symfony-docs#11930) I realized that the `getPublicPath()` method name is not consistent with the rest of Symfony.

In Symfony, "path" is usually associated to routes and we use "dir" for things similar to this:

* `getCacheDir()` and `getLogdir()` to override Symfony structure (https://symfony.com/doc/current/configuration/override_dir_structure.html)
* `binDir`, `configDir`, `srcDir`, `varDir`, `publicDir` in Symfony Flex recipes (https://github.com/symfony/recipes) to override the dir structure

So, this PR proposes to rename `getPublicPath()` as `getPublicDir()`

Commits
-------

4ab2f99 [Bundles] Rename getPublicPath() as getPublicDir()
@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.

7 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.