Skip to content

Commit 76e31b7

Browse files
committed
ReferenceUsedNamesOnlySniff: More tests
1 parent f8e8d4d commit 76e31b7

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

tests/Sniffs/Namespaces/ReferenceUsedNamesOnlySniffTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,22 @@ public function testCollidingClassNameDifferentNamespacesMoreClassesDisallowed()
733733
self::assertSniffError($report, 14, ReferenceUsedNamesOnlySniff::CODE_REFERENCE_VIA_FULLY_QUALIFIED_NAME);
734734
}
735735

736+
public function testFixableWhenCollidingClassNames(): void
737+
{
738+
$report = self::checkFile(
739+
__DIR__ . '/data/fixableWhenCollidingClassNames.php',
740+
[
741+
'searchAnnotations' => true,
742+
'allowFullyQualifiedNameForCollidingClasses' => true,
743+
'allowFullyQualifiedGlobalClasses' => true,
744+
'allowFullyQualifiedGlobalFunctions' => true,
745+
'allowFullyQualifiedGlobalConstants' => true,
746+
]
747+
);
748+
749+
self::assertAllFixedInFile($report);
750+
}
751+
736752
public function testCollidingClassNameExtendsAllowed(): void
737753
{
738754
$report = self::checkFile(
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace App\Controller\Common;
4+
use App\Process\UserClient\Edit;
5+
6+
abstract class AbstractUserEditController
7+
{
8+
9+
/**
10+
* @var Edit|\App\Process\UserSuperAdmin\Edit
11+
*/
12+
protected $edit;
13+
14+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace App\Controller\Common;
4+
5+
abstract class AbstractUserEditController
6+
{
7+
8+
/**
9+
* @var \App\Process\UserClient\Edit|\App\Process\UserSuperAdmin\Edit
10+
*/
11+
protected $edit;
12+
13+
}

0 commit comments

Comments
 (0)