Skip to content

Commit 543bfb4

Browse files
committed
Merge branch '2.8' into 3.4
* 2.8: Replace "set leave" with leave only Improved the explanation of naming in PHP and Twig
2 parents b55bc17 + 5edc033 commit 543bfb4

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

contributing/code/standards.rst

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,14 @@ Structure
199199
Naming Conventions
200200
~~~~~~~~~~~~~~~~~~
201201

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()``);
204204

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``);
206207

207-
* Use namespaces for all classes;
208+
* Use namespaces for all PHP classes and `UpperCamelCase`_ for their names (e.g.
209+
``ConsoleLogger``);
208210

209211
* Prefix all abstract classes with ``Abstract`` except PHPUnit ``*TestCase``.
210212
Please note some early Symfony classes do not follow this convention and
@@ -217,7 +219,9 @@ Naming Conventions
217219

218220
* Suffix exceptions with ``Exception``;
219221

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``);
221225

222226
* For type-hinting in PHPDocs and casting, use ``bool`` (instead of ``boolean``
223227
or ``Boolean``), ``int`` (instead of ``integer``), ``float`` (instead of
@@ -280,3 +284,6 @@ License
280284
.. _`PSR-4`: https://www.php-fig.org/psr/psr-4/
281285
.. _`identical comparison`: https://php.net/manual/en/language.operators.comparison.php
282286
.. _`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

reference/constraints/Image.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ allowSquare
318318
**type**: ``Boolean`` **default**: ``true``
319319

320320
If this option is false, the image cannot be a square. If you want to force
321-
a square image, then set leave this option as its default ``true`` value
321+
a square image, then leave this option as its default ``true`` value
322322
and set `allowLandscape`_ and `allowPortrait`_ both to ``false``.
323323

324324
allowLandscape

0 commit comments

Comments
 (0)