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

Breadcrumb

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

class NamespaceCheck

@internal

Hierarchy

  • class \mglaman\PHPStanDrupal\Internal\NamespaceCheck

Expanded class hierarchy of NamespaceCheck

1 file declares its use of NamespaceCheck
ClassExtendsInternalClassRule.php in vendor/mglaman/phpstan-drupal/src/Rules/Classes/ClassExtendsInternalClassRule.php

File

vendor/mglaman/phpstan-drupal/src/Internal/NamespaceCheck.php, line 10

Namespace

mglaman\PHPStanDrupal\Internal
View source
final class NamespaceCheck {
    public static function isDrupalNamespace(Class_ $class) : bool {
        if (!isset($class->namespacedName)) {
            return false;
        }
        return 'Drupal' === (string) $class->namespacedName
            ->slice(0, 1);
    }
    public static function isSharedNamespace(Class_ $class) : bool {
        if (!isset($class->extends)) {
            return false;
        }
        if (!isset($class->namespacedName)) {
            return false;
        }
        if (!self::isDrupalNamespace($class)) {
            return false;
        }
        return (string) $class->namespacedName
            ->slice(0, 2) === (string) $class->extends
            ->slice(0, 2);
    }

}

Members

Title Sort descending Modifiers Object type Summary
NamespaceCheck::isDrupalNamespace public static function
NamespaceCheck::isSharedNamespace public static function

API Navigation

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