Skip to content

Commit 9442c2a

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: Document code-style for enums and class constants Fix doc for String
2 parents 183eaf8 + 69992ab commit 9442c2a

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

components/string.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,11 @@ Methods to Search and Replace
318318
u('foo')->equalsTo('foo'); // true
319319

320320
// checks if the string content match the given regular expression.
321-
// You can pass flags for preg_match() as second argument. If PREG_PATTERN_ORDER
322-
// or PREG_SET_ORDER are passed, preg_match_all() will be used.
323321
u('avatar-73647.png')->match('/avatar-(\d+)\.png/');
324-
// result = ['avatar-73647.png', '73647']
325-
u('avatar-73647.png')->match('/avatar-(\d+)(-\d+)?\.png/', \PREG_UNMATCHED_AS_NULL);
326322
// result = ['avatar-73647.png', '73647', null]
323+
324+
// You can pass flags for preg_match() as second argument. If PREG_PATTERN_ORDER
325+
// or PREG_SET_ORDER are passed, preg_match_all() will be used.
327326
u('206-555-0100 and 800-555-1212')->match('/\d{3}-\d{3}-\d{4}/', \PREG_PATTERN_ORDER);
328327
// result = [['206-555-0100', '800-555-1212']]
329328

contributing/code/standards.rst

Lines 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)