Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/StaticAnalysis/CodeUnitFindingVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
namespace SebastianBergmann\CodeCoverage\StaticAnalysis;

use function implode;
use function str_replace;
use function trim;
use PhpParser\Node;
use PhpParser\Node\Identifier;
Expand Down Expand Up @@ -285,13 +284,6 @@ private function processFunction(Function_ $node): void

private function namespace(string $namespacedName, string $name): string
{
return trim(
str_replace(
$name,
'',
$namespacedName
),
'\\'
);
return trim(rtrim($namespacedName, $name), '\\');
}
}
2 changes: 1 addition & 1 deletion tests/_files/ClassThatUsesAnonymousClass.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php declare(strict_types=1);
namespace SebastianBergmann\CodeCoverage\TestFixture;
namespace SebastianBergmann\CodeCoverage\ClassThatUsesAnonymousClass\TestFixture;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid changing existing test fixture.


final class ClassThatUsesAnonymousClass
{
Expand Down
4 changes: 2 additions & 2 deletions tests/tests/StaticAnalysis/CodeUnitFindingVisitorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use PhpParser\NodeVisitor\ParentConnectingVisitor;
use PhpParser\ParserFactory;
use PHPUnit\Framework\TestCase;
use SebastianBergmann\CodeCoverage\TestFixture\ClassThatUsesAnonymousClass;
use SebastianBergmann\CodeCoverage\ClassThatUsesAnonymousClass\TestFixture\ClassThatUsesAnonymousClass;

/**
* @covers \SebastianBergmann\CodeCoverage\StaticAnalysis\CodeUnitFindingVisitor
Expand Down Expand Up @@ -55,7 +55,7 @@ public function testDoesNotFindAnonymousClass(): void

$this->assertSame('ClassThatUsesAnonymousClass', $class['name']);
$this->assertSame(ClassThatUsesAnonymousClass::class, $class['namespacedName']);
$this->assertSame('SebastianBergmann\CodeCoverage\TestFixture', $class['namespace']);
$this->assertSame('SebastianBergmann\CodeCoverage\ClassThatUsesAnonymousClass\TestFixture', $class['namespace']);
$this->assertSame(4, $class['startLine']);
$this->assertSame(17, $class['endLine']);

Expand Down