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

Breadcrumb

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

function Helpers::areAnyConditionsAClass

*

Parameters

array{conditions: (int|string)[], content: string} $token: * * @return bool

2 calls to Helpers::areAnyConditionsAClass()
VariableAnalysisSniff::processVariableAsClassProperty in vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php
* Process a class property that is being defined. * * Property definitions are ignored currently because all property access is * legal, even to undefined properties. * * Can be called for any token and will return false if the variable is…
VariableAnalysisSniff::processVariableAsStaticOutsideClass in vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php
*

File

vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Lib/Helpers.php, line 109

Class

Helpers

Namespace

VariableAnalysis\Lib

Code

public static function areAnyConditionsAClass(array $token) {
    $conditions = $token['conditions'];
    $classlikeCodes = [
        T_CLASS,
        T_ANON_CLASS,
        T_TRAIT,
    ];
    if (defined('T_ENUM')) {
        $classlikeCodes[] = T_ENUM;
    }
    $classlikeCodes[] = 'PHPCS_T_ENUM';
    foreach (array_reverse($conditions, true) as $scopeCode) {
        if (in_array($scopeCode, $classlikeCodes, true)) {
            return true;
        }
    }
    return false;
}

API Navigation

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