# Drupal standard

The sniffs of Coder's own `Drupal` standard, by category. The sniffs taken from other standards are on [Sniffs from other standards](<https://project.pages.drupalcode.org/mago/coder/other-standards/index.md>).

## Arrays

| Sniff | Handled by |
| --- | --- |
| [`Drupal.Arrays.Array`](<#drupalarraysarray>) | `mago format`, partly |

### `Drupal.Arrays.Array`

The drupal preset writes the trailing comma, the indentation and the line breaks of a long array.

| Codes | Handled by |
| --- | --- |
| `ArrayClosingIndentation`, `ArrayIndentation` | `mago format`, partly |
| `CommaLastItem`, `LongLineDeclaration` | `mago format` |

- `ArrayClosingIndentation`: An array that opens on a continuation line gets the indent of the statement's first line. Coder counts from the line the array opens on, and reports its items and closing bracket.
- `ArrayIndentation`: When the value after `=>` is a `??` chain that breaks over lines, the formatter writes the next lines at the key's indent. Coder wants them one level deeper. The formatter also writes the broken `&&` or `||` condition of a ternary in an array element at the element's indent, and breaks an array at a block comment between its elements, and Coder reports both.

## Attributes

| Sniff | Handled by |
| --- | --- |
| `Drupal.Attributes.ValidHookName` | [`drupal/hook-attribute-name`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalhook-attribute-name>) |

## Classes

| Sniff | Handled by |
| --- | --- |
| [`Drupal.Classes.ClassDeclaration`](<#drupalclassesclassdeclaration>) | `mago format`, [`drupal/post-statement-comment`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupalpost-statement-comment>), Mago `parse`, partly |
| `Drupal.Classes.FullyQualifiedNamespace` | [`drupal/fully-qualified-name`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalfully-qualified-name>) |
| `Drupal.Classes.PropertyDeclaration` | [`drupal/property-visibility`](<https://project.pages.drupalcode.org/mago/rules/statements/index.md#drupalproperty-visibility>) |
| `Drupal.Classes.UseGlobalClass` | [`drupal/redundant-use`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalredundant-use>) |

### `Drupal.Classes.ClassDeclaration`

| Codes | Handled by |
| --- | --- |
| `BraceOnNewLine`, `CloseBraceAfterBody`, `ExtendsIndentation`, `ExtendsInterfaceSameLine`, `ExtendsLine`, `FirstExtendsInterfaceSameLine`, `FirstInterfaceSameLine`, `ImplementsLine`, `InterfaceSameLine`, `InterfaceWrongIndent`, `NewlineBeforeKeyword`, `NoSpaceBeforeName`, `SpaceAfterKeyword`, `SpaceAfterName`, `SpaceBeforeBrace`, `SpaceBeforeComma`, `SpaceBeforeExtends`, `SpaceBeforeImplements`, `SpaceBeforeKeyword`, `SpaceBeforeName` | `mago format` |
| `CloseBraceSameLine` | [`drupal/post-statement-comment`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupalpost-statement-comment>), `mago format`, partly |
| `ContentAfterBrace` | `mago format`, [`drupal/post-statement-comment`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupalpost-statement-comment>) |
| `MissingBrace` | Mago `parse` |

- `CloseBraceSameLine`: `drupal/post-statement-comment` reports a comment after the closing brace of a class, such as `} // end class`. The formatter moves code after the brace to a line of its own and removes trailing spaces. A `?>` after the brace isn't reported when HTML follows it. At the end of a file, `no-closing-tag` reports the tag and the formatter removes it.
- `MissingBrace`: A class without braces doesn't parse. Mago reports a `parse` error, and the formatter skips the file.

## Commenting

| Sniff | Handled by |
| --- | --- |
| [`Drupal.Commenting.ClassComment`](<#drupalcommentingclasscomment>) | [`drupal/missing-class-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalmissing-class-comment>), [`drupal/class-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalclass-comment>) |
| `Drupal.Commenting.Deprecated` | [`drupal/deprecated-tag`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldeprecated-tag>) |
| [`Drupal.Commenting.DocComment`](<#drupalcommentingdoccomment>) | [`drupal/doc-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-comment>), Mago `no-empty-comment`, [`drupal/long-description-punctuation`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupallong-description-punctuation>), [`drupal/doc-sentence`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-sentence>), [`drupal/missing-summary`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalmissing-summary>), [`drupal/doc-tag-groups`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-tag-groups>), partly |
| [`Drupal.Commenting.DocCommentAlignment`](<#drupalcommentingdoccommentalignment>) | [`drupal/doc-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-comment>), `mago format` |
| `Drupal.Commenting.DocCommentLongArraySyntax` | [`drupal/doc-comment-array-syntax`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupaldoc-comment-array-syntax>) |
| [`Drupal.Commenting.DocCommentStar`](<#drupalcommentingdoccommentstar>) | `mago format` |
| [`Drupal.Commenting.FileComment`](<#drupalcommentingfilecomment>) | [`drupal/file-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalfile-comment>), [`drupal/missing-file-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalmissing-file-comment>), `mago format`, nothing, partly |
| [`Drupal.Commenting.FunctionComment`](<#drupalcommentingfunctioncomment>) | [`drupal/doc-tag-types`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-tag-types>), [`drupal/doc-see-tag`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-see-tag>), `mago analyze` (`invalid-param-tag`), [`drupal/doc-tag-descriptions`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-tag-descriptions>), [`drupal/doc-type-name`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-type-name>), `mago analyze` (`missing-return-statement`), `mago analyze` (`invalid-return-statement`), `mago analyze` (`invalid-generator-return-type`), [`drupal/missing-function-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalmissing-function-comment>), [`drupal/doc-sentence`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-sentence>), [`drupal/doc-tag-layout`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-tag-layout>), [`drupal/function-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalfunction-comment>) |
| `Drupal.Commenting.GenderNeutralComment` | [`drupal/gender-neutral-comment`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupalgender-neutral-comment>) |
| `Drupal.Commenting.HookComment` | [`drupal/hook-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalhook-comment>) |
| [`Drupal.Commenting.InlineComment`](<#drupalcommentinginlinecomment>) | [`drupal/inline-comment`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupalinline-comment>), Mago `no-empty-comment`, [`drupal/inline-comment-punctuation`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupalinline-comment-punctuation>), [`drupal/inline-comment-blank-line`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupalinline-comment-blank-line>), `mago format`, partly |
| `Drupal.Commenting.InlineVariableComment` | [`drupal/inline-variable-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalinline-variable-comment>) |
| `Drupal.Commenting.PostStatementComment` | [`drupal/post-statement-comment`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupalpost-statement-comment>) |
| `Drupal.Commenting.TodoComment` | [`drupal/todo-comment`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupaltodo-comment>) |
| [`Drupal.Commenting.VariableComment`](<#drupalcommentingvariablecomment>) | [`drupal/variable-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalvariable-comment>), [`drupal/doc-see-tag`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-see-tag>), [`drupal/doc-type-name`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-type-name>), [`drupal/missing-property-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalmissing-property-comment>), partly |

### `Drupal.Commenting.ClassComment`

| Codes | Handled by |
| --- | --- |
| `Missing` | [`drupal/missing-class-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalmissing-class-comment>) |
| `Short`, `SpacingAfter`, `WrongStyle` | [`drupal/class-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalclass-comment>) |

### `Drupal.Commenting.DocComment`

| Codes | Handled by |
| --- | --- |
| `ContentAfterOpen`, `InheritDocWithoutBraces`, `ShortStartSpace`, `SpacingAfter`, `SpacingBeforeShort`, `SpacingBetween`, `TagValueIndent`, `WrongEnd` | [`drupal/doc-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-comment>) |
| `Empty` | Mago `no-empty-comment` |
| `LongFullStop` | [`drupal/long-description-punctuation`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupallong-description-punctuation>) |
| `LongNotCapital`, `ShortFullStop`, `ShortNotCapital`, `ShortSingleLine` | [`drupal/doc-sentence`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-sentence>) |
| `MissingShort` | [`drupal/missing-summary`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalmissing-summary>), partly |
| `ParamGroup`, `ParamNotFirst`, `SpacingAfterTagGroup`, `SpacingBeforeTags`, `TagGroupSpacing`, `TagsNotGrouped` | [`drupal/doc-tag-groups`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-tag-groups>) |

- `MissingShort`: A `phpcs:` line above the summary is skipped, and the line below it counts as the summary. Coder reports it. In Drupal core, only the `KernelTests`, `Unit` and `FunctionalJavascript` directories are checked, as in core's `phpcs.xml.dist`.

### `Drupal.Commenting.DocCommentAlignment`

| Codes | Handled by |
| --- | --- |
| `NoSpaceAfterStar`, `SpaceAfterStar` | [`drupal/doc-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-comment>) |
| `SpaceBeforeStar` | `mago format` |

### `Drupal.Commenting.DocCommentStar`

The formatter puts the star back on a docblock line that doesn't have one.

### `Drupal.Commenting.FileComment`

| Codes | Handled by |
| --- | --- |
| `FileTag`, `NamespaceNoFileDoc` | [`drupal/file-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalfile-comment>) |
| `Missing` | [`drupal/missing-file-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalmissing-file-comment>) |
| `SpacingAfterComment` | [`drupal/file-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalfile-comment>), `mago format` |
| `TemplateSpacingAfterComment` | nothing |
| `WrongStyle` | [`drupal/file-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalfile-comment>), partly |

- `TemplateSpacingAfterComment`: A blank line between the file docblock and the `?>` that follows it, in a file of any extension. Not ported.
- `WrongStyle`: A `// @codingStandardsIgnoreFile` comment at the start of a file isn't reported under this code. `drupal/missing-file-comment` reports the file instead. The fix converts a comment only when a blank line follows it.

### `Drupal.Commenting.FunctionComment`

| Codes | Handled by |
| --- | --- |
| `DuplicateReturn`, `InvalidThrows`, `MissingParamName`, `MissingParamType`, `MissingReturnType` | [`drupal/doc-tag-types`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-tag-types>) |
| `EmptySees`, `SeeAdditionalText`, `SeePunctuation` | [`drupal/doc-see-tag`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-see-tag>) |
| `ExtraParamComment` | `mago analyze` (`invalid-param-tag`), [`drupal/doc-tag-descriptions`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-tag-descriptions>) |
| `IncorrectParamVarName`, `InvalidReturn` | [`drupal/doc-type-name`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-type-name>) |
| `InvalidNoReturn` | `mago analyze` (`missing-return-statement`) |
| `InvalidReturnNotVoid` | `mago analyze` (`invalid-return-statement`) |
| `InvalidReturnVoid` | `mago analyze` (`invalid-return-statement`), `mago analyze` (`invalid-generator-return-type`) |
| `Missing` | [`drupal/missing-function-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalmissing-function-comment>) |
| `MissingParamComment`, `MissingReturnComment`, `ParamMissingDefinition` | [`drupal/doc-tag-descriptions`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-tag-descriptions>) |
| `ParamCommentFullStop`, `ParamCommentNotCapital`, `ThrowsNoFullStop`, `ThrowsNotCapital` | [`drupal/doc-sentence`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-sentence>) |
| `ParamCommentIndentation`, `ParamCommentNewLine`, `ParamNameDot`, `ParamTypeSpaces`, `ReturnCommentIndentation`, `ReturnTypeSpaces`, `ReturnVarName`, `SpacingAfterParamType`, `ThrowsComment`, `ThrowsCommentIndentation` | [`drupal/doc-tag-layout`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-tag-layout>) |
| `ParamNameNoCaseMatch` | `mago analyze` (`invalid-param-tag`) |
| `ParamNameNoMatch` | [`drupal/doc-tag-descriptions`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-tag-descriptions>), `mago analyze` (`invalid-param-tag`) |
| `SpacingAfter`, `WrongStyle` | [`drupal/function-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalfunction-comment>) |

- `ExtraParamComment`: `mago analyze` reports a `@param` whose name isn't a parameter, and `drupal/doc-tag-descriptions` one that repeats a name.
- `InvalidNoReturn`: Reported on the function, not on the `@return` tag.
- `InvalidReturnVoid`: Reported on the `return` statement, not on the `@return void` tag. A `yield` in such a function is reported as `invalid-generator-return-type`.
- `ParamNameNoMatch`: `drupal/doc-tag-descriptions` reports a repeated `@param`, one that is out of order, and a `&` on a parameter that isn't taken by reference. `mago analyze` reports a name that isn't a parameter, and a `...` on a parameter that isn't variadic.

### `Drupal.Commenting.InlineComment`

| Codes | Handled by |
| --- | --- |
| `DocBlock`, `NoSpaceBefore`, `NotCapital`, `SpacingBefore`, `TabBefore` | [`drupal/inline-comment`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupalinline-comment>) |
| `Empty` | Mago `no-empty-comment` |
| `InvalidEndChar` | [`drupal/inline-comment-punctuation`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupalinline-comment-punctuation>) |
| `SpacingAfter` | [`drupal/inline-comment-blank-line`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupalinline-comment-blank-line>), `mago format`, partly |
| `SpacingAfterAtFunctionEnd` | `mago format` |
| `WrongStyle` | `mago format`, [`drupal/inline-comment`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupalinline-comment>) |

- `Empty`: Mago's rule. It also reports an empty `/* */`, which Coder doesn't. Its fix leaves a blank line where phpcbf removes the line.
- `SpacingAfter`: The rule leaves the blank line between a comment and a closing bracket to the formatter. Before the closing brace of a class, interface, trait or enum with members the formatter always writes one, and Coder reports it.

### `Drupal.Commenting.VariableComment`

| Codes | Handled by |
| --- | --- |
| `DuplicateVar`, `EmptyVar`, `InlineVariableName`, `MissingVar`, `VarOrder`, `WrongStyle` | [`drupal/variable-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalvariable-comment>) |
| `EmptySees` | [`drupal/doc-see-tag`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-see-tag>) |
| `IncorrectVarType` | [`drupal/doc-type-name`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupaldoc-type-name>), partly |
| `Missing` | [`drupal/missing-property-comment`](<https://project.pages.drupalcode.org/mago/rules/docblock-structure/index.md#drupalmissing-property-comment>) |

- `IncorrectVarType`: Coder runs the whole `@var` line, description included, through its type check, so it also reports a description with a `.`, `;`, `!` or `=` in it. The rule checks only the type.

## ControlStructures

| Sniff | Handled by |
| --- | --- |
| [`Drupal.ControlStructures.ControlSignature`](<#drupalcontrolstructurescontrolsignature>) | `mago format`, partly |

### `Drupal.ControlStructures.ControlSignature`

| Codes | Handled by |
| --- | --- |
| `NewlineAfterCloseBrace`, `SpaceAfterCloseBrace`, `SpaceAfterCloseParenthesis`, `SpaceAfterKeyword`, `SpaceBeforeSemicolon` | `mago format` |
| `NewlineAfterOpenBrace` | `mago format`, partly |

- `NewlineAfterOpenBrace`: The formatter writes a `match` with one arm on one line, and Coder reports that line under this code and under `OpenBracketSpacing.OpeningWhitespace`, `CloseBracketSpacing.ClosingWhitespace` and `ScopeClosingBrace.Line`.

## Files

| Sniff | Handled by |
| --- | --- |
| [`Drupal.Files.EndFileNewline`](<#drupalfilesendfilenewline>) | `mago format` |
| [`Drupal.Files.FileEncoding`](<#drupalfilesfileencoding>) | [`drupal/file-encoding`](<https://project.pages.drupalcode.org/mago/rules/files-and-tags/index.md#drupalfile-encoding>) |
| `Drupal.Files.LineLength` | [`drupal/comment-line-length`](<https://project.pages.drupalcode.org/mago/rules/comment-text/index.md#drupalcomment-line-length>) |
| [`Drupal.Files.TxtFileLineLength`](<#drupalfilestxtfilelinelength>) | phpcs |

### `Drupal.Files.EndFileNewline`

PHP files only. Coder also checks the last line of `.txt`, `.md` and `.yml` files. Mago doesn't read `.txt` and `.md` files, and the formatter skips `.yml` files.

### `Drupal.Files.FileEncoding`

Coder also checks `.txt` and `.md` files, which aren't read by Mago, and the YAML files of a `config` directory, which `drupal.mago.toml` leaves out of the linter.

### `Drupal.Files.TxtFileLineLength`

Checks `.txt` and `.md` files. Mago reads every file as PHP, and a `<?php` example in such a file gives parse errors, so they stay with phpcs.

## Formatting

| Sniff | Handled by |
| --- | --- |
| `Drupal.Formatting.MultiLineAssignment` | `mago format` |
| `Drupal.Formatting.MultipleStatementAlignment` | `mago format` |
| `Drupal.Formatting.SpaceInlineIf` | `mago format` |
| `Drupal.Formatting.SpaceUnaryOperator` | `mago format` |

## Functions

| Sniff | Handled by |
| --- | --- |
| `Drupal.Functions.DiscouragedFunctions` | [`drupal/discouraged-function`](<https://project.pages.drupalcode.org/mago/rules/phpstan-drupal/index.md#drupaldiscouraged-function>), Mago `no-eval` |
| [`Drupal.Functions.MultiLineFunctionDeclaration`](<#drupalfunctionsmultilinefunctiondeclaration>) | `mago format`, [`drupal/parameter-blank-line`](<https://project.pages.drupalcode.org/mago/rules/statements/index.md#drupalparameter-blank-line>) |

### `Drupal.Functions.MultiLineFunctionDeclaration`

| Codes | Handled by |
| --- | --- |
| `BraceOnNewLine`, `CloseBracketLine`, `ContentAfterBrace`, `FirstParamSpacing`, `Indent`, `MissingTrailingComma`, `NewlineBeforeOpenBrace`, `OneParamPerLine`, `SpaceAfterFunction`, `SpaceAfterUse`, `SpaceBeforeBrace`, `SpaceBeforeOpenBrace`, `SpaceBeforeOpenParen`, `SpaceBeforeSemicolon`, `SpaceBeforeUse`, `UseCloseBracketLine` | `mago format` |
| `EmptyLine` | [`drupal/parameter-blank-line`](<https://project.pages.drupalcode.org/mago/rules/statements/index.md#drupalparameter-blank-line>) |

## InfoFiles

| Sniff | Handled by |
| --- | --- |
| [`Drupal.InfoFiles.AutoAddedKeys`](<#drupalinfofilesautoaddedkeys>) | [`drupal/info-auto-added-keys`](<https://project.pages.drupalcode.org/mago/rules/info-and-routing-files/index.md#drupalinfo-auto-added-keys>) |
| [`Drupal.InfoFiles.ClassFiles`](<#drupalinfofilesclassfiles>) | phpcs |
| `Drupal.InfoFiles.DependenciesArray` | [`drupal/info-dependencies-array`](<https://project.pages.drupalcode.org/mago/rules/info-and-routing-files/index.md#drupalinfo-dependencies-array>) |
| [`Drupal.InfoFiles.DuplicateEntry`](<#drupalinfofilesduplicateentry>) | phpcs |
| [`Drupal.InfoFiles.Required`](<#drupalinfofilesrequired>) | phpcs |

### `Drupal.InfoFiles.AutoAddedKeys`

The rule doesn't report the keys below the comment of the drupal.org packaging script. Coder reports them, so it reports every module installed by Composer. The rule reads `.info.yml` files only, and the same keys in a Drupal 7 `.info` file need phpcs. Both tools skip the `version` key of a file under a `core` directory. Coder looks for `/core/` in the absolute path, and the rule in the path from the workspace.

### `Drupal.InfoFiles.ClassFiles`

Checks the `files[]` lines of a Drupal 7 `.info` file, which phpcs reads only when its extensions include `info`. It doesn't read `.info.yml` files.

### `Drupal.InfoFiles.DuplicateEntry`

Checks a Drupal 7 `.info` file, which phpcs reads only when its extensions include `info`. It doesn't read `.info.yml` files.

### `Drupal.InfoFiles.Required`

Checks a Drupal 7 `.info` file, which phpcs reads only when its extensions include `info`. It doesn't read `.info.yml` files.

## NamingConventions

| Sniff | Handled by |
| --- | --- |
| [`Drupal.NamingConventions.ValidClassName`](<#drupalnamingconventionsvalidclassname>) | Mago `class-name`, Mago `interface-name`, Mago `trait-name`, Mago `enum-name`, [`drupal/class-name-acronym`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalclass-name-acronym>) |
| `Drupal.NamingConventions.ValidEnumCase` | [`drupal/enum-case-name`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalenum-case-name>) |
| [`Drupal.NamingConventions.ValidFunctionName`](<#drupalnamingconventionsvalidfunctionname>) | [`drupal/function-name`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalfunction-name>), [`drupal/function-prefix`](<https://project.pages.drupalcode.org/mago/rules/procedural-files/index.md#drupalfunction-prefix>), [`drupal/method-name-underscore`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalmethod-name-underscore>), [`drupal/method-name`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalmethod-name>) |
| `Drupal.NamingConventions.ValidGlobal` | [`drupal/global-variable`](<https://project.pages.drupalcode.org/mago/rules/procedural-files/index.md#drupalglobal-variable>) |
| [`Drupal.NamingConventions.ValidVariableName`](<#drupalnamingconventionsvalidvariablename>) | [`drupal/property-name`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalproperty-name>), [`drupal/variable-name`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalvariable-name>) |

### `Drupal.NamingConventions.ValidClassName`

| Codes | Handled by |
| --- | --- |
| `NoUnderscores`, `StartWithCapital` | Mago `class-name`, Mago `interface-name`, Mago `trait-name`, Mago `enum-name` |
| `NoUpperAcronyms` | [`drupal/class-name-acronym`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalclass-name-acronym>) |

### `Drupal.NamingConventions.ValidFunctionName`

Core doesn't run the sniff.

| Codes | Handled by |
| --- | --- |
| `InvalidName` | [`drupal/function-name`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalfunction-name>) |
| `InvalidPrefix` | [`drupal/function-prefix`](<https://project.pages.drupalcode.org/mago/rules/procedural-files/index.md#drupalfunction-prefix>) |
| `MethodDoubleUnderscore` | [`drupal/method-name-underscore`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalmethod-name-underscore>) |
| `NotCamelCaps`, `ScopeNotCamelCaps` | [`drupal/method-name`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalmethod-name>) |

### `Drupal.NamingConventions.ValidVariableName`

| Codes | Handled by |
| --- | --- |
| `LowerCamelName` | [`drupal/property-name`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalproperty-name>) |
| `LowerStart` | [`drupal/variable-name`](<https://project.pages.drupalcode.org/mago/rules/naming-and-imports/index.md#drupalvariable-name>) |

## Scope

| Sniff | Handled by |
| --- | --- |
| `Drupal.Scope.MethodScope` | [`drupal/method-visibility`](<https://project.pages.drupalcode.org/mago/rules/statements/index.md#drupalmethod-visibility>) |

## Semantics

| Sniff | Handled by |
| --- | --- |
| [`Drupal.Semantics.ConstantName`](<#drupalsemanticsconstantname>) | [`drupal/const-prefix`](<https://project.pages.drupalcode.org/mago/rules/procedural-files/index.md#drupalconst-prefix>), [`drupal/constant-prefix`](<https://project.pages.drupalcode.org/mago/rules/procedural-files/index.md#drupalconstant-prefix>) |
| `Drupal.Semantics.EmptyInstall` | [`drupal/empty-install-hook`](<https://project.pages.drupalcode.org/mago/rules/procedural-files/index.md#drupalempty-install-hook>) |
| [`Drupal.Semantics.FunctionAlias`](<#drupalsemanticsfunctionalias>) | Mago `no-alias-function` |
| [`Drupal.Semantics.FunctionT`](<#drupalsemanticsfunctiont>) | [`drupal/translatable-string`](<https://project.pages.drupalcode.org/mago/rules/right-api/index.md#drupaltranslatable-string>), `mago format`, [`drupal/translatable-literal`](<https://project.pages.drupalcode.org/mago/rules/right-api/index.md#drupaltranslatable-literal>) |
| `Drupal.Semantics.FunctionTriggerError` | [`drupal/deprecation-message`](<https://project.pages.drupalcode.org/mago/rules/right-api/index.md#drupaldeprecation-message>) |
| `Drupal.Semantics.FunctionWatchdog` | [`drupal/watchdog-message`](<https://project.pages.drupalcode.org/mago/rules/drupal-7/index.md#drupalwatchdog-message>) |
| `Drupal.Semantics.InstallHooks` | [`drupal/install-hook-location`](<https://project.pages.drupalcode.org/mago/rules/procedural-files/index.md#drupalinstall-hook-location>) |
| `Drupal.Semantics.LStringTranslatable` | [`drupal/link-text-translatable`](<https://project.pages.drupalcode.org/mago/rules/drupal-7/index.md#drupallink-text-translatable>) |
| `Drupal.Semantics.PregSecurity` | [`drupal/preg-security`](<https://project.pages.drupalcode.org/mago/rules/bugs-and-security/index.md#drupalpreg-security>) |
| `Drupal.Semantics.RemoteAddress` | [`drupal/remote-address`](<https://project.pages.drupalcode.org/mago/rules/bugs-and-security/index.md#drupalremote-address>) |
| [`Drupal.Semantics.TInHookMenu`](<#drupalsemanticstinhookmenu>) | [`drupal/t-in-hook-menu`](<https://project.pages.drupalcode.org/mago/rules/drupal-7/index.md#drupalt-in-hook-menu>) |
| [`Drupal.Semantics.TInHookSchema`](<#drupalsemanticstinhookschema>) | [`drupal/t-in-hook-schema`](<https://project.pages.drupalcode.org/mago/rules/procedural-files/index.md#drupalt-in-hook-schema>) |
| `Drupal.Semantics.UnsilencedDeprecation` | [`drupal/unsilenced-deprecation`](<https://project.pages.drupalcode.org/mago/rules/right-api/index.md#drupalunsilenced-deprecation>) |

### `Drupal.Semantics.ConstantName`

| Codes | Handled by |
| --- | --- |
| `ConstConstantStart` | [`drupal/const-prefix`](<https://project.pages.drupalcode.org/mago/rules/procedural-files/index.md#drupalconst-prefix>) |
| `ConstantStart` | [`drupal/constant-prefix`](<https://project.pages.drupalcode.org/mago/rules/procedural-files/index.md#drupalconstant-prefix>) |

### `Drupal.Semantics.FunctionAlias`

Mago's rule, on by default, with a fix that needs `--potentially-unsafe`. Its list of aliases doesn't have `gzputs()`, `_()` and `pg_clientencoding()`, which Coder reports.

### `Drupal.Semantics.FunctionT`

| Codes | Handled by |
| --- | --- |
| `BackslashDoubleQuote` | [`drupal/translatable-string`](<https://project.pages.drupalcode.org/mago/rules/right-api/index.md#drupaltranslatable-string>), `mago format` |
| `BackslashSingleQuote`, `Concat`, `EmptyString`, `EmptyT`, `WhiteSpace` | [`drupal/translatable-string`](<https://project.pages.drupalcode.org/mago/rules/right-api/index.md#drupaltranslatable-string>) |
| `ConcatString`, `NotLiteralString` | [`drupal/translatable-literal`](<https://project.pages.drupalcode.org/mago/rules/right-api/index.md#drupaltranslatable-literal>) |

### `Drupal.Semantics.TInHookMenu`

Coder also reports `$this->t()`, which the rule skips. The rule also reports `\t()`, which Coder skips.

### `Drupal.Semantics.TInHookSchema`

Coder also reports `$this->t()`, which the rule skips. The rule also reports `\t()`, which Coder skips.

## WhiteSpace

| Sniff | Handled by |
| --- | --- |
| [`Drupal.WhiteSpace.CloseBracketSpacing`](<#drupalwhitespaceclosebracketspacing>) | `mago format`, partly |
| `Drupal.WhiteSpace.Comma` | `mago format` |
| `Drupal.WhiteSpace.EmptyLines` | `mago format` |
| `Drupal.WhiteSpace.ObjectOperatorIndent` | `mago format` |
| `Drupal.WhiteSpace.ObjectOperatorSpacing` | `mago format` |
| [`Drupal.WhiteSpace.OpenBracketSpacing`](<#drupalwhitespaceopenbracketspacing>) | `mago format`, partly |
| `Drupal.WhiteSpace.OpenTagNewline` | `mago format` |
| [`Drupal.WhiteSpace.ScopeClosingBrace`](<#drupalwhitespacescopeclosingbrace>) | `mago format`, partly |
| [`Drupal.WhiteSpace.ScopeIndent`](<#drupalwhitespacescopeindent>) | `mago format`, partly |

### `Drupal.WhiteSpace.CloseBracketSpacing`

The formatter writes `<?php }` for a closing brace after inline HTML, and Coder reports the space. Coder also reports the `match` with one arm that the formatter writes on one line, and the space that the formatter keeps before `)` in a parameter list that holds only a comment, as in `function f( /* $x */ )`.

### `Drupal.WhiteSpace.OpenBracketSpacing`

The formatter keeps a space between an opening bracket and a comment that follows it, as in `foo( /* note */ $x)`, and Coder reports that space. Coder also reports the `match` with one arm that the formatter writes on one line, and the space it writes after `(` in a parameter or argument list that holds only a comment, as in `f( /* $x */ )`.

### `Drupal.WhiteSpace.ScopeClosingBrace`

| Codes | Handled by |
| --- | --- |
| `BreakIndent` | `mago format` |
| `Indent`, `Line` | `mago format`, partly |

- `Indent`: A closing brace after inline HTML, on a `<?php }` line, keeps the indent of the HTML. The formatter doesn't change it, and Coder reports it.
- `Line`: The formatter writes a `match` with one arm on one line, and Coder reports its closing brace.

### `Drupal.WhiteSpace.ScopeIndent`

The formatter writes the indentation.

| Codes | Handled by |
| --- | --- |
| `Incorrect` | `mago format` |
| `IncorrectExact` | `mago format`, partly |

- `IncorrectExact`: The formatter gives a comment between a `break`, `return` or `throw` and the next `case` the indent of the case body. Coder wants the indent of the `case` label there, and reports it. The formatter also indents a `break` after a `return` in the same case, which the analyzer reports as `useless-control-flow`. It writes an anonymous class with attributes with a line break after `new` and the body one more level in. Coder reports the body's indent, and the line break as `LanguageConstructSpacing.IncorrectSingle`.
