Skip to content

Commit 08d66dd

Browse files
committed
Fix code styles
1 parent 4bfaba8 commit 08d66dd

17 files changed

+37
-37
lines changed

.php-cs-fixer.dist.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@
6060
'CodeIgniter 4 framework',
6161
'CodeIgniter Foundation',
6262
63-
2023
63+
2023,
6464
);

src/ComposerScripts.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private static function recursiveDelete(string $directory): void
4949
/** @var SplFileInfo $file */
5050
foreach (new RecursiveIteratorIterator(
5151
new RecursiveDirectoryIterator(rtrim($directory, '\\/'), FilesystemIterator::SKIP_DOTS),
52-
RecursiveIteratorIterator::CHILD_FIRST
52+
RecursiveIteratorIterator::CHILD_FIRST,
5353
) as $file) {
5454
$path = $file->getPathname();
5555

src/Rules/Classes/FrameworkExceptionInstantiationRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function processNode(Node $node, Scope $scope): array
5454

5555
return [RuleErrorBuilder::message(sprintf(
5656
'Instantiating %s using new is not allowed. Use one of its named constructors instead.',
57-
$objectType->getClassReflection()->getNativeReflection()->getShortName()
57+
$objectType->getClassReflection()->getNativeReflection()->getShortName(),
5858
))->identifier('codeigniter.frameworkExceptionInstance')->build()];
5959
}
6060
}

src/Rules/Functions/FactoriesFunctionArgumentTypeRule.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(
4747
private readonly ReflectionProvider $reflectionProvider,
4848
private readonly FactoriesReturnTypeHelper $factoriesReturnTypeHelper,
4949
bool $checkArgumentTypeOfConfig,
50-
bool $checkArgumentTypeOfModel
50+
bool $checkArgumentTypeOfModel,
5151
) {
5252
$this->argumentTypeCheck = [
5353
'config' => $checkArgumentTypeOfConfig,
@@ -93,7 +93,7 @@ public function processNode(Node $node, Scope $scope): array
9393
$firstParameter = ParametersAcceptorSelector::selectFromArgs(
9494
$scope,
9595
$node->getArgs(),
96-
$this->reflectionProvider->getFunction($nameNode, $scope)->getVariants()
96+
$this->reflectionProvider->getFunction($nameNode, $scope)->getVariants(),
9797
)->getParameters()[0];
9898

9999
if ($returnType->isNull()->yes()) {
@@ -102,7 +102,7 @@ public function processNode(Node $node, Scope $scope): array
102102
$ruleErrorBuilder->addTip(sprintf(
103103
'If %s is a valid class string, you can add its possible namespace(s) in <fg=cyan>codeigniter.additional%sNamespaces</> in your <fg=yellow>%%configurationFile%%</>.',
104104
$constantStringType->describe(VerbosityLevel::precise()),
105-
ucfirst($function)
105+
ucfirst($function),
106106
));
107107
}
108108

@@ -113,7 +113,7 @@ public function processNode(Node $node, Scope $scope): array
113113
'Parameter #1 $%s of function %s expects a valid class string, %s given.',
114114
$firstParameter->getName(),
115115
$function,
116-
$nameType->describe(VerbosityLevel::precise())
116+
$nameType->describe(VerbosityLevel::precise()),
117117
)))->identifier(sprintf('codeigniter.%sArgumentType', $function))->build()];
118118
}
119119

@@ -127,7 +127,7 @@ public function processNode(Node $node, Scope $scope): array
127127
$firstParameter->getName(),
128128
$nameType->describe(VerbosityLevel::precise()),
129129
$function,
130-
addcslashes($this->instanceofMap[$function], '\\')
130+
addcslashes($this->instanceofMap[$function], '\\'),
131131
))->identifier(sprintf('codeigniter.%sArgumentInstanceof', $function))->build()];
132132
}
133133

src/Rules/Functions/NoClassConstFetchOnFactoriesFunctions.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ final class NoClassConstFetchOnFactoriesFunctions implements Rule
3636

3737
public function __construct(
3838
private readonly ReflectionProvider $reflectionProvider,
39-
private readonly FactoriesReturnTypeHelper $factoriesReturnTypeHelper
39+
private readonly FactoriesReturnTypeHelper $factoriesReturnTypeHelper,
4040
) {}
4141

4242
public function getNodeType(): string
@@ -120,11 +120,11 @@ public function processNode(Node $node, Scope $scope): array
120120
RuleErrorBuilder::message(sprintf(
121121
'Call to function %s with %s::class is discouraged.',
122122
$function,
123-
$reflection->getDisplayName()
123+
$reflection->getDisplayName(),
124124
))->tip(sprintf(
125125
'Use %s(\'%s\') instead to allow overriding.',
126126
$function,
127-
$reflection->getNativeReflection()->getShortName()
127+
$reflection->getNativeReflection()->getShortName(),
128128
))->identifier('codeigniter.factoriesClassConstFetch')->build(),
129129
];
130130
}

src/Rules/Functions/ServicesFunctionArgumentTypeRule.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ final class ServicesFunctionArgumentTypeRule implements Rule
3030
{
3131
public function __construct(
3232
private readonly ReflectionProvider $reflectionProvider,
33-
private readonly ServicesReturnTypeHelper $servicesReturnTypeHelper
33+
private readonly ServicesReturnTypeHelper $servicesReturnTypeHelper,
3434
) {}
3535

3636
public function getNodeType(): string
@@ -96,14 +96,14 @@ public function processNode(Node $node, Scope $scope): array
9696
$hasMethod = array_reduce(
9797
$this->servicesReturnTypeHelper->getServicesReflection(),
9898
static fn (bool $carry, ClassReflection $service): bool => $carry || $service->hasMethod($trimmedName),
99-
false
99+
false,
100100
);
101101

102102
if (! $returnType->isNull()->yes() || $hasMethod) {
103103
return [RuleErrorBuilder::message(sprintf(
104104
'Service method %s expected to return a service instance, got %s instead.',
105105
$name,
106-
$returnType->describe(VerbosityLevel::precise())
106+
$returnType->describe(VerbosityLevel::precise()),
107107
))->identifier('codeigniter.serviceNonObjectReturn')->build()];
108108
}
109109

@@ -121,7 +121,7 @@ public function processNode(Node $node, Scope $scope): array
121121

122122
return [$addTip(RuleErrorBuilder::message(sprintf(
123123
'Call to unknown service method %s.',
124-
$nameType->describe(VerbosityLevel::precise())
124+
$nameType->describe(VerbosityLevel::precise()),
125125
)))->identifier('codeigniter.unknownServiceMethod')->build()];
126126
}
127127
}

src/Rules/Superglobals/SuperglobalAccessRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
final class SuperglobalAccessRule implements Rule
2727
{
2828
public function __construct(
29-
private readonly SuperglobalRuleHelper $superglobalRuleHelper
29+
private readonly SuperglobalRuleHelper $superglobalRuleHelper,
3030
) {}
3131

3232
public function getNodeType(): string

src/Rules/Superglobals/SuperglobalAssignRule.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
final class SuperglobalAssignRule implements Rule
2828
{
2929
public function __construct(
30-
private readonly SuperglobalRuleHelper $superglobalRuleHelper
30+
private readonly SuperglobalRuleHelper $superglobalRuleHelper,
3131
) {}
3232

3333
public function getNodeType(): string
@@ -108,7 +108,7 @@ private function processArrayDimFetch(Node $node, Scope $scope): array
108108
'Use \\Config\\Services::superglobals()->%s(%s, %s) instead.',
109109
$method,
110110
$dimString->describe(VerbosityLevel::precise()),
111-
$exprString->describe(VerbosityLevel::precise())
111+
$exprString->describe(VerbosityLevel::precise()),
112112
));
113113
}
114114
}

src/Type/FactoriesFunctionReturnTypeExtension.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
final class FactoriesFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension
2323
{
2424
public function __construct(
25-
private readonly FactoriesReturnTypeHelper $factoriesReturnTypeHelper
25+
private readonly FactoriesReturnTypeHelper $factoriesReturnTypeHelper,
2626
) {}
2727

2828
public function isFunctionSupported(FunctionReflection $functionReflection): bool
@@ -40,7 +40,7 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,
4040

4141
return $this->factoriesReturnTypeHelper->check(
4242
$scope->getType($arguments[0]->value),
43-
$functionReflection->getName()
43+
$functionReflection->getName(),
4444
);
4545
}
4646
}

src/Type/FactoriesReturnTypeHelper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ final class FactoriesReturnTypeHelper
4646
public function __construct(
4747
private readonly ReflectionProvider $reflectionProvider,
4848
array $additionalConfigNamespaces,
49-
array $additionalModelNamespaces
49+
array $additionalModelNamespaces,
5050
) {
5151
$cb = static fn (string $item): string => rtrim($item, '\\') . '\\';
5252

src/Type/ModelFetchedReturnTypeHelper.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ final class ModelFetchedReturnTypeHelper
6161
*/
6262
public function __construct(
6363
private readonly ReflectionProvider $reflectionProvider,
64-
array $notStringFormattedFieldsArray
64+
array $notStringFormattedFieldsArray,
6565
) {
6666
foreach ($notStringFormattedFieldsArray as $field => $type) {
6767
if (! isset(self::$typeInterpolations[$type])) {
@@ -101,7 +101,7 @@ private function getArrayReturnType(ClassReflection $classReflection, Scope $sco
101101
{
102102
$this->fillDateFields($classReflection, $scope);
103103
$fieldsTypes = $scope->getType(
104-
$classReflection->getNativeProperty('allowedFields')->getNativeReflection()->getDefaultValueExpression()
104+
$classReflection->getNativeProperty('allowedFields')->getNativeReflection()->getDefaultValueExpression(),
105105
)->getConstantArrays();
106106

107107
if ($fieldsTypes === []) {
@@ -111,9 +111,9 @@ private function getArrayReturnType(ClassReflection $classReflection, Scope $sco
111111
$fields = array_filter(
112112
array_map(
113113
static fn (Type $type) => current($type->getConstantStrings()),
114-
current($fieldsTypes)->getValueTypes()
114+
current($fieldsTypes)->getValueTypes(),
115115
),
116-
static fn (ConstantStringType|false $constantStringType): bool => $constantStringType !== false
116+
static fn (ConstantStringType|false $constantStringType): bool => $constantStringType !== false,
117117
);
118118

119119
return new ConstantArrayType(
@@ -135,7 +135,7 @@ private function getArrayReturnType(ClassReflection $classReflection, Scope $sco
135135
}
136136

137137
return new StringType();
138-
}, $fields)
138+
}, $fields),
139139
);
140140
}
141141

@@ -156,7 +156,7 @@ private function getNativeStringPropertyValue(ClassReflection $classReflection,
156156

157157
return $this->getStringValueFromExpr(
158158
$classReflection->getNativeProperty($property)->getNativeReflection()->getDefaultValueExpression(),
159-
$scope
159+
$scope,
160160
);
161161
}
162162

src/Type/ModelFindReturnTypeExtension.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
final class ModelFindReturnTypeExtension implements DynamicMethodReturnTypeExtension
3333
{
3434
public function __construct(
35-
private readonly ModelFetchedReturnTypeHelper $modelFetchedReturnTypeHelper
35+
private readonly ModelFetchedReturnTypeHelper $modelFetchedReturnTypeHelper,
3636
) {}
3737

3838
public function getClass(): string
@@ -96,7 +96,7 @@ function (Type $idType, callable $traverse) use ($methodCall, $scope): Type {
9696
}
9797

9898
return $this->getTypeFromFindAll($methodCall, $scope);
99-
}
99+
},
100100
);
101101
}
102102

@@ -107,9 +107,9 @@ private function getTypeFromFindAll(MethodCall $methodCall, Scope $scope): Type
107107
return TypeCombinator::intersect(
108108
new ArrayType(
109109
new IntegerType(),
110-
$this->modelFetchedReturnTypeHelper->getFetchedReturnType($classReflection, $methodCall, $scope)
110+
$this->modelFetchedReturnTypeHelper->getFetchedReturnType($classReflection, $methodCall, $scope),
111111
),
112-
new AccessoryArrayListType()
112+
new AccessoryArrayListType(),
113113
);
114114
}
115115
}

src/Type/ServicesFunctionReturnTypeExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
final class ServicesFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension
2323
{
2424
public function __construct(
25-
private readonly ServicesReturnTypeHelper $servicesReturnTypeHelper
25+
private readonly ServicesReturnTypeHelper $servicesReturnTypeHelper,
2626
) {}
2727

2828
public function isFunctionSupported(FunctionReflection $functionReflection): bool

src/Type/ServicesReturnTypeHelper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ final class ServicesReturnTypeHelper
5959
*/
6060
public function __construct(
6161
private readonly ReflectionProvider $reflectionProvider,
62-
array $additionalServices
62+
array $additionalServices,
6363
) {
6464
$this->services = [
6565
FrameworkServices::class,
@@ -105,7 +105,7 @@ public function check(Type $type, Scope $scope): Type
105105
return ParametersAcceptorSelector::selectFromArgs(
106106
$scope,
107107
[],
108-
$methodReflection->getVariants()
108+
$methodReflection->getVariants(),
109109
)->getReturnType();
110110
}
111111

tests/Rules/Functions/FactoriesFunctionArgumentTypeRuleTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function getRule(): Rule
4747
self::createReflectionProvider(),
4848
self::getContainer()->getByType(FactoriesReturnTypeHelper::class),
4949
$this->checkArgumentTypeOfConfig,
50-
$this->checkArgumentTypeOfModel
50+
$this->checkArgumentTypeOfModel,
5151
);
5252
}
5353

tests/Rules/Functions/NoClassConstFetchOnFactoriesFunctionsTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function getRule(): Rule
3434
{
3535
return new NoClassConstFetchOnFactoriesFunctions(
3636
self::createReflectionProvider(),
37-
self::getContainer()->getByType(FactoriesReturnTypeHelper::class)
37+
self::getContainer()->getByType(FactoriesReturnTypeHelper::class),
3838
);
3939
}
4040

tests/Rules/Functions/ServicesFunctionArgumentTypeRuleTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected function getRule(): Rule
3333
{
3434
return new ServicesFunctionArgumentTypeRule(
3535
self::createReflectionProvider(),
36-
self::getContainer()->getByType(ServicesReturnTypeHelper::class)
36+
self::getContainer()->getByType(ServicesReturnTypeHelper::class),
3737
);
3838
}
3939

0 commit comments

Comments
 (0)