Skip to content

Commit 5752f91

Browse files
authored
Merge pull request #4807 from soyuka/merge-2.7
Merge 2.7
2 parents 35c5ccf + 0dc180d commit 5752f91

File tree

24 files changed

+56
-77
lines changed

24 files changed

+56
-77
lines changed

src/Doctrine/Common/Filter/BooleanFilterTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ abstract protected function getProperties(): ?array;
6565

6666
abstract protected function getLogger(): LoggerInterface;
6767

68-
abstract protected function normalizePropertyName($property);
68+
abstract protected function normalizePropertyName($property): string;
6969

7070
/**
7171
* Determines whether the given property refers to a boolean field.

src/Doctrine/Common/Filter/DateFilterTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function getDescription(string $resourceClass): array
5555

5656
abstract protected function getProperties(): ?array;
5757

58-
abstract protected function normalizePropertyName($property);
58+
abstract protected function normalizePropertyName($property): string;
5959

6060
/**
6161
* Determines whether the given property refers to a date field.

src/Doctrine/Common/Filter/ExistsFilterTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ abstract protected function getProperties(): ?array;
6868

6969
abstract protected function getLogger(): LoggerInterface;
7070

71-
abstract protected function normalizePropertyName($property);
71+
abstract protected function normalizePropertyName($property): string;
7272

7373
private function normalizeValue($value, string $property): ?bool
7474
{

src/Doctrine/Common/Filter/NumericFilterTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ abstract protected function getProperties(): ?array;
6969

7070
abstract protected function getLogger(): LoggerInterface;
7171

72-
abstract protected function normalizePropertyName($property);
72+
abstract protected function normalizePropertyName($property): string;
7373

7474
/**
7575
* Determines whether the given property refers to a numeric field.

src/Doctrine/Common/Filter/OrderFilterTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function getDescription(string $resourceClass): array
6767

6868
abstract protected function getProperties(): ?array;
6969

70-
abstract protected function normalizePropertyName($property);
70+
abstract protected function normalizePropertyName($property): string;
7171

7272
private function normalizeValue($value, string $property): ?string
7373
{

src/Doctrine/Common/Filter/RangeFilterTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ abstract protected function getProperties(): ?array;
5858

5959
abstract protected function getLogger(): LoggerInterface;
6060

61-
abstract protected function normalizePropertyName($property);
61+
abstract protected function normalizePropertyName($property): string;
6262

6363
/**
6464
* Gets filter description.

src/Doctrine/Common/Filter/SearchFilterTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ abstract protected function getIriConverter(): IriConverterInterface;
113113

114114
abstract protected function getPropertyAccessor(): PropertyAccessorInterface;
115115

116-
abstract protected function normalizePropertyName($property);
116+
abstract protected function normalizePropertyName($property): string;
117117

118118
/**
119119
* Gets the ID from an IRI or a raw ID.

src/Doctrine/Odm/Filter/SearchFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public function __construct(ManagerRegistry $managerRegistry, IriConverterInterf
4949
parent::__construct($managerRegistry, $logger, $properties, $nameConverter);
5050

5151
$this->iriConverter = $iriConverter;
52-
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
5352
$this->identifiersExtractor = $identifiersExtractor;
53+
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
5454
}
5555

5656
protected function getIriConverter(): IriConverterInterface

src/Metadata/Extractor/ResourceExtractorTrait.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,16 @@ private function buildArgs(SimpleXMLElement $resource): ?array
9797
return $data;
9898
}
9999

100-
/**
101-
* @return string[]
102-
*/
103100
private function buildValues(SimpleXMLElement $resource): array
104101
{
105102
$data = [];
106103
foreach ($resource->value as $value) {
107104
if (null !== $value->attributes()->name) {
108-
$data[(string) $value->attributes()->name] = isset($value->values) ? $this->buildValues($value->values) : (string) $value;
105+
$data[(string) $value->attributes()->name] = isset($value->values) ? $this->buildValues($value->values) : XmlUtils::phpize($value->__toString());
109106
continue;
110107
}
111108

112-
$data[] = isset($value->values) ? $this->buildValues($value->values) : (string) $value;
109+
$data[] = isset($value->values) ? $this->buildValues($value->values) : XmlUtils::phpize($value->__toString());
113110
}
114111

115112
return $data;

src/Serializer/AbstractItemNormalizer.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,13 @@ protected function getAllowedAttributes($classOrObject, array $context, $attribu
364364
return parent::getAllowedAttributes($classOrObject, $context, $attributesAsString);
365365
}
366366

367+
$resourceClass = $this->resourceClassResolver->getResourceClass(null, $context['resource_class']); // fix for abstract classes and interfaces
367368
$options = $this->getFactoryOptions($context);
368-
$propertyNames = $this->propertyNameCollectionFactory->create($context['resource_class'], $options);
369+
$propertyNames = $this->propertyNameCollectionFactory->create($resourceClass, $options);
369370

370371
$allowedAttributes = [];
371372
foreach ($propertyNames as $propertyName) {
372-
$propertyMetadata = $this->propertyMetadataFactory->create($context['resource_class'], $propertyName, $options);
373+
$propertyMetadata = $this->propertyMetadataFactory->create($resourceClass, $propertyName, $options);
373374

374375
if (
375376
$this->isAllowedAttribute($classOrObject, $propertyName, null, $context) &&

0 commit comments

Comments
 (0)