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

Breadcrumb

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

function LoadIncludeBase::parseLoadIncludeArgs

2 calls to LoadIncludeBase::parseLoadIncludeArgs()
LoadIncludes::processNode in vendor/mglaman/phpstan-drupal/src/Rules/Drupal/LoadIncludes.php
ModuleLoadInclude::processNode in vendor/mglaman/phpstan-drupal/src/Rules/Drupal/ModuleLoadInclude.php

File

vendor/mglaman/phpstan-drupal/src/Rules/Drupal/LoadIncludeBase.php, line 38

Class

LoadIncludeBase
@template TNodeType of Node @implements Rule<TNodeType>

Namespace

mglaman\PHPStanDrupal\Rules\Drupal

Code

protected function parseLoadIncludeArgs(Node\Arg $module, Node\Arg $type, ?Node\Arg $name, Scope $scope) : array {
    $moduleName = $this->getStringArgValue($module->value, $scope);
    if ($moduleName === null) {
        return [
            false,
            false,
        ];
    }
    $fileType = $this->getStringArgValue($type->value, $scope);
    if ($fileType === null) {
        return [
            false,
            false,
        ];
    }
    $baseName = null;
    if ($name !== null) {
        $baseName = $this->getStringArgValue($name->value, $scope);
        if ($baseName === null) {
            return [
                false,
                false,
            ];
        }
    }
    if ($baseName === null) {
        $baseName = $moduleName;
    }
    return [
        $moduleName,
        "{$baseName}.{$fileType}",
    ];
}

API Navigation

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