Skip to content

Commit 35c1129

Browse files
authored
style: various cs fixes (#6504)
* cs: fixes * chore: phpstan fixes
1 parent 52fd981 commit 35c1129

File tree

213 files changed

+605
-605
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+605
-605
lines changed

docs/src/DependencyInjection/Compiler/AttributeFilterPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private function createFilterDefinitions(\ReflectionClass $resourceReflectionCla
5353
}
5454

5555
if (null === $filterReflectionClass = $container->getReflectionClass($filterClass, false)) {
56-
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $filterClass, $id));
56+
throw new InvalidArgumentException(\sprintf('Class "%s" used for service "%s" cannot be found.', $filterClass, $id));
5757
}
5858

5959
if ($container->has($filterClass) && ($parentDefinition = $container->findDefinition($filterClass))->isAbstract()) {
@@ -75,7 +75,7 @@ private function createFilterDefinitions(\ReflectionClass $resourceReflectionCla
7575

7676
foreach ($arguments as $key => $value) {
7777
if (!isset($parameterNames[$key])) {
78-
throw new InvalidArgumentException(sprintf('Class "%s" does not have argument "$%s".', $filterClass, $key));
78+
throw new InvalidArgumentException(\sprintf('Class "%s" does not have argument "$%s".', $filterClass, $key));
7979
}
8080

8181
$definition->setArgument("$$key", $value);

src/Action/ExceptionAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function __invoke(FlattenException $exception, Request $request): Respons
7272

7373
$headers = $exception->getHeaders();
7474
$format = ErrorFormatGuesser::guessErrorFormat($request, $this->errorFormats);
75-
$headers['Content-Type'] = sprintf('%s; charset=utf-8', $format['value'][0]);
75+
$headers['Content-Type'] = \sprintf('%s; charset=utf-8', $format['value'][0]);
7676
$headers['X-Content-Type-Options'] = 'nosniff';
7777
$headers['X-Frame-Options'] = 'deny';
7878

src/Api/CompositeIdentifierParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static function stringify(array $identifiers): string
5757
{
5858
$composite = [];
5959
foreach ($identifiers as $name => $value) {
60-
$composite[] = sprintf('%s=%s', $name, $value);
60+
$composite[] = \sprintf('%s=%s', $name, $value);
6161
}
6262

6363
return implode(';', $composite);

src/Api/FilterInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace ApiPlatform\Api;
1515

1616
if (interface_exists(\ApiPlatform\Metadata\FilterInterface::class)) {
17-
trigger_deprecation('api-platform', '3.3', sprintf('%s is deprecated in favor of %s. This class will be removed in 4.0.', FilterInterface::class, \ApiPlatform\Metadata\FilterInterface::class));
17+
trigger_deprecation('api-platform', '3.3', \sprintf('%s is deprecated in favor of %s. This class will be removed in 4.0.', FilterInterface::class, \ApiPlatform\Metadata\FilterInterface::class));
1818
class_alias(
1919
\ApiPlatform\Metadata\FilterInterface::class,
2020
__NAMESPACE__.'\FilterInterface'

src/Api/FilterLocatorTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private function setFilterLocator(?ContainerInterface $filterLocator, bool $allo
3737
if ($filterLocator instanceof ContainerInterface || (null === $filterLocator && $allowNull)) {
3838
$this->filterLocator = $filterLocator;
3939
} else {
40-
throw new InvalidArgumentException(sprintf('The "$filterLocator" argument is expected to be an implementation of the "%s" interface%s.', ContainerInterface::class, $allowNull ? ' or null' : ''));
40+
throw new InvalidArgumentException(\sprintf('The "$filterLocator" argument is expected to be an implementation of the "%s" interface%s.', ContainerInterface::class, $allowNull ? ' or null' : ''));
4141
}
4242
}
4343

src/Api/IdentifiersExtractor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private function getIdentifierValue(object $item, string $class, string $propert
124124
$collectionValueType = $type->getCollectionValueTypes()[0] ?? null;
125125

126126
if (null !== $collectionValueType && $collectionValueType->getClassName() === $class) {
127-
return $this->resolveIdentifierValue($this->propertyAccessor->getValue($item, sprintf('%s[0].%s', $propertyName, $property)), $parameterName);
127+
return $this->resolveIdentifierValue($this->propertyAccessor->getValue($item, \sprintf('%s[0].%s', $propertyName, $property)), $parameterName);
128128
}
129129
}
130130

@@ -162,6 +162,6 @@ private function resolveIdentifierValue(mixed $identifierValue, string $paramete
162162
return (string) $identifierValue->value;
163163
}
164164

165-
throw new RuntimeException(sprintf('We were not able to resolve the identifier matching parameter "%s".', $parameterName));
165+
throw new RuntimeException(\sprintf('We were not able to resolve the identifier matching parameter "%s".', $parameterName));
166166
}
167167
}

src/Api/QueryParameterValidator/Validator/ArrayItems.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ public function validate(string $name, array $filterDescription, array $queryPar
4444
$nbItems = \count($value);
4545

4646
if (null !== $maxItems && $nbItems > $maxItems) {
47-
$errorList[] = sprintf('Query parameter "%s" must contain less than %d values', $name, $maxItems);
47+
$errorList[] = \sprintf('Query parameter "%s" must contain less than %d values', $name, $maxItems);
4848
}
4949

5050
if (null !== $minItems && $nbItems < $minItems) {
51-
$errorList[] = sprintf('Query parameter "%s" must contain more than %d values', $name, $minItems);
51+
$errorList[] = \sprintf('Query parameter "%s" must contain more than %d values', $name, $minItems);
5252
}
5353

5454
if (true === $uniqueItems && $nbItems > \count(array_unique($value))) {
55-
$errorList[] = sprintf('Query parameter "%s" must contain unique values', $name);
55+
$errorList[] = \sprintf('Query parameter "%s" must contain unique values', $name);
5656
}
5757

5858
return $errorList;
@@ -85,7 +85,7 @@ private static function getSeparator(string $collectionFormat): string
8585
'ssv' => ' ',
8686
'tsv' => '\t',
8787
'pipes' => '|',
88-
default => throw new \InvalidArgumentException(sprintf('Unknown collection format %s', $collectionFormat)),
88+
default => throw new \InvalidArgumentException(\sprintf('Unknown collection format %s', $collectionFormat)),
8989
};
9090
}
9191
}

src/Api/QueryParameterValidator/Validator/Bounds.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ public function validate(string $name, array $filterDescription, array $queryPar
4242

4343
if (null !== $maximum) {
4444
if (($filterDescription['openapi']['exclusiveMaximum'] ?? $filterDescription['swagger']['exclusiveMaximum'] ?? false) && $value >= $maximum) {
45-
$errorList[] = sprintf('Query parameter "%s" must be less than %s', $name, $maximum);
45+
$errorList[] = \sprintf('Query parameter "%s" must be less than %s', $name, $maximum);
4646
} elseif ($value > $maximum) {
47-
$errorList[] = sprintf('Query parameter "%s" must be less than or equal to %s', $name, $maximum);
47+
$errorList[] = \sprintf('Query parameter "%s" must be less than or equal to %s', $name, $maximum);
4848
}
4949
}
5050

5151
if (null !== $minimum) {
5252
if (($filterDescription['openapi']['exclusiveMinimum'] ?? $filterDescription['swagger']['exclusiveMinimum'] ?? false) && $value <= $minimum) {
53-
$errorList[] = sprintf('Query parameter "%s" must be greater than %s', $name, $minimum);
53+
$errorList[] = \sprintf('Query parameter "%s" must be greater than %s', $name, $minimum);
5454
} elseif ($value < $minimum) {
55-
$errorList[] = sprintf('Query parameter "%s" must be greater than or equal to %s', $name, $minimum);
55+
$errorList[] = \sprintf('Query parameter "%s" must be greater than or equal to %s', $name, $minimum);
5656
}
5757
}
5858

src/Api/QueryParameterValidator/Validator/Enum.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function validate(string $name, array $filterDescription, array $queryPar
3939

4040
if (null !== $enum && !\in_array($value, $enum, true)) {
4141
return [
42-
sprintf('Query parameter "%s" must be one of "%s"', $name, implode(', ', $enum)),
42+
\sprintf('Query parameter "%s" must be one of "%s"', $name, implode(', ', $enum)),
4343
];
4444
}
4545

src/Api/QueryParameterValidator/Validator/Length.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ public function validate(string $name, array $filterDescription, array $queryPar
4141
$errorList = [];
4242

4343
if (null !== $maxLength && mb_strlen($value) > $maxLength) {
44-
$errorList[] = sprintf('Query parameter "%s" length must be lower than or equal to %s', $name, $maxLength);
44+
$errorList[] = \sprintf('Query parameter "%s" length must be lower than or equal to %s', $name, $maxLength);
4545
}
4646

4747
if (null !== $minLength && mb_strlen($value) < $minLength) {
48-
$errorList[] = sprintf('Query parameter "%s" length must be greater than or equal to %s', $name, $minLength);
48+
$errorList[] = \sprintf('Query parameter "%s" length must be greater than or equal to %s', $name, $minLength);
4949
}
5050

5151
return $errorList;

0 commit comments

Comments
 (0)