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

Breadcrumb

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

class ParameterHelper

@internal

Hierarchy

  • class \SlevomatCodingStandard\Helpers\ParameterHelper

Expanded class hierarchy of ParameterHelper

3 files declare their use of ParameterHelper
DuplicateSpacesSniff.php in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Whitespaces/DuplicateSpacesSniff.php
RequireNonCapturingCatchSniff.php in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Exceptions/RequireNonCapturingCatchSniff.php
UnusedVariableSniff.php in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Variables/UnusedVariableSniff.php

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/ParameterHelper.php, line 14

Namespace

SlevomatCodingStandard\Helpers
View source
class ParameterHelper {
    public static function isParameter(File $phpcsFile, int $variablePointer) : bool {
        $tokens = $phpcsFile->getTokens();
        if (!array_key_exists('nested_parenthesis', $tokens[$variablePointer])) {
            return false;
        }
        $parenthesisOpenerPointer = array_reverse(array_keys($tokens[$variablePointer]['nested_parenthesis']))[0];
        if (!array_key_exists('parenthesis_owner', $tokens[$parenthesisOpenerPointer])) {
            return false;
        }
        $parenthesisOwnerPointer = $tokens[$parenthesisOpenerPointer]['parenthesis_owner'];
        return in_array($tokens[$parenthesisOwnerPointer]['code'], TokenHelper::$functionTokenCodes, true);
    }

}

Members

Title Sort descending Modifiers Object type Summary
ParameterHelper::isParameter public static function
RSS feed
Powered by Drupal