Skip to content

Commit 3f48c6f

Browse files
committed
style: cs fixes
1 parent 1d13697 commit 3f48c6f

File tree

176 files changed

+529
-529
lines changed

Some content is hidden

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

176 files changed

+529
-529
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/Doctrine/Common/Filter/BooleanFilterTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private function normalizeValue($value, string $property): ?bool
8686
}
8787

8888
$this->getLogger()->notice('Invalid filter ignored', [
89-
'exception' => new InvalidArgumentException(sprintf('Invalid boolean value for "%s" property, expected one of ( "%s" )', $property, implode('" | "', [
89+
'exception' => new InvalidArgumentException(\sprintf('Invalid boolean value for "%s" property, expected one of ( "%s" )', $property, implode('" | "', [
9090
'true',
9191
'false',
9292
'1',

src/Doctrine/Common/Filter/DateFilterTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ protected function getFilterDescription(string $property, string $period): array
7373
$propertyName = $this->normalizePropertyName($property);
7474

7575
return [
76-
sprintf('%s[%s]', $propertyName, $period) => [
76+
\sprintf('%s[%s]', $propertyName, $period) => [
7777
'property' => $propertyName,
7878
'type' => \DateTimeInterface::class,
7979
'required' => false,
@@ -85,7 +85,7 @@ private function normalizeValue($value, string $operator): ?string
8585
{
8686
if (false === \is_string($value)) {
8787
$this->getLogger()->notice('Invalid filter ignored', [
88-
'exception' => new InvalidArgumentException(sprintf('Invalid value for "[%s]", expected string', $operator)),
88+
'exception' => new InvalidArgumentException(\sprintf('Invalid value for "[%s]", expected string', $operator)),
8989
]);
9090

9191
return null;

src/Doctrine/Common/Filter/ExistsFilterTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function getDescription(string $resourceClass): array
4949
continue;
5050
}
5151
$propertyName = $this->normalizePropertyName($property);
52-
$description[sprintf('%s[%s]', $this->existsParameterName, $propertyName)] = [
52+
$description[\sprintf('%s[%s]', $this->existsParameterName, $propertyName)] = [
5353
'property' => $propertyName,
5454
'type' => 'bool',
5555
'required' => false,
@@ -81,7 +81,7 @@ private function normalizeValue($value, string $property): ?bool
8181
}
8282

8383
$this->getLogger()->notice('Invalid filter ignored', [
84-
'exception' => new InvalidArgumentException(sprintf('Invalid value for "%s[%s]", expected one of ( "%s" )', $this->existsParameterName, $property, implode('" | "', [
84+
'exception' => new InvalidArgumentException(\sprintf('Invalid value for "%s[%s]", expected one of ( "%s" )', $this->existsParameterName, $property, implode('" | "', [
8585
'true',
8686
'false',
8787
'1',

src/Doctrine/Common/Filter/NumericFilterTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function normalizeValues($value, string $property): ?array
8383
{
8484
if (!is_numeric($value) && (!\is_array($value) || !$this->isNumericArray($value))) {
8585
$this->getLogger()->notice('Invalid filter ignored', [
86-
'exception' => new InvalidArgumentException(sprintf('Invalid numeric value for "%s" property', $property)),
86+
'exception' => new InvalidArgumentException(\sprintf('Invalid numeric value for "%s" property', $property)),
8787
]);
8888

8989
return null;
@@ -102,7 +102,7 @@ protected function normalizeValues($value, string $property): ?array
102102

103103
if (empty($values)) {
104104
$this->getLogger()->notice('Invalid filter ignored', [
105-
'exception' => new InvalidArgumentException(sprintf('At least one value is required, multiple values should be in "%1$s[]=firstvalue&%1$s[]=secondvalue" format', $property)),
105+
'exception' => new InvalidArgumentException(\sprintf('At least one value is required, multiple values should be in "%1$s[]=firstvalue&%1$s[]=secondvalue" format', $property)),
106106
]);
107107

108108
return null;

src/Doctrine/Common/Filter/OrderFilterTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function getDescription(string $resourceClass): array
4848
continue;
4949
}
5050
$propertyName = $this->normalizePropertyName($property);
51-
$description[sprintf('%s[%s]', $this->orderParameterName, $propertyName)] = [
51+
$description[\sprintf('%s[%s]', $this->orderParameterName, $propertyName)] = [
5252
'property' => $propertyName,
5353
'type' => 'string',
5454
'required' => false,

src/Doctrine/Common/Filter/RangeFilterTrait.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function getFilterDescription(string $fieldName, string $operator): ar
6868
$propertyName = $this->normalizePropertyName($fieldName);
6969

7070
return [
71-
sprintf('%s[%s]', $propertyName, $operator) => [
71+
\sprintf('%s[%s]', $propertyName, $operator) => [
7272
'property' => $propertyName,
7373
'type' => 'string',
7474
'required' => false,
@@ -88,7 +88,7 @@ private function normalizeValues(array $values, string $property): ?array
8888

8989
if (empty($values)) {
9090
$this->getLogger()->notice('Invalid filter ignored', [
91-
'exception' => new InvalidArgumentException(sprintf('At least one valid operator ("%s") is required for "%s" property', implode('", "', $operators), $property)),
91+
'exception' => new InvalidArgumentException(\sprintf('At least one valid operator ("%s") is required for "%s" property', implode('", "', $operators), $property)),
9292
]);
9393

9494
return null;
@@ -104,15 +104,15 @@ private function normalizeBetweenValues(array $values): ?array
104104
{
105105
if (2 !== \count($values)) {
106106
$this->getLogger()->notice('Invalid filter ignored', [
107-
'exception' => new InvalidArgumentException(sprintf('Invalid format for "[%s]", expected "<min>..<max>"', self::PARAMETER_BETWEEN)),
107+
'exception' => new InvalidArgumentException(\sprintf('Invalid format for "[%s]", expected "<min>..<max>"', self::PARAMETER_BETWEEN)),
108108
]);
109109

110110
return null;
111111
}
112112

113113
if (!is_numeric($values[0]) || !is_numeric($values[1])) {
114114
$this->getLogger()->notice('Invalid filter ignored', [
115-
'exception' => new InvalidArgumentException(sprintf('Invalid values for "[%s]" range, expected numbers', self::PARAMETER_BETWEEN)),
115+
'exception' => new InvalidArgumentException(\sprintf('Invalid values for "[%s]" range, expected numbers', self::PARAMETER_BETWEEN)),
116116
]);
117117

118118
return null;
@@ -128,7 +128,7 @@ private function normalizeValue(string $value, string $operator): float|int|null
128128
{
129129
if (!is_numeric($value)) {
130130
$this->getLogger()->notice('Invalid filter ignored', [
131-
'exception' => new InvalidArgumentException(sprintf('Invalid value for "[%s]", expected number', $operator)),
131+
'exception' => new InvalidArgumentException(\sprintf('Invalid value for "[%s]", expected number', $operator)),
132132
]);
133133

134134
return null;

src/Doctrine/Common/Filter/SearchFilterTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ protected function normalizeValues(array $values, string $property): ?array
151151

152152
if (empty($values)) {
153153
$this->getLogger()->notice('Invalid filter ignored', [
154-
'exception' => new InvalidArgumentException(sprintf('At least one value is required, multiple values should be in "%1$s[]=firstvalue&%1$s[]=secondvalue" format', $property)),
154+
'exception' => new InvalidArgumentException(\sprintf('At least one value is required, multiple values should be in "%1$s[]=firstvalue&%1$s[]=secondvalue" format', $property)),
155155
]);
156156

157157
return null;

src/Doctrine/Common/State/LinksHandlerLocatorTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ private function getLinksHandler(Operation $operation): ?callable
3939
return [$this->handleLinksLocator->get($handleLinks), 'handleLinks'];
4040
}
4141

42-
throw new RuntimeException(sprintf('Could not find handleLinks service "%s"', $handleLinks));
42+
throw new RuntimeException(\sprintf('Could not find handleLinks service "%s"', $handleLinks));
4343
}
4444
}

src/Doctrine/Common/State/LinksHandlerTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private function getLinks(string $resourceClass, Operation $operation, array $co
8383
}
8484

8585
if (!$newLink) {
86-
throw new RuntimeException(sprintf('The class "%s" cannot be retrieved from "%s".', $resourceClass, $linkClass));
86+
throw new RuntimeException(\sprintf('The class "%s" cannot be retrieved from "%s".', $resourceClass, $linkClass));
8787
}
8888

8989
return [$newLink];

src/Doctrine/EventListener/PublishMercureUpdatesListener.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ public function __construct(ResourceClassResolverInterface $resourceClassResolve
8383
$this->expressionLanguage->addFunction($rawurlencode);
8484

8585
$this->expressionLanguage->addFunction(
86-
new ExpressionFunction('get_operation', static fn (string $apiResource, string $name): string => sprintf('getOperation(%s, %s)', $apiResource, $name), static fn (array $arguments, $apiResource, string $name): Operation => $resourceMetadataFactory->create($resourceClassResolver->getResourceClass($apiResource))->getOperation($name))
86+
new ExpressionFunction('get_operation', static fn (string $apiResource, string $name): string => \sprintf('getOperation(%s, %s)', $apiResource, $name), static fn (array $arguments, $apiResource, string $name): Operation => $resourceMetadataFactory->create($resourceClassResolver->getResourceClass($apiResource))->getOperation($name))
8787
);
8888
$this->expressionLanguage->addFunction(
89-
new ExpressionFunction('iri', static fn (string $apiResource, int $referenceType = UrlGeneratorInterface::ABS_URL, ?string $operation = null): string => sprintf('iri(%s, %d, %s)', $apiResource, $referenceType, $operation), static fn (array $arguments, $apiResource, int $referenceType = UrlGeneratorInterface::ABS_URL, $operation = null): string => $iriConverter->getIriFromResource($apiResource, $referenceType, $operation))
89+
new ExpressionFunction('iri', static fn (string $apiResource, int $referenceType = UrlGeneratorInterface::ABS_URL, ?string $operation = null): string => \sprintf('iri(%s, %d, %s)', $apiResource, $referenceType, $operation), static fn (array $arguments, $apiResource, int $referenceType = UrlGeneratorInterface::ABS_URL, $operation = null): string => $iriConverter->getIriFromResource($apiResource, $referenceType, $operation))
9090
);
9191
}
9292

@@ -184,12 +184,12 @@ private function storeObjectToPublish(object $object, string $property): void
184184
}
185185

186186
if (!\is_array($options)) {
187-
throw new InvalidArgumentException(sprintf('The value of the "mercure" attribute of the "%s" resource class must be a boolean, an array of options or an expression returning this array, "%s" given.', $resourceClass, \gettype($options)));
187+
throw new InvalidArgumentException(\sprintf('The value of the "mercure" attribute of the "%s" resource class must be a boolean, an array of options or an expression returning this array, "%s" given.', $resourceClass, \gettype($options)));
188188
}
189189

190190
foreach ($options as $key => $value) {
191191
if (!isset(self::ALLOWED_KEYS[$key])) {
192-
throw new InvalidArgumentException(sprintf('The option "%s" set in the "mercure" attribute of the "%s" resource does not exist. Existing options: "%s"', $key, $resourceClass, implode('", "', self::ALLOWED_KEYS)));
192+
throw new InvalidArgumentException(\sprintf('The option "%s" set in the "mercure" attribute of the "%s" resource does not exist. Existing options: "%s"', $key, $resourceClass, implode('", "', self::ALLOWED_KEYS)));
193193
}
194194
}
195195

src/Doctrine/Odm/Extension/PaginationExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function applyToCollection(Builder $aggregationBuilder, string $resourceC
5656

5757
$manager = $this->managerRegistry->getManagerForClass($resourceClass);
5858
if (!$manager instanceof DocumentManager) {
59-
throw new RuntimeException(sprintf('The manager for "%s" must be an instance of "%s".', $resourceClass, DocumentManager::class));
59+
throw new RuntimeException(\sprintf('The manager for "%s" must be an instance of "%s".', $resourceClass, DocumentManager::class));
6060
}
6161

6262
/**
@@ -103,7 +103,7 @@ public function getResult(Builder $aggregationBuilder, string $resourceClass, ?O
103103
{
104104
$manager = $this->managerRegistry->getManagerForClass($resourceClass);
105105
if (!$manager instanceof DocumentManager) {
106-
throw new RuntimeException(sprintf('The manager for "%s" must be an instance of "%s".', $resourceClass, DocumentManager::class));
106+
throw new RuntimeException(\sprintf('The manager for "%s" must be an instance of "%s".', $resourceClass, DocumentManager::class));
107107
}
108108

109109
$attribute = $operation?->getExtraProperties()['doctrine_mongodb'] ?? [];

src/Doctrine/Odm/Filter/DateFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ private function addMatch(Builder $aggregationBuilder, string $field, string $op
210210
} catch (\Exception) {
211211
// Silently ignore this filter if it can not be transformed to a \DateTime
212212
$this->logger->notice('Invalid filter ignored', [
213-
'exception' => new InvalidArgumentException(sprintf('The field "%s" has a wrong date format. Use one accepted by the \DateTime constructor', $field)),
213+
'exception' => new InvalidArgumentException(\sprintf('The field "%s" has a wrong date format. Use one accepted by the \DateTime constructor', $field)),
214214
]);
215215

216216
return;

src/Doctrine/Odm/Filter/SearchFilter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ protected function filterProperty(string $property, $value, Builder $aggregation
203203

204204
if (!$this->hasValidValues($values, $this->getDoctrineFieldType($property, $resourceClass))) {
205205
$this->logger->notice('Invalid filter ignored', [
206-
'exception' => new InvalidArgumentException(sprintf('Values for field "%s" are not valid according to the doctrine type.', $field)),
206+
'exception' => new InvalidArgumentException(\sprintf('Values for field "%s" are not valid according to the doctrine type.', $field)),
207207
]);
208208

209209
return;
@@ -227,7 +227,7 @@ protected function filterProperty(string $property, $value, Builder $aggregation
227227

228228
if (!$this->hasValidValues($values, $doctrineTypeField)) {
229229
$this->logger->notice('Invalid filter ignored', [
230-
'exception' => new InvalidArgumentException(sprintf('Values for field "%s" are not valid according to the doctrine type.', $property)),
230+
'exception' => new InvalidArgumentException(\sprintf('Values for field "%s" are not valid according to the doctrine type.', $property)),
231231
]);
232232

233233
return;
@@ -276,7 +276,7 @@ private function getEqualityMatchStrategyValue(string $strategy, string $field,
276276
self::STRATEGY_START => new Regex("^$quotedValue", $caseSensitive ? '' : 'i'),
277277
self::STRATEGY_END => new Regex("$quotedValue$", $caseSensitive ? '' : 'i'),
278278
self::STRATEGY_WORD_START => new Regex("(^$quotedValue.*|.*\s$quotedValue.*)", $caseSensitive ? '' : 'i'),
279-
default => throw new InvalidArgumentException(sprintf('strategy %s does not exist.', $strategy)),
279+
default => throw new InvalidArgumentException(\sprintf('strategy %s does not exist.', $strategy)),
280280
};
281281
}
282282

src/Doctrine/Odm/PropertyHelperTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ protected function addLookupsForNestedProperty(string $property, Builder $aggreg
112112
}
113113

114114
if ('' === $alias) {
115-
throw new InvalidArgumentException(sprintf('Cannot add lookups for property "%s" - property is not nested.', $property));
115+
throw new InvalidArgumentException(\sprintf('Cannot add lookups for property "%s" - property is not nested.', $property));
116116
}
117117

118118
return [$property, $propertyParts['field'], $propertyParts['associations']];

src/Doctrine/Odm/State/CollectionProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
5555

5656
$repository = $manager->getRepository($documentClass);
5757
if (!$repository instanceof DocumentRepository) {
58-
throw new RuntimeException(sprintf('The repository for "%s" must be an instance of "%s".', $documentClass, DocumentRepository::class));
58+
throw new RuntimeException(\sprintf('The repository for "%s" must be an instance of "%s".', $documentClass, DocumentRepository::class));
5959
}
6060

6161
$aggregationBuilder = $repository->createAggregationBuilder();

src/Doctrine/Odm/State/ItemProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
6363

6464
$repository = $manager->getRepository($documentClass);
6565
if (!$repository instanceof DocumentRepository) {
66-
throw new RuntimeException(sprintf('The repository for "%s" must be an instance of "%s".', $documentClass, DocumentRepository::class));
66+
throw new RuntimeException(\sprintf('The repository for "%s" must be an instance of "%s".', $documentClass, DocumentRepository::class));
6767
}
6868

6969
$aggregationBuilder = $repository->createAggregationBuilder();

src/Doctrine/Odm/State/LinksHandlerTrait.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ private function buildAggregation(string $toClass, array $links, array $identifi
9292
}
9393

9494
if (!$manager instanceof DocumentManager) {
95-
throw new RuntimeException(sprintf('The manager for "%s" must be an instance of "%s".', $aggregationClass, DocumentManager::class));
95+
throw new RuntimeException(\sprintf('The manager for "%s" must be an instance of "%s".', $aggregationClass, DocumentManager::class));
9696
}
9797
}
9898

9999
$classMetadata = $manager->getClassMetadata($aggregationClass);
100100

101101
if (!$classMetadata instanceof ClassMetadata) {
102-
throw new RuntimeException(sprintf('The class metadata for "%s" must be an instance of "%s".', $aggregationClass, ClassMetadata::class));
102+
throw new RuntimeException(\sprintf('The class metadata for "%s" must be an instance of "%s".', $aggregationClass, ClassMetadata::class));
103103
}
104104

105105
$aggregation = $previousAggregationBuilder;
@@ -113,7 +113,7 @@ private function buildAggregation(string $toClass, array $links, array $identifi
113113

114114
if ($toProperty) {
115115
foreach ($identifierProperties as $identifierProperty) {
116-
$aggregation->match()->field(sprintf('%s.%s', $lookupPropertyAlias, 'id' === $identifierProperty ? '_id' : $identifierProperty))->equals($this->getIdentifierValue($identifiers, $hasCompositeIdentifiers ? $identifierProperty : null));
116+
$aggregation->match()->field(\sprintf('%s.%s', $lookupPropertyAlias, 'id' === $identifierProperty ? '_id' : $identifierProperty))->equals($this->getIdentifierValue($identifiers, $hasCompositeIdentifiers ? $identifierProperty : null));
117117
}
118118
} else {
119119
foreach ($identifierProperties as $identifierProperty) {

src/Doctrine/Odm/Tests/AppKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function registerBundles(): array
4343
return [
4444
new FrameworkBundle(),
4545
new DoctrineMongoDBBundle(),
46-
new class() extends Bundle {
46+
new class extends Bundle {
4747
public function shutdown(): void
4848
{
4949
restore_exception_handler();

0 commit comments

Comments
 (0)