Skip to content

Commit 8138a21

Browse files
committed
Merge branch '4.4' into 5.2
* 4.4: [Validator] Use import instead of FQCN [Validator] Use null coalescing operator instead of ternary operator Add reference to commit message conventions
2 parents 462f27f + 87adaf0 commit 8138a21

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

contributing/code/conventions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ conventions:
9999

100100
* No third level sections are allowed;
101101

102-
* Messages should follow the commit message conventions: should be short,
103-
capitalize the line, do not end with a period, use an imperative verb to
104-
start the line;
102+
* Messages should follow the :ref:`commit message conventions <commit-messages>`:
103+
should be short, capitalize the line, do not end with a period, use an
104+
imperative verb to start the line;
105105

106106
* New entries must be added on top of the list.
107107

contributing/code/pull_requests.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ in mind the following:
224224
* Never fix coding standards in some existing code as it makes the code review
225225
more difficult;
226226

227+
.. _commit-messages:
228+
227229
* Write good commit messages: Start by a short subject line (the first line),
228230
followed by a blank line and a more detailed description.
229231

form/dynamic_form_modification.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ sport like this::
377377
// src/Form/Type/SportMeetupType.php
378378
namespace App\Form\Type;
379379

380+
use App\Entity\Position;
381+
use App\Entity\Sport;
380382
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
381383
use Symfony\Component\Form\AbstractType;
382384
use Symfony\Component\Form\FormBuilderInterface;
@@ -390,7 +392,7 @@ sport like this::
390392
{
391393
$builder
392394
->add('sport', EntityType::class, [
393-
'class' => 'App\Entity\Sport',
395+
'class' => Sport::class,
394396
'placeholder' => '',
395397
])
396398
;
@@ -407,7 +409,7 @@ sport like this::
407409
$positions = null === $sport ? [] : $sport->getAvailablePositions();
408410

409411
$form->add('position', EntityType::class, [
410-
'class' => 'App\Entity\Position',
412+
'class' => Position::class,
411413
'placeholder' => '',
412414
'choices' => $positions,
413415
]);
@@ -443,6 +445,7 @@ The type would now look like::
443445
// src/Form/Type/SportMeetupType.php
444446
namespace App\Form\Type;
445447

448+
use App\Entity\Position;
446449
use App\Entity\Sport;
447450
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
448451
use Symfony\Component\Form\FormInterface;
@@ -454,7 +457,7 @@ The type would now look like::
454457
{
455458
$builder
456459
->add('sport', EntityType::class, [
457-
'class' => 'App\Entity\Sport',
460+
'class' => Sport::class,
458461
'placeholder' => '',
459462
])
460463
;
@@ -463,7 +466,7 @@ The type would now look like::
463466
$positions = null === $sport ? [] : $sport->getAvailablePositions();
464467

465468
$form->add('position', EntityType::class, [
466-
'class' => 'App\Entity\Position',
469+
'class' => Position::class,
467470
'placeholder' => '',
468471
'choices' => $positions,
469472
]);

validation/severity.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ method. Each constraint exposes the attached payload as a public property::
137137
// Symfony\Component\Validator\ConstraintViolation
138138
$constraintViolation = ...;
139139
$constraint = $constraintViolation->getConstraint();
140-
$severity = isset($constraint->payload['severity']) ? $constraint->payload['severity'] : null;
140+
$severity = $constraint->payload['severity'] ?? null;
141141

142142
For example, you can leverage this to customize the ``form_errors`` block
143143
so that the severity is added as an additional HTML class:

0 commit comments

Comments
 (0)