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

Breadcrumb

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

function Reflection::sourceLocationFor

@psalm-param class-string $className @psalm-param non-empty-string $methodName

@psalm-return array{file: non-empty-string, line: non-negative-int}

2 calls to Reflection::sourceLocationFor()
DataProvider::valueObjectForTestMethodWithoutTestData in vendor/phpunit/phpunit/src/Metadata/Api/DataProvider.php
@psalm-param class-string $className @psalm-param non-empty-string $methodName
TestMethodBuilder::fromTestCase in vendor/phpunit/phpunit/src/Event/Value/Test/TestMethodBuilder.php

File

vendor/phpunit/phpunit/src/Util/Reflection.php, line 34

Class

Reflection
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit

Namespace

PHPUnit\Util

Code

public static function sourceLocationFor(string $className, string $methodName) : array {
    try {
        $reflector = new ReflectionMethod($className, $methodName);
        $file = $reflector->getFileName();
        $line = $reflector->getStartLine();
    } catch (ReflectionException) {
        $file = 'unknown';
        $line = 0;
    }
    return [
        'file' => $file,
        'line' => $line,
    ];
}
RSS feed
Powered by Drupal