8000 Document code-style for enums and class constants · GromNaN/symfony-docs@4cc6393 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4cc6393

Browse files
committed
Document code-style for enums and class constants
1 parent ef45d15 commit 4cc6393

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

contributing/code/standards.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,12 @@ Naming Conventions
210210
* Use `snake_case`_ for configuration parameters and Twig template variables
211211
(e.g. ``framework.csrf_protection``, ``http_status_code``);
212212

213-
* Use namespaces for all PHP classes and `UpperCamelCase`_ for their names (e.g.
214-
``ConsoleLogger``);
213+
* Use `SCREAMING_SNAKE_CASE`_ for constants (e.g. ``InputArgument::IS_ARRAY``);
214+
215+
* Use `UpperCamelCase`_ for enumeration cases (e.g. ``InputArgumentMode::IsArray``);
216+
217+
* Use namespaces for all PHP classes, interfaces, traits and enums and
218+
`UpperCamelCase`_ for their names (e.g. ``ConsoleLogger``);
215219

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

223227
* Suffix traits with ``Trait``;
224228

229+
* Don't use a dedicated suffix for classes or enumerations (e.g. like ``Class``
230+
or ``Enum``), except for the cases listed below.
231+
225232
* Suffix exceptions with ``Exception``;
226233

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

0 commit comments

Comments
 (0)
0