Skip to content

Commit 1b68ff4

Browse files
authored
[automated] Apply Coding Standard (#6524)
Co-authored-by: TomasVotruba <[email protected]>
1 parent fec0fbc commit 1b68ff4

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

rules/DeadCode/Rector/ClassMethod/RemoveUnusedPrivateMethodRector.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ public function refactor(Node $node): ?Node
104104

105105
$hasChanged = false;
106106
$classReflection = $this->reflectionResolver->resolveClassReflection($node);
107-
$collectionTestMethodsUsesPrivateProvider = $this->collectTestMethodsUsesPrivateDataProvider($classReflection, $node, $classMethods);
107+
$collectionTestMethodsUsesPrivateProvider = $this->collectTestMethodsUsesPrivateDataProvider(
108+
$classReflection,
109+
$node,
110+
$classMethods
111+
);
108112

109113
foreach ($privateMethods as $privateMethod) {
110114
if ($this->shouldSkip($privateMethod, $classReflection)) {
@@ -134,8 +138,11 @@ public function refactor(Node $node): ?Node
134138
* @param ClassMethod[] $classMethods
135139
* @return string[]
136140
*/
137-
private function collectTestMethodsUsesPrivateDataProvider(ClassReflection $classReflection, Class_ $class, array $classMethods): array
138-
{
141+
private function collectTestMethodsUsesPrivateDataProvider(
142+
ClassReflection $classReflection,
143+
Class_ $class,
144+
array $classMethods
145+
): array {
139146
if (! $classReflection->isSubClassOf('PHPUnit\Framework\TestCase')) {
140147
return [];
141148
}
@@ -159,7 +166,10 @@ private function collectTestMethodsUsesPrivateDataProvider(ClassReflection $clas
159166
}
160167
}
161168

162-
if ($this->phpAttributeAnalyzer->hasPhpAttribute($classMethod, 'PHPUnit\Framework\Attributes\DataProvider')) {
169+
if ($this->phpAttributeAnalyzer->hasPhpAttribute(
170+
$classMethod,
171+
'PHPUnit\Framework\Attributes\DataProvider'
172+
)) {
163173
foreach ($classMethod->attrGroups as $attrGroup) {
164174
foreach ($attrGroup->attrs as $attr) {
165175
if ($attr->name->toString() === 'PHPUnit\Framework\Attributes\DataProvider') {

rules/Php70/Rector/ClassMethod/Php4ConstructorRector.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ public function refactor(Node $node): Class_|null
119119
}
120120

121121
$parentClassName = $classReflection->getParentClass() instanceof ClassReflection
122-
? $classReflection->getParentClass()->getName()
122+
? $classReflection->getParentClass()
123+
->getName()
123124
: '';
124125

125126
foreach ($classMethodStmts as $classMethodStmt) {
@@ -132,10 +133,14 @@ public function refactor(Node $node): Class_|null
132133
unset($node->stmts[$stmtKey]);
133134
}
134135

135-
if ($this->isLocalMethodCallNamed($classMethodStmt->expr, $parentClassName) && ! $node->getMethod($parentClassName) instanceof ClassMethod) {
136+
if ($this->isLocalMethodCallNamed($classMethodStmt->expr, $parentClassName) && ! $node->getMethod(
137+
$parentClassName
138+
) instanceof ClassMethod) {
136139
/** @var MethodCall $expr */
137140
$expr = $classMethodStmt->expr;
138-
$classMethodStmt->expr = new StaticCall(new FullyQualified($parentClassName), new Identifier(MethodName::CONSTRUCT), $expr->args);
141+
$classMethodStmt->expr = new StaticCall(new FullyQualified($parentClassName), new Identifier(
142+
MethodName::CONSTRUCT
143+
), $expr->args);
139144
}
140145
}
141146

rules/Php80/NodeFactory/MatchArmsFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function createFromCondAndExprs(array $condAndExprs): array
2727

2828
$condExprs = $condAndExpr->getCondExprs();
2929
$matchArms[] = new MatchArm($condExprs, $expr, [
30-
AttributeKey::COMMENTS => $condAndExprs[$key]->getComments()
30+
AttributeKey::COMMENTS => $condAndExprs[$key]->getComments(),
3131
]);
3232
}
3333

tests/Issues/DynamicDocblockRename/config/configured_rule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RenameClassRector::class,
1313
[
1414
'Rector\Tests\CodeQuality\Rector\Class_\DynamicDocBlockPropertyToNativePropertyRector\Source\SomeDependency'
15-
=> 'stdClass'
15+
=> 'stdClass',
1616
]
1717
);
1818
};

0 commit comments

Comments
 (0)