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

Breadcrumb

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

function FunctionDeclarationSniff::processSingleLineDeclaration

Processes single-line declarations.

Just uses the Generic BSD-Allman brace 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 $tokens The stack of tokens that make up: the file.

Return value

void

3 calls to FunctionDeclarationSniff::processSingleLineDeclaration()
FunctionDeclarationSniff::process in vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/Functions/FunctionDeclarationSniff.php
Processes this test, when one of its tokens is encountered.
MultiLineFunctionDeclarationSniff::processSingleLineDeclaration in vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Functions/MultiLineFunctionDeclarationSniff.php
Processes single-line declarations.
MultiLineFunctionDeclarationSniff::processSingleLineDeclaration in vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Functions/MultiLineFunctionDeclarationSniff.php
Processes single-line declarations.
1 method overrides FunctionDeclarationSniff::processSingleLineDeclaration()
MultiLineFunctionDeclarationSniff::processSingleLineDeclaration in vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Functions/MultiLineFunctionDeclarationSniff.php
Processes single-line declarations.

File

vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/Functions/FunctionDeclarationSniff.php, line 261

Class

FunctionDeclarationSniff

Namespace

PHP_CodeSniffer\Standards\PEAR\Sniffs\Functions

Code

public function processSingleLineDeclaration($phpcsFile, $stackPtr, $tokens) {
    if ($tokens[$stackPtr]['code'] === T_CLOSURE) {
        $sniff = new OpeningFunctionBraceKernighanRitchieSniff();
    }
    else {
        $sniff = new OpeningFunctionBraceBsdAllmanSniff();
    }
    $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