|
4 | 4 |
|
5 | 5 | use PhpParser\Node\Stmt\ClassLike;
|
6 | 6 | use PHPStan\Analyser\NameScope;
|
| 7 | +use PHPStan\Analyser\Scope; |
7 | 8 | use PHPStan\Internal\SprintfHelper;
|
8 | 9 | use PHPStan\PhpDoc\TypeNodeResolver;
|
9 | 10 | use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
10 | 11 | use PHPStan\Reflection\ClassReflection;
|
11 | 12 | use PHPStan\Reflection\ReflectionProvider;
|
12 | 13 | use PHPStan\Rules\ClassNameCheck;
|
13 | 14 | use PHPStan\Rules\ClassNameNodePair;
|
| 15 | +use PHPStan\Rules\ClassNameUsageLocation; |
14 | 16 | use PHPStan\Rules\Generics\GenericObjectTypeCheck;
|
15 | 17 | use PHPStan\Rules\IdentifierRuleError;
|
16 | 18 | use PHPStan\Rules\MissingTypehintCheck;
|
@@ -51,13 +53,13 @@ public function __construct(
|
51 | 53 | /**
|
52 | 54 | * @return list<IdentifierRuleError>
|
53 | 55 | */
|
54 |
| - public function check(ClassReflection $reflection, ClassLike $node): array |
| 56 | + public function check(Scope $scope, ClassReflection $reflection, ClassLike $node): array |
55 | 57 | {
|
56 | 58 | $errors = [];
|
57 | 59 | foreach ($this->checkInTraitDefinitionContext($reflection) as $error) {
|
58 | 60 | $errors[] = $error;
|
59 | 61 | }
|
60 |
| - foreach ($this->checkInTraitUseContext($reflection, $reflection, $node) as $error) { |
| 62 | + foreach ($this->checkInTraitUseContext($scope, $reflection, $reflection, $node) as $error) { |
61 | 63 | $errors[] = $error;
|
62 | 64 | }
|
63 | 65 |
|
@@ -230,6 +232,7 @@ public function checkInTraitDefinitionContext(ClassReflection $reflection): arra
|
230 | 232 | * @return list<IdentifierRuleError>
|
231 | 233 | */
|
232 | 234 | public function checkInTraitUseContext(
|
| 235 | + Scope $scope, |
233 | 236 | ClassReflection $reflection,
|
234 | 237 | ClassReflection $implementingClassReflection,
|
235 | 238 | ClassLike $node,
|
@@ -270,9 +273,9 @@ public function checkInTraitUseContext(
|
270 | 273 | } else {
|
271 | 274 | $errors = array_merge(
|
272 | 275 | $errors,
|
273 |
| - $this->classCheck->checkClassNames([ |
| 276 | + $this->classCheck->checkClassNames($scope, [ |
274 | 277 | new ClassNameNodePair($class, $node),
|
275 |
| - ], $this->checkClassCaseSensitivity), |
| 278 | + ], ClassNameUsageLocation::from(ClassNameUsageLocation::TYPE_ALIAS), $this->checkClassCaseSensitivity), |
276 | 279 | );
|
277 | 280 | }
|
278 | 281 | }
|
|
0 commit comments