8000 minor #52159 [Serializer] Replace "annotation" wording by "attribute"… · symfony/symfony@2f247cf · GitHub
[go: up one dir, main page]

Skip to content

Commit 2f247cf

Browse files
minor #52159 [Serializer] Replace "annotation" wording by "attribute" (nicolas-grekas)
This PR was merged into the 6.4 branch. Discussion ---------- [Serializer] Replace "annotation" wording by "attribute" | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT Commits ------- 8cdac69 [Serializer] Replace "annotation" wording by "attribute"
2 parents 7402279 + 8cdac69 commit 2f247cf

File tree

17 files changed

+24
-27
lines changed

17 files changed

+24
-27
lines changed

src/Symfony/Component/Routing/Loader/AttributeClassLoader.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ public function setRouteAnnotationClass(string $class)
109109
}
110110

111111
/**
112-
* Loads from annotations from a class.
113-
*
114112
* @throws \InvalidArgumentException When route can't be parsed
115113
*/
116114
public function load(mixed $class, string $type = null): RouteCollection
@@ -121,7 +119,7 @@ public function load(mixed $class, string $type = null): RouteCollection
121119

122120
$class = new \ReflectionClass($class);
123121
if ($class->isAbstract()) {
124-
throw new \InvalidArgumentException(sprintf('Annotations from class "%s" cannot be read as it is abstract.', $class->getName()));
122+
throw new \InvalidArgumentException(sprintf('Attributes from class "%s" cannot be read as it is abstract.', $class->getName()));
125123
}
126124

127125
$this->hasDeprecatedAnnotations = false;

src/Symfony/Component/Routing/Loader/AttributeFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AttributeFileLoader extends FileLoader
3030
public function __construct(FileLocatorInterface $locator, AttributeClassLoader $loader)
3131
{
3232
if (!\function_exists('token_get_all')) {
33-
throw new \LogicException('The Tokenizer extension is required for the routing annotation loaders.');
33+
throw new \LogicException('The Tokenizer extension is required for the routing attribute loader.');
3434
}
3535

3636
parent::__construct($locator);
@@ -39,7 +39,7 @@ public function __construct(FileLocatorInterface $locator, AttributeClassLoader
3939
}
4040

4141
/**
42-
* Loads from annotations from a file.
42+
* Loads from attributes from a file.
4343
*
4444
* @throws \InvalidArgumentException When the file does not exist or its routes cannot be parsed
4545
*/

src/Symfony/Component/Serializer/Annotation/Context.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ public function __construct(
3939
string|array $groups = [],
4040
) {
4141
if (!$context && !$normalizationContext && !$denormalizationContext) {
42-
throw new InvalidArgumentException(sprintf('At least one of the "context", "normalizationContext", or "denormalizationContext" options of annotation "%s" must be provided as a non-empty array.', static::class));
42+
throw new InvalidArgumentException(sprintf('At least one of the "context", "normalizationContext", or "denormalizationContext" options must be provided as a non-empty array to "%s".', static::class));
4343
}
4444

4545
$this->groups = (array) $groups;
4646

4747
foreach ($this->groups as $group) {
4848
if (!\is_string($group)) {
49-
throw new InvalidArgumentException(sprintf('Parameter "groups" of annotation "%s" must be a string or an array of strings. Got "%s".', static::class, get_debug_type($group)));
49+
throw new InvalidArgumentException(sprintf('Parameter "groups" given to "%s" must be a string or an array of strings, "%s" given.', static::class, get_debug_type($group)));
5050
}
5151
}
5252
}

src/Symfony/Component/Serializer/Annotation/DiscriminatorMap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ public function __construct(
3030
private readonly array $mapping,
3131
) {
3232
if (empty($typeProperty)) {
33-
throw new InvalidArgumentException(sprintf('Parameter "typeProperty" of annotation "%s" cannot be empty.', static::class));
33+
throw new InvalidArgumentException(sprintf('Parameter "typeProperty" given to "%s" cannot be empty.', static::class));
3434
}
3535

3636
if (empty($mapping)) {
37-
throw new InvalidArgumentException(sprintf('Parameter "mapping" of annotation "%s" cannot be empty.', static::class));
37+
throw new InvalidArgumentException(sprintf('Parameter "mapping" given to "%s" cannot be empty.', static::class));
3838
}
3939
}
4040

src/Symfony/Component/Serializer/Annotation/Groups.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ public function __construct(string|array $groups)
3838
$this->groups = (array) $groups;
3939

4040
if (!$this->groups) {
41-
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" cannot be empty.', static::class));
41+
throw new InvalidArgumentException(sprintf('Parameter given to "%s" cannot be empty.', static::class));
4242
}
4343

4444
foreach ($this->groups as $group) {
4545
if (!\is_string($group) || '' === $group) {
46-
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a string or an array of non-empty strings.', static::class));
46+
throw new InvalidArgumentException(sprintf('Parameter given to "%s" must be a string or an array of non-empty strings.', static::class));
4747
}
4848
}
4949
}

src/Symfony/Component/Serializer/Annotation/MaxDepth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class MaxDepth
2828
public function __construct(private readonly int $maxDepth)
2929
{
3030
if ($maxDepth <= 0) {
31-
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a positive integer.', static::class));
31+
throw new InvalidArgumentException(sprintf('Parameter given to "%s" must be a positive integer.', static::class));
3232
}
3333
}
3434

src/Symfony/Component/Serializer/Annotation/SerializedName.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class SerializedName
2828
public function __construct(private readonly string $serializedName)
2929
{
3030
if ('' === $serializedName) {
31-
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a non-empty string.', self::class));
31+
throw new InvalidArgumentException(sprintf('Parameter given to "%s" must be a non-empty string.', self::class));
3232
}
3333
}
3434

src/Symfony/Component/Serializer/Annotation/SerializedPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(string $serializedPath)
3434
try {
3535
$this->serializedPath = new PropertyPath($serializedPath);
3636
} catch (InvalidPropertyPathException $pathException) {
37-
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a valid property path.', self::class));
37+
throw new InvalidArgumentException(sprintf('Parameter given to "%s" must be a valid property path.', self::class));
3838
}
3939
}
4040

src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private function getCacheValueForNormalization(string $propertyName, string $cla
8080
}
8181

8282
if (null !== $attributesMetadata[$propertyName]->getSerializedName() && null !== $attributesMetadata[$propertyName]->getSerializedPath()) {
83-
throw new LogicException(sprintf('Found SerializedName and SerializedPath annotations on property "%s" of class "%s".', $propertyName, $class));
83+
throw new LogicException(sprintf('Found SerializedName and SerializedPath attributes on property "%s" of class "%s".', $propertyName, $class));
8484
}
8585

8686
return $attributesMetadata[$propertyName]->getSerializedName() ?? null;
@@ -124,7 +124,7 @@ private function getCacheValueForAttributesMetadata(string $class, array $contex
124124
}
125125

126126
if (null !== $metadata->getSerializedName() && null !== $metadata->getSerializedPath()) {
127-
throw new LogicException(sprintf('Found SerializedName and SerializedPath annotations on property "%s" of class "%s".', $name, $class));
127+
throw new LogicException(sprintf('Found SerializedName and SerializedPath attributes on property "%s" of class "%s".', $name, $class));
128128
}
129129

130130
$metadataGroups = $metadata->getGroups();

src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
349349
$notConverted = $attribute;
350350
$attribute = $this->nameConverter->denormalize($attribute, $resolvedClass, $format, $context);
351351
if (isset($nestedData[$notConverted]) && !isset($originalNestedData[$attribute])) {
352-
throw new LogicException(sprintf('Duplicate values for key "%s" found. One value is set via the SerializedPath annotation: "%s", the other one is set via the SerializedName annotation: "%s".', $notConverted, implode('->', $nestedAttributes[$notConverted]->getElements()), $attribute));
352+
throw new LogicException(sprintf('Duplicate values for key "%s" found. One value is set via the SerializedPath attribute: "%s", the other one is set via the SerializedName attribute: "%s".', $notConverted, implode('->', $nestedAttributes[$notConverted]->getElements()), $attribute));
353353
}
354354
}
355355

@@ -756,7 +756,7 @@ private function isUninitializedValueError(\Error $e): bool
756756
}
757757

758758
/**
759-
* Returns all attributes with a SerializedPath annotation and the respective path.
759+
* Returns all attributes with a SerializedPath attribute and the respective path.
760760
*/
761761
private function getNestedAttributes(string $class): array
762762
{

0 commit comments

Comments
 (0)
0