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

Breadcrumb

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

class DisallowNamedArgumentsSniff

Hierarchy

  • class \SlevomatCodingStandard\Sniffs\Functions\DisallowNamedArgumentsSniff implements \PHP_CodeSniffer\Sniffs\Sniff

Expanded class hierarchy of DisallowNamedArgumentsSniff

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Functions/DisallowNamedArgumentsSniff.php, line 10

Namespace

SlevomatCodingStandard\Sniffs\Functions
View source
class DisallowNamedArgumentsSniff implements Sniff {
    public const CODE_DISALLOWED_NAMED_ARGUMENT = 'DisallowedNamedArgument';
    
    /**
     * @return array<int, (int|string)>
     */
    public function register() : array {
        return [
            T_PARAM_NAME,
        ];
    }
    
    /**
     * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
     * @param int $argumentNamePointer
     */
    public function process(File $phpcsFile, $argumentNamePointer) : void {
        $tokens = $phpcsFile->getTokens();
        $phpcsFile->addError(sprintf('Named arguments are disallowed, usage of named argument "%s" found.', $tokens[$argumentNamePointer]['content']), $argumentNamePointer, self::CODE_DISALLOWED_NAMED_ARGUMENT);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
DisallowNamedArgumentsSniff::CODE_DISALLOWED_NAMED_ARGUMENT public constant
DisallowNamedArgumentsSniff::process public function * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
*
Overrides Sniff::process
DisallowNamedArgumentsSniff::register public function * Overrides Sniff::register

API Navigation

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