Skip to content

Commit d4183e2

Browse files
authored
chore: fix CS (#432)
1 parent ff9c331 commit d4183e2

23 files changed

+72
-72
lines changed

src/AnnotationGenerator/PhpDocAnnotationGenerator.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function generateInterfaceAnnotations(Class_ $class): array
5151
public function generateConstantAnnotations(Constant $constant): array
5252
{
5353
$annotations = $this->formatDoc($constant->comment(), true);
54-
$annotations[0] = sprintf('@var string %s', $this->escapePhpDoc($annotations[0]));
54+
$annotations[0] = \sprintf('@var string %s', $this->escapePhpDoc($annotations[0]));
5555

5656
return $annotations;
5757
}
@@ -62,14 +62,14 @@ public function generatePropertyAnnotations(Property $property, string $classNam
6262

6363
$annotations = [];
6464
if ($this->isDocUseful($property) && $phpDocType = $this->toPhpDocType($property)) {
65-
$annotations[] = sprintf('@var %s %s', $phpDocType, $this->escapePhpDoc($description[0]));
65+
$annotations[] = \sprintf('@var %s %s', $phpDocType, $this->escapePhpDoc($description[0]));
6666
} else {
6767
$annotations = $description;
6868
$annotations[] = '';
6969
}
7070

7171
if (null !== $property->rdfType()) {
72-
$annotations[] = sprintf('@see %s', $property->rdfType());
72+
$annotations[] = \sprintf('@see %s', $property->rdfType());
7373
}
7474

7575
$annotations[] = '';
@@ -83,7 +83,7 @@ public function generateGetterAnnotations(Property $property): array
8383
return [];
8484
}
8585

86-
return [sprintf('@return %s', $this->toPhpDocType($property))];
86+
return [\sprintf('@return %s', $this->toPhpDocType($property))];
8787
}
8888

8989
public function generateSetterAnnotations(Property $property): array
@@ -92,7 +92,7 @@ public function generateSetterAnnotations(Property $property): array
9292
return [];
9393
}
9494

95-
return [sprintf('@param %s $%s', $this->toPhpDocType($property), $property->name())];
95+
return [\sprintf('@param %s $%s', $this->toPhpDocType($property), $property->name())];
9696
}
9797

9898
public function generateAdderAnnotations(Property $property): array
@@ -101,7 +101,7 @@ public function generateAdderAnnotations(Property $property): array
101101
return [];
102102
}
103103

104-
return [sprintf('@param %s $%s', $this->toPhpDocType($property, true), $this->inflector->singularize($property->name())[0])];
104+
return [\sprintf('@param %s $%s', $this->toPhpDocType($property, true), $this->inflector->singularize($property->name())[0])];
105105
}
106106

107107
public function generateRemoverAnnotations(Property $property): array
@@ -110,7 +110,7 @@ public function generateRemoverAnnotations(Property $property): array
110110
return [];
111111
}
112112

113-
return [sprintf('@param %s $%s', $this->toPhpDocType($property, true), $this->inflector->singularize($property->name())[0])];
113+
return [\sprintf('@param %s $%s', $this->toPhpDocType($property, true), $this->inflector->singularize($property->name())[0])];
114114
}
115115

116116
private function isDocUseful(Property $property, bool $adderOrRemover = false): bool
@@ -138,12 +138,12 @@ private function generateDoc(Class_ $class, bool $interface = false): array
138138
$annotations[] = '';
139139
}
140140
if ($class->rdfType()) {
141-
$annotations[] = sprintf('@see %s', $class->rdfType());
141+
$annotations[] = \sprintf('@see %s', $class->rdfType());
142142
}
143143
}
144144

145145
if ($this->config['author']) {
146-
$annotations[] = sprintf('@author %s', $this->config['author']);
146+
$annotations[] = \sprintf('@author %s', $this->config['author']);
147147
}
148148

149149
return $annotations;
@@ -197,10 +197,10 @@ protected function toPhpDocType(Property $property, bool $adderOrRemover = false
197197
}
198198

199199
if ($this->config['doctrine']['useCollection']) {
200-
return sprintf('Collection<%s>%s', $phpDocType, $suffix);
200+
return \sprintf('Collection<%s>%s', $phpDocType, $suffix);
201201
}
202202

203-
return sprintf('%s[]%s', $phpDocType, $suffix);
203+
return \sprintf('%s[]%s', $phpDocType, $suffix);
204204
}
205205

206206
private function escapePhpDoc(string $text): string

src/AttributeGenerator/ApiPlatformCoreAttributeGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function generateClassAttributes(Class_ $class): array
7373
}
7474
$targetArguments[$method] = $methodArguments;
7575
}
76-
$arguments[sprintf('%sOperations', $operationTarget)] = $targetArguments;
76+
$arguments[\sprintf('%sOperations', $operationTarget)] = $targetArguments;
7777
}
7878
} else {
7979
$arguments['operations'] = [];
@@ -85,7 +85,7 @@ public function generateClassAttributes(Class_ $class): array
8585
unset($methodConfig['class']);
8686
}
8787

88-
$arguments['operations'][] = new Literal(sprintf('new %s(...?:)',
88+
$arguments['operations'][] = new Literal(\sprintf('new %s(...?:)',
8989
$operationMetadataClass,
9090
), [$methodConfig ?? []]);
9191
}

src/AttributeGenerator/ConstraintAttributeGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function generatePropertyAttributes(Property $property, string $className
6969
}
7070

7171
if ($property->isEnum && $property->reference) {
72-
$args = ['callback' => [new Literal(sprintf('%s::class', $property->reference->name())), 'toArray']];
72+
$args = ['callback' => [new Literal(\sprintf('%s::class', $property->reference->name())), 'toArray']];
7373

7474
if ($property->isArray()) {
7575
$args['multiple'] = true;
@@ -96,7 +96,7 @@ public function generateUses(Class_ $class): array
9696
$enumName = $property->reference->name();
9797
$enumClass = $this->classes[$enumName];
9898
$enumNamespace = $enumClass->namespace ?? $this->config['namespaces']['enum'];
99-
$use = new Use_(sprintf('%s\%s', $enumNamespace, $enumName));
99+
$use = new Use_(\sprintf('%s\%s', $enumNamespace, $enumName));
100100

101101
if (!\in_array($use, $uses, true)) {
102102
$uses[] = $use;

src/AttributeGenerator/DoctrineMongoDBAttributeGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function generateClassAttributes(Class_ $class): array
6161
$attributes[] = new Attribute('MongoDB\Document');
6262
$attributes[] = new Attribute('MongoDB\InheritanceType', [\in_array($this->config['doctrine']['inheritanceType'], ['SINGLE_COLLECTION', 'COLLECTION_PER_CLASS', 'NONE'], true) ? $this->config['doctrine']['inheritanceType'] : 'SINGLE_COLLECTION']);
6363
$attributes[] = new Attribute('MongoDB\DiscriminatorField', ['discr']);
64-
$attributes[] = new Attribute('MongoDB\DiscriminatorMap', [array_reduce($mapNames, fn (array $map, string $mapName) => $map + [u($mapName)->camel()->toString() => new Literal(sprintf('%s::class', $mapName))], [])]);
64+
$attributes[] = new Attribute('MongoDB\DiscriminatorMap', [array_reduce($mapNames, fn (array $map, string $mapName) => $map + [u($mapName)->camel()->toString() => new Literal(\sprintf('%s::class', $mapName))], [])]);
6565
} else {
6666
$attributes[] = new Attribute('MongoDB\Document');
6767
}

src/AttributeGenerator/DoctrineOrmAttributeGenerator.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function generateClassAttributes(Class_ $class): array
6969
$attributes[] = new Attribute('ORM\Entity');
7070
$attributes[] = new Attribute('ORM\InheritanceType', [\in_array($this->config['doctrine']['inheritanceType'], ['JOINED', 'SINGLE_TABLE', 'TABLE_PER_CLASS', 'NONE'], true) ? $this->config['doctrine']['inheritanceType'] : 'JOINED']);
7171
$attributes[] = new Attribute('ORM\DiscriminatorColumn', ['name' => 'discr']);
72-
$attributes[] = new Attribute('ORM\DiscriminatorMap', [array_reduce($mapNames, fn (array $map, string $mapName) => $map + [u($mapName)->camel()->toString() => new Literal(sprintf('%s::class', $mapName))], [])]);
72+
$attributes[] = new Attribute('ORM\DiscriminatorMap', [array_reduce($mapNames, fn (array $map, string $mapName) => $map + [u($mapName)->camel()->toString() => new Literal(\sprintf('%s::class', $mapName))], [])]);
7373
} else {
7474
$attributes[] = new Attribute('ORM\Entity');
7575
}
@@ -79,7 +79,7 @@ public function generateClassAttributes(Class_ $class): array
7979
continue;
8080
}
8181

82-
$attributes[] = new Attribute('ORM\Table', ['name' => sprintf('`%s`', $this->generateIdentifierName($class->name(), 'table', $this->config))]);
82+
$attributes[] = new Attribute('ORM\Table', ['name' => \sprintf('`%s`', $this->generateIdentifierName($class->name(), 'table', $this->config))]);
8383
}
8484

8585
return $attributes;
@@ -150,7 +150,7 @@ public function generatePropertyAttributes(Property $property, string $className
150150

151151
foreach (self::RESERVED_KEYWORDS as $keyword) {
152152
if (0 === strcasecmp($keyword, $property->name())) {
153-
$args['name'] = sprintf('`%s`', $property->name());
153+
$args['name'] = \sprintf('`%s`', $property->name());
154154
break;
155155
}
156156
}
@@ -281,16 +281,16 @@ private function getRelationName(Property $property): ?string
281281

282282
if (null !== $reference->interfaceName()) {
283283
if (isset($this->config['types'][$reference->name()]['namespaces']['interface'])) {
284-
return sprintf('%s\\%s', $this->config['types'][$reference->name()]['namespaces']['interface'], $reference->interfaceName());
284+
return \sprintf('%s\\%s', $this->config['types'][$reference->name()]['namespaces']['interface'], $reference->interfaceName());
285285
}
286286

287-
return sprintf('%s\\%s', $this->config['namespaces']['interface'], $reference->interfaceName());
287+
return \sprintf('%s\\%s', $this->config['namespaces']['interface'], $reference->interfaceName());
288288
}
289289

290290
if (isset($this->config['types'][$reference->name()]['namespaces']['class'])) {
291-
return sprintf('%s\\%s', $this->config['types'][$reference->name()]['namespaces']['class'], $reference->name());
291+
return \sprintf('%s\\%s', $this->config['types'][$reference->name()]['namespaces']['class'], $reference->name());
292292
}
293293

294-
return sprintf('%s\\%s', $this->config['namespaces']['entity'], $reference->name());
294+
return \sprintf('%s\\%s', $this->config['namespaces']['entity'], $reference->name());
295295
}
296296
}

src/ClassMutator/AnnotationsAppender.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ private function generateClassUses(Class_ $class): void
5858
{
5959
$interfaceNamespace = isset($this->classes[$class->name()]) ? $this->classes[$class->name()]->interfaceNamespace() : null;
6060
if ($interfaceNamespace && $class->interfaceNamespace() !== $class->namespace) {
61-
$class->addUse(new Use_(sprintf('%s\\%s', $class->interfaceNamespace(), $class->interfaceName())));
61+
$class->addUse(new Use_(\sprintf('%s\\%s', $class->interfaceNamespace(), $class->interfaceName())));
6262
}
6363

6464
foreach ($class->properties() as $property) {
6565
if ($property->reference && $property->reference->interfaceName()) {
66-
$class->addUse(new Use_(sprintf(
66+
$class->addUse(new Use_(\sprintf(
6767
'%s\\%s',
6868
$property->reference->interfaceNamespace(),
6969
$property->reference->interfaceName()

src/ClassMutator/AttributeAppender.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ private function generateClassUses(Class_ $class): void
5353
{
5454
$interfaceNamespace = isset($this->classes[$class->name()]) ? $this->classes[$class->name()]->interfaceNamespace() : null;
5555
if ($interfaceNamespace && $class->interfaceNamespace() !== $class->namespace) {
56-
$class->addUse(new Use_(sprintf('%s\\%s', $class->interfaceNamespace(), $class->interfaceName())));
56+
$class->addUse(new Use_(\sprintf('%s\\%s', $class->interfaceNamespace(), $class->interfaceName())));
5757
}
5858

5959
foreach ($class->properties() as $property) {
6060
if ($property->reference && $property->reference->interfaceName()) {
61-
$class->addUse(new Use_(sprintf(
61+
$class->addUse(new Use_(\sprintf(
6262
'%s\\%s',
6363
$property->reference->interfaceNamespace(),
6464
$property->reference->interfaceName()

src/ClassMutator/ClassInterfaceMutator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ public function __construct(string $desiredNamespace)
3030
*/
3131
public function __invoke(Class_ $class, array $context): void
3232
{
33-
$class->interface = new Interface_(sprintf('%sInterface', $class->name()), $this->desiredNamespace);
33+
$class->interface = new Interface_(\sprintf('%sInterface', $class->name()), $this->desiredNamespace);
3434
}
3535
}

src/ClassMutator/ClassParentMutator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __invoke(Class_ $class, array $context): void
5050

5151
if (null === $class->parent() && $subclassOf = $class->getSubClassOf()) {
5252
if (\count($subclassOf) > 1) {
53-
$this->logger ? $this->logger->info(sprintf('The type "%s" has several supertypes. Using the first one.', $class->rdfType())) : null;
53+
$this->logger ? $this->logger->info(\sprintf('The type "%s" has several supertypes. Using the first one.', $class->rdfType())) : null;
5454
}
5555

5656
if (\is_string($parentLocalName = $subclassOf[0]->localName())) {

src/ClassMutator/ClassPropertiesAppender.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function __invoke(Class_ $class, array $context): void
8484
} else {
8585
$remainingProperties = $typeConfig['properties'] ?? [];
8686
if (!isset($this->propertiesMap[$class->rdfType()])) {
87-
$this->logger ? $this->logger->warning(sprintf('Properties for "%s" not found in the map.', $class->rdfType())) : null;
87+
$this->logger ? $this->logger->warning(\sprintf('Properties for "%s" not found in the map.', $class->rdfType())) : null;
8888
}
8989
// All properties
9090
foreach ($this->propertiesMap[$class->rdfType()] ?? [] as $property) {
@@ -93,7 +93,7 @@ public function __invoke(Class_ $class, array $context): void
9393
}
9494
if ($property->hasProperty(self::SCHEMA_ORG_SUPERSEDED_BY)) {
9595
$supersededBy = $property->get(self::SCHEMA_ORG_SUPERSEDED_BY);
96-
$this->logger ? $this->logger->info(sprintf('The property "%s" is superseded by "%s". Using the superseding property.', $property->getUri(), $supersededBy->getUri())) : null;
96+
$this->logger ? $this->logger->info(\sprintf('The property "%s" is superseded by "%s". Using the superseding property.', $property->getUri(), $supersededBy->getUri())) : null;
9797
} else {
9898
$this->generateField($this->config, $class, $class->resource(), $typeConfig, $cardinalities, $property);
9999
}
@@ -117,7 +117,7 @@ public function __invoke(Class_ $class, array $context): void
117117
*/
118118
private function generateCustomField(string $propertyName, RdfResource $type, ?array $typeConfig, array $cardinalities, SchemaClass $class, array $config): void
119119
{
120-
$this->logger ? $this->logger->info(sprintf('The property "%s" (type "%s") is a custom property.', $propertyName, $type->getUri())) : null;
120+
$this->logger ? $this->logger->info(\sprintf('The property "%s" (type "%s") is a custom property.', $propertyName, $type->getUri())) : null;
121121
$customResource = new RdfResource('_:'.$propertyName, new RdfGraph());
122122
$customResource->add('rdfs:range', $type);
123123

0 commit comments

Comments
 (0)