PHP 8.6 vyšlo. DressCode na něj váš kód přepíše. Přechod na novější PHP →

Komentáře

Jen dvě věci hlídá sekce comments v obyčejných komentářích: řádkový komentář psaný # místo // a prázdné //, které v kódu zůstalo po smazaném textu. Mezeru za // řídí sekce spacing, dokumentační komentáře sekce phpdoc.

comments:
	singleline: '//'
	empty: forbidden
# the total of the cart  // A single-line comment must start with `//`, not `#`.
$total = 0;
//
$count = 0;  // Empty comment.
// the total of the cart
$total = 0;
$count = 0;

Atribut #[...] není komentář, a tak ho singleline nechá být.

comments.empty

An empty comment, which is removed.

  • forbidden: never there
  • keep: nic se nevynucuje, kód zůstane, jak je

Výchozí keep · standardy: perCs keep, psr12 keep, nette forbidden, symfony forbidden, laravel keep · pokrývá no_empty_comment, SlevomatCodingStandard.Commenting.EmptyComment

comments.firstColumn

A // or # comment on a line of its own in the first column of an indented block, as an editor comments a line out, the indentation of the line after the marker; where it may not stand there, it takes the indentation of the line below it and the marker loses the indentation it doubles.

Not a /* */ comment.

  • forbidden: never there
  • optional: there or not, as the author wrote it

Výchozí forbidden · standardy: perCs forbidden, psr12 forbidden, nette forbidden, symfony forbidden, laravel forbidden

comments.singleline

The marker of a single-line comment.

  • '//': //, never #
  • keep: nic se nevynucuje, kód zůstane, jak je

Výchozí keep · standardy: perCs keep, psr12 keep, nette '//', symfony '//', laravel '//' · pokrývá single_line_comment_style, PEAR.Commenting.InlineComment

Zobrazit na GitHubu · Nahlásit problém se stránkou na GitHubu · 9. 11. 2026