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

Commit d912036

Browse filesBrowse files
committed
Merge branch '4.4' into 5.4
* 4.4: Document code-style for enums and class constants
2 parents 309abf8 + 3ce2c1a commit d912036
Copy full SHA for d912036

File tree

Expand file treeCollapse file tree

1 file changed

+9
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-2
lines changed

‎contributing/code/standards.rst

Copy file name to clipboardExpand all lines: contributing/code/standards.rst
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,12 @@ Naming Conventions
206206
* Use `snake_case`_ for configuration parameters and Twig template variables
207207
(e.g. ``framework.csrf_protection``, ``http_status_code``);
208208

209-
* Use namespaces for all PHP classes and `UpperCamelCase`_ for their names (e.g.
210-
``ConsoleLogger``);
209+
* Use `SCREAMING_SNAKE_CASE`_ for constants (e.g. ``InputArgument::IS_ARRAY``);
210+
211+
* Use `UpperCamelCase`_ for enumeration cases (e.g. ``InputArgumentMode::IsArray``);
212+
213+
* Use namespaces for all PHP classes, interfaces, traits and enums and
214+
`UpperCamelCase`_ for their names (e.g. ``ConsoleLogger``);
211215

212216
* Prefix all abstract classes with ``Abstract`` except PHPUnit ``*TestCase``.
213217
Please note some early Symfony classes do not follow this convention and
@@ -218,6 +222,9 @@ Naming Conventions
218222

219223
* Suffix traits with ``Trait``;
220224

225+
* Don't use a dedicated suffix for classes or enumerations (e.g. like ``Class``
226+
or ``Enum``), except for the cases listed below.
227+
221228
* Suffix exceptions with ``Exception``;
222229

223230
* Prefix PHP attributes with ``As`` where applicable (e.g. ``#[AsCommand]``

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.