Skip to content

Update best_practices.rst #9041

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundles/best_practices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ A namespace becomes a bundle as soon as you add a bundle class to it. The
bundle class name must follow these simple rules:

* Use only alphanumeric characters and underscores;
* Use a CamelCased name;
Copy link
Member

Choose a reason for hiding this comment

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

We always use "CamelCase", "snake_case", etc. in the docs. Do you find this hard to understand? (I'm trying to better understand the reason for this change). Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@javiereguiluz In PHP context camelCase usually uses to describe rule, when first letter is lower-case. If first letter is capitalized, this style usually calls StudlyCaps.

Reference: http://www.php-fig.org/psr/psr-1/

  • Class names MUST be declared in StudlyCaps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As PSR is an official doc for PHP code style, better use PSR terminology for PHP projects

Copy link
Member

Choose a reason for hiding this comment

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

@SergeyPodgornyy thanks for the info. You are right and using the same terminology than PSR is the right thing to do. I added a minor clarification because StudlyCaps is less known than camelCase. Cheers!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@javiereguiluz Ok, but why you closed this PR without merging? 😒

Copy link
Member

Choose a reason for hiding this comment

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

Ah sorry for not explaining. You sent your pull request to 4.0 branch, but I merged it on 2.7 (this is the commit --> ac99784). You can see your work merged here: https://github.com/symfony/symfony-docs/commits/2.7

Problem is that when I merge in a different branch, the tool we use to merge makes GitHub think that this is closed instead of merged ... but it's merged 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, thanks for explanation. But it's merged only for old version? =(

Copy link
Member

Choose a reason for hiding this comment

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

All changes are "merged up" in all branches, so you can see the change from 2.7 (https://symfony.com/doc/2.7/bundles/best_practices.html) to 4.1 (https://symfony.com/doc/master/bundles/best_practices.html)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@javiereguiluz Oh, thank you. Just the last question. If I'll make a new Pull Request next time, to which branch should I create pull request?

Copy link
Member

Choose a reason for hiding this comment

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

@SergeyPodgornyy We always merge PRs in the oldest maintained branch that is affected by a change. Currently, maintained Symfony versions are 2.7, 2.8, 3.3, 3.4, 4.0 and 4.1 (aka master).

* Use a StudlyCaps name;
* Use a descriptive and short name (no more than two words);
* Prefix the name with the concatenation of the vendor (and optionally the
category namespaces);
Expand Down