Skip to content

Commit

Permalink
Enhancement: Use static::class instead of get_class($this)
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz authored and sebastianbergmann committed Oct 30, 2020
1 parent 638cc6e commit 4d5ec15
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ public function setGroups(array $groups): void
public function getAnnotations(): array
{
return TestUtil::parseTestMethodAnnotations(
\get_class($this),
static::class,
$this->name
);
}
Expand Down Expand Up @@ -865,7 +865,7 @@ public function getName(bool $withDataSet = true): string
public function getSize(): int
{
return TestUtil::getSize(
\get_class($this),
static::class,
$this->getName(false)
);
}
Expand Down Expand Up @@ -1010,7 +1010,7 @@ public function runBare(): void
\clearstatcache();
$currentWorkingDirectory = \getcwd();

$hookMethods = TestUtil::getHookMethods(\get_class($this));
$hookMethods = TestUtil::getHookMethods(static::class);

$hasMetRequirements = false;

Expand Down Expand Up @@ -1920,7 +1920,7 @@ private function setExpectedExceptionFromAnnotation(): void

try {
$expectedException = TestUtil::getExpectedException(
\get_class($this),
static::class,
$this->name
);

Expand Down Expand Up @@ -1955,7 +1955,7 @@ private function checkRequirements(): void
}

$missingRequirements = TestUtil::getMissingRequirements(
\get_class($this),
static::class,
$this->name
);

Expand Down Expand Up @@ -1999,7 +1999,6 @@ private function verifyMockObjects(): void
private function handleDependencies(): bool
{
if (!empty($this->dependencies) && !$this->inIsolation) {
$className = \get_class($this);
$passed = $this->result->passed();
$passedKeys = \array_keys($passed);

Expand Down Expand Up @@ -2040,7 +2039,7 @@ private function handleDependencies(): bool
}

if (\strpos($dependency, '::') === false) {
$dependency = $className . '::' . $dependency;
$dependency = static::class . '::' . $dependency;
}

if (!isset($passedKeys[$dependency])) {
Expand Down

0 comments on commit 4d5ec15

Please sign in to comment.