Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ceff3bd

Browse files
committed
Fabbot fixes
1 parent 6bc41a5 commit ceff3bd

File tree

5 files changed

+14
-21
lines changed

5 files changed

+14
-21
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
* Annotation class for @SerializedName().
1818
*
1919
* @Annotation
20+
*
2021
* @NamedArgumentConstructor
22+
*
2123
* @Target({"PROPERTY", "METHOD"})
2224
*
2325
* @author Fabien Bourigault <[email protected]>

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
* Annotation class for @SerializedPath().
2020
*
2121
* @Annotation
22+
*
2223
* @NamedArgumentConstructor
24+
*
2325
* @Target({"PROPERTY", "METHOD"})
2426
*
2527
* @author Tobias Bönner <[email protected]>
@@ -31,9 +33,9 @@ final class SerializedPath
3133

3234
public function __construct(string $serializedPath)
3335
{
34-
try {
35-
$this->serializedPath = new PropertyPath($serializedPath);
36-
} catch (InvalidPropertyPathException $pathException) {
36+
try {
37+
$this->serializedPath = new PropertyPath($serializedPath);
38+
} catch (InvalidPropertyPathException $pathException) {
3739
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a valid property path.', self::class));
3840
}
3941
}

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
namespace Symfony\Component\Serializer\Normalizer;
1313

1414
use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException;
15-
use Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException;
1615
use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
1716
use Symfony\Component\PropertyAccess\Exception\UninitializedPropertyException;
1817
use Symfony\Component\PropertyAccess\PropertyAccess;
19-
use Symfony\Component\PropertyAccess\PropertyPath;
2018
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
2119
use Symfony\Component\PropertyInfo\Type;
2220
use Symfony\Component\Serializer\Encoder\CsvEncoder;
@@ -137,9 +135,6 @@ public function __construct(ClassMetadataFactoryInterface $classMetadataFactory
137135
$this->objectClassResolver = $objectClassResolver;
138136
}
139137

140-
/**
141-
* @param array $context
142-
*/
143138
public function supportsNormalization(mixed $data, string $format = null /* , array $context = [] */)
144139
{
145140
return \is_object($data) && !$data instanceof \Traversable;
@@ -292,14 +287,9 @@ abstract protected function extractAttributes(object $object, string $format = n
292287

293288
/**
294289
* Gets the attribute value.
295-
*
296-
* @return mixed
297290
*/
298291
abstract protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []);
299292

300-
/**
301-
* @param array $context
302-
*/
303293
public function supportsDenormalization(mixed $data, string $type, string $format = null /* , array $context = [] */)
304294
{
305295
return class_exists($type) || (interface_exists($type, false) && $this->classDiscriminatorResolver && null !== $this->classDiscriminatorResolver->getMappingForClass($type));
@@ -327,7 +317,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
327317

328318
$nestedAttributes = $this->getNestedAttributes($resolvedClass);
329319
$nestedData = [];
330-
$propertyAccessor = PropertyAccess::createPropertyAccessor();
320+
$propertyAccessor = PropertyAccess::createPropertyAccessor();
331321
foreach ($nestedAttributes as $property => $serializedPath) {
332322
if (null === $value = $propertyAccessor->getValue($normalizedData, $serializedPath)) {
333323
continue;
@@ -657,6 +647,7 @@ private function updateData(array $data, string $attribute, mixed $attributeValu
657647
throw new LogicException(sprintf('The element you are trying to set is already populated: "%s".', (string) $serializedPath));
658648
}
659649
$propertyAccessor->setValue($data, $serializedPath, $attributeValue);
650+
660651
return $data;
661652
}
662653

@@ -793,5 +784,4 @@ private function removeNestedValue(array $path, array $data): array
793784

794785
return $data;
795786
}
796-
797787
}

src/Symfony/Component/Serializer/Tests/Annotation/SerializedPathTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class SerializedPathTest extends TestCase
2424
public function testEmptyStringSerializedPathParameter()
2525
{
2626
$this->expectException(InvalidArgumentException::class);
27-
$this->expectExceptionMessage('Parameter of annotation "Symfony\Component\Serializer\Annotation\SerializedPath" must be a valid property path.');
27+
$this->expectExceptionMessage('Parameter of annotation "Symfony\Component\Serializer\Annotation\SerializedPath" must be a valid property path.');
2828

2929
new SerializedPath('');
3030
}
@@ -33,8 +33,7 @@ public function testSerializedPath()
3333
{
3434
$path = '[one][two]';
3535
$serializedPath = new SerializedPath($path);
36-
$propertyPath = new PropertyPath($path);
36+
$propertyPath = new PropertyPath($path);
3737
$this->assertEquals($propertyPath, $serializedPath->getSerializedPath());
3838
}
39-
4039
}

src/Symfony/Component/Serializer/Tests/Mapping/AttributeMetadataTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function testSerializedName()
6262
public function testSerializedPath()
6363
{
6464
$attributeMetadata = new AttributeMetadata('path');
65-
$serializedPath = new PropertyPath('[serialized][path]');
65+
$serializedPath = new PropertyPath('[serialized][path]');
6666
$attributeMetadata->setSerializedPath($serializedPath);
6767

6868
$this->assertEquals($serializedPath, $attributeMetadata->getSerializedPath());
@@ -129,7 +129,7 @@ public function testGetContextsForGroups()
129129

130130
public function testMerge()
131131
{
132-
$serializedPath = new PropertyPath('[a4][a5]');
132+
$serializedPath = new PropertyPath('[a4][a5]');
133133
$attributeMetadata1 = new AttributeMetadata('a1');
134134
$attributeMetadata1->addGroup('a');
135135
$attributeMetadata1->addGroup('b');
@@ -179,7 +179,7 @@ public function testSerialize()
179179
$attributeMetadata->addGroup('b');
180180
$attributeMetadata->setMaxDepth(3);
181181
$attributeMetadata->setSerializedName('serialized_name');
182-
$serializedPath = new PropertyPath('[serialized][path]');
182+
$serializedPath = new PropertyPath('[serialized][path]');
183183
$attributeMetadata->setSerializedPath($serializedPath);
184184

185185
$serialized = serialize($attributeMetadata);

0 commit comments

Comments
 (0)