Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MultiLineFunctionDeclarationSniff.php

function MultiLineFunctionDeclarationSniff::processSingleLineDeclaration

Same name in this branch
  1. 11.1.x vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Functions/MultiLineFunctionDeclarationSniff.php \PHP_CodeSniffer\Standards\Squiz\Sniffs\Functions\MultiLineFunctionDeclarationSniff::processSingleLineDeclaration()

Processes single-line declarations.

Just uses the Generic Kernighan Ritchie sniff.

Parameters

\PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.:

int $stackPtr The position of the current token: in the stack passed in $tokens.

array<int, array<string, mixed>> $tokens The stack of tokens that make up: the file.

Return value

void

Overrides MultiLineFunctionDeclarationSniff::processSingleLineDeclaration

File

vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Functions/MultiLineFunctionDeclarationSniff.php, line 51

Class

MultiLineFunctionDeclarationSniff
Multi-line function declarations need to have a trailing comma on the last parameter. Modified from Squiz, whenever there is a function declaration closing parenthesis on a new line we treat it as multi-line.

Namespace

Drupal\Sniffs\Functions

Code

public function processSingleLineDeclaration($phpcsFile, $stackPtr, $tokens) {
    $sniff = new OpeningFunctionBraceKernighanRitchieSniff();
    $sniff->checkClosures = true;
    $sniff->process($phpcsFile, $stackPtr);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal