Skip to content

Commit

Permalink
Merge pull request #237 from ergebnis/fix/class-string
Browse files Browse the repository at this point in the history
Fix: DocBlock
  • Loading branch information
ergebnis-bot committed Nov 1, 2020
2 parents 6e5c42d + 2cd7fc7 commit fce058a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/Unit/RuleSet/AbstractRuleSetTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ final public function provideSourceAndRuleNames(): \Generator
}

/**
* @phpstan-return class-string
*
* @psalm-return class-string
*
* @throws \RuntimeException
*/
final protected static function className(): string
Expand All @@ -194,6 +198,14 @@ final protected static function className(): string
));
}

if (!\class_exists($className)) {
throw new \RuntimeException(\sprintf(
'Class name "%s" resolved from test class name "%s" does not reference a class that exists.',
$className,
static::class
));
}

return $className;
}

Expand All @@ -202,7 +214,6 @@ final protected static function className(): string
*/
final protected static function createRuleSet(?string $header = null): Config\RuleSet
{
/** @var class-string $className */
$className = self::className();

$reflection = new \ReflectionClass($className);
Expand Down

0 comments on commit fce058a

Please sign in to comment.