Skip to content

Commit 00fd25c

Browse files
committed
minor symfony#18404 [Standards] Update code guidelines (alexandre-daubois)
This PR was merged into the 5.4 branch. Discussion ---------- [Standards] Update code guidelines I think coding standards could be updated to reflect [this discussion](symfony/symfony#50615 (comment)) 👍 Commits ------- ed6bf81 [Standards] Update code guidelines
2 parents 4f63c92 + ed6bf81 commit 00fd25c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

contributing/code/standards.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,14 @@ Structure
190190
191191
* Exception and error messages must start with a capital letter and finish with a dot ``.``;
192192

193+
* Exception, error and deprecation messages containing a class name must
194+
use ``get_debug_type()`` instead of ``::class`` to retrieve it:
195+
196+
.. code-block:: diff
197+
198+
- throw new \Exception(sprintf('Command "%s" failed.', $command::class));
199+
+ throw new \Exception(sprintf('Command "%s" failed.', get_debug_type($command)));
200+
193201
* Do not use ``else``, ``elseif``, ``break`` after ``if`` and ``case`` conditions
194202
which return or throw something;
195203

0 commit comments

Comments
 (0)