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

Breadcrumb

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

function SingleLineArrayWhitespaceSniff::checkWhitespaceInEmptyArray

1 call to SingleLineArrayWhitespaceSniff::checkWhitespaceInEmptyArray()
SingleLineArrayWhitespaceSniff::process in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Arrays/SingleLineArrayWhitespaceSniff.php
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Arrays/SingleLineArrayWhitespaceSniff.php, line 104

Class

SingleLineArrayWhitespaceSniff

Namespace

SlevomatCodingStandard\Sniffs\Arrays

Code

private function checkWhitespaceInEmptyArray(File $phpcsFile, int $arrayStart, int $arrayEnd) : void {
    if ($arrayEnd - $arrayStart === 1) {
        return;
    }
    $error = 'Empty array declaration must have no space between the parentheses.';
    $fix = $phpcsFile->addFixableError($error, $arrayStart, self::CODE_SPACE_IN_EMPTY_ARRAY);
    if (!$fix) {
        return;
    }
    $phpcsFile->fixer
        ->replaceToken($arrayStart + 1, '');
}

API Navigation

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