@@ -199,12 +199,14 @@ Structure
199
199
Naming Conventions
200
200
~~~~~~~~~~~~~~~~~~
201
201
202
- * Use camelCase, not underscores, for variable , function and method
203
- names, arguments ;
202
+ * Use ` camelCase `_ for PHP variables , function and method names, arguments
203
+ (e.g. `` $acceptableContentTypes ``, `` hasSession() ``) ;
204
204
205
- * Use underscores for configuration options and parameters;
205
+ * Use `snake_case `_ for configuration parameters and Twig template variables
206
+ (e.g. ``framework.csrf_protection ``, ``http_status_code ``);
206
207
207
- * Use namespaces for all classes;
208
+ * Use namespaces for all PHP classes and `UpperCamelCase `_ for their names (e.g.
209
+ ``ConsoleLogger ``);
208
210
209
211
* Prefix all abstract classes with ``Abstract `` except PHPUnit ``*TestCase ``.
210
212
Please note some early Symfony classes do not follow this convention and
@@ -217,7 +219,9 @@ Naming Conventions
217
219
218
220
* Suffix exceptions with ``Exception ``;
219
221
220
- * Use alphanumeric characters and underscores for file names;
222
+ * Use UpperCamelCase for naming PHP files (e.g. ``EnvVarProcessor.php ``) and
223
+ snake case for naming Twig templates and web assets (``section_layout.html.twig ``,
224
+ ``index.scss ``);
221
225
222
226
* For type-hinting in PHPDocs and casting, use ``bool `` (instead of ``boolean ``
223
227
or ``Boolean ``), ``int `` (instead of ``integer ``), ``float `` (instead of
@@ -280,3 +284,6 @@ License
280
284
.. _`PSR-4` : https://www.php-fig.org/psr/psr-4/
281
285
.. _`identical comparison` : https://php.net/manual/en/language.operators.comparison.php
282
286
.. _`Yoda conditions` : https://en.wikipedia.org/wiki/Yoda_conditions
287
+ .. _`camelCase` : https://en.wikipedia.org/wiki/Camel_case
288
+ .. _`UpperCamelCase` : https://en.wikipedia.org/wiki/Camel_case
289
+ .. _`snake_case` : https://en.wikipedia.org/wiki/Snake_case
0 commit comments