Skip to content

Commit 9f62bbb

Browse files
committed
Rebase fixes
1 parent 7d8174d commit 9f62bbb

File tree

5 files changed

+36
-10
lines changed

5 files changed

+36
-10
lines changed

src/Graph/EnumCaseRef.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ public function __construct(
2222
parent::__construct($className, $enumCaseName, $possibleDescendant);
2323
}
2424

25-
public static function buildKey(string $typeName, string $memberName): string
25+
public static function buildKey(
26+
string $typeName,
27+
string $memberName
28+
): string
2629
{
2730
return 'e/' . $typeName . '::' . $memberName;
2831
}

src/Provider/DoctrineUsageProvider.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ public function getUsages(
6060
/**
6161
* @return list<ClassMemberUsage>
6262
*/
63-
private function getUsagesFromReflection(InClassNode $node, Scope $scope): array
63+
private function getUsagesFromReflection(
64+
InClassNode $node,
65+
Scope $scope
66+
): array
6467
{
6568
$classReflection = $node->getClassReflection();
6669
$nativeReflection = $classReflection->getNativeReflection();
@@ -260,7 +263,11 @@ private function createMethodUsage(
260263
/**
261264
* @return list<EnumCaseUsage>
262265
*/
263-
private function getUsagesOfEnumColumn(string $className, string $propertyName, ExtendedPropertyReflection $property): array
266+
private function getUsagesOfEnumColumn(
267+
string $className,
268+
string $propertyName,
269+
ExtendedPropertyReflection $property
270+
): array
264271
{
265272
$usages = [];
266273

src/Provider/EnumUsageProvider.php

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ public function __construct(bool $enabled)
3131
$this->enabled = $enabled;
3232
}
3333

34-
public function getUsages(Node $node, Scope $scope): array
34+
public function getUsages(
35+
Node $node,
36+
Scope $scope
37+
): array
3538
{
3639
if ($this->enabled === false) {
3740
return [];
@@ -47,7 +50,10 @@ public function getUsages(Node $node, Scope $scope): array
4750
/**
4851
* @return list<EnumCaseUsage>
4952
*/
50-
private function getTryFromUsages(StaticCall $staticCall, Scope $scope): array
53+
private function getTryFromUsages(
54+
StaticCall $staticCall,
55+
Scope $scope
56+
): array
5157
{
5258
$methodNames = $this->getMethodNames($staticCall, $scope);
5359
$firstArgType = $this->getArgType($staticCall, $scope, 0);
@@ -75,7 +81,7 @@ private function getTryFromUsages(StaticCall $staticCall, Scope $scope): array
7581
$valueToCaseMapping = $this->getValueToEnumCaseMapping($classReflection->getNativeReflection());
7682
$triedValues = $firstArgType->getConstantScalarValues() === []
7783
? [null]
78-
: array_filter($firstArgType->getConstantScalarValues(), static fn($value): bool => is_string($value) || is_int($value));
84+
: array_filter($firstArgType->getConstantScalarValues(), static fn ($value): bool => is_string($value) || is_int($value));
7985

8086
foreach ($triedValues as $value) {
8187
$enumCase = $value === null ? null : $valueToCaseMapping[$value] ?? null;
@@ -93,7 +99,10 @@ private function getTryFromUsages(StaticCall $staticCall, Scope $scope): array
9399
/**
94100
* @return list<string|null>
95101
*/
96-
private function getMethodNames(StaticCall $call, Scope $scope): array
102+
private function getMethodNames(
103+
StaticCall $call,
104+
Scope $scope
105+
): array
97106
{
98107
if ($call->name instanceof Expr) {
99108
$possibleMethodNames = [];
@@ -110,7 +119,11 @@ private function getMethodNames(StaticCall $call, Scope $scope): array
110119
return [$call->name->name];
111120
}
112121

113-
private function getArgType(StaticCall $staticCall, Scope $scope, int $position): Type
122+
private function getArgType(
123+
StaticCall $staticCall,
124+
Scope $scope,
125+
int $position
126+
): Type
114127
{
115128
$args = $staticCall->getArgs();
116129

src/Provider/ReflectionBasedMemberUsageProvider.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ private function createMethodUsage(
161161
);
162162
}
163163

164-
private function createEnumCaseUsage(ReflectionEnumUnitCase $enumCaseReflection, VirtualUsageData $usage): EnumCaseUsage
164+
private function createEnumCaseUsage(
165+
ReflectionEnumUnitCase $enumCaseReflection,
166+
VirtualUsageData $usage
167+
): EnumCaseUsage
165168
{
166169
return new EnumCaseUsage(
167170
UsageOrigin::createVirtual($this, $usage),

tests/Rule/DeadCodeRuleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ private function getMemberUsageProviders(): array
916916
$this->providersEnabled,
917917
),
918918
new EnumUsageProvider(
919-
true,
919+
$this->providersEnabled,
920920
),
921921
];
922922

0 commit comments

Comments
 (0)