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

Breadcrumb

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

function DisallowPartiallyKeyedSniff::process

* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *

Parameters

int $stackPointer:

Overrides Sniff::process

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Arrays/DisallowPartiallyKeyedSniff.php, line 27

Class

DisallowPartiallyKeyedSniff

Namespace

SlevomatCodingStandard\Sniffs\Arrays

Code

public function process(File $phpcsFile, $stackPointer) : void {
    $keyValues = ArrayHelper::parse($phpcsFile, $stackPointer);
    if (!ArrayHelper::isKeyed($keyValues)) {
        return;
    }
    if (ArrayHelper::isKeyedAll($keyValues)) {
        return;
    }
    $phpcsFile->addError('Partially keyed array disallowed.', $stackPointer, self::CODE_DISALLOWED_PARTIALLY_KEYED);
}
RSS feed
Powered by Drupal