Skip to content

Commit a269927

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: [String] Add tests for AsciiSlugger [Serializer] Fix get accessor regex in AnnotationLoader [HttpKernel] Fix passing `null` to `\trim()` method in LoggerDataCollector [Translation] Crowdin provider throw Exception when status is 50x Always attempt to listen for notifications add missing changelog entry for the AtLeastOneOf constraint validate nested constraints only if they are in the same group
2 parents 091292a + fe3bd9e commit a269927

File tree

6 files changed

+19
-2
lines changed

6 files changed

+19
-2
lines changed

Mapping/Loader/AnnotationLoader.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool
100100
continue;
101101
}
102102

103-
$getAccessor = preg_match('/^(get|)(.+)$/i', $method->name);
104-
if ($getAccessor && 0 !== $method->getNumberOfRequiredParameters()) {
103+
if (0 === stripos($method->name, 'get') && $method->getNumberOfRequiredParameters()) {
105104
continue; /* matches the BC behavior in `Symfony\Component\Serializer\Normalizer\ObjectNormalizer::extractAttributes` */
106105
}
107106

Tests/Fixtures/Annotations/IgnoreDummyAdditionalGetter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ public function getExtraValue(string $parameter)
2020
{
2121
return $parameter;
2222
}
23+
24+
public function setExtraValue2(string $parameter)
25+
{
26+
}
2327
}

Tests/Fixtures/Annotations/IgnoreDummyAdditionalGetterWithoutIgnoreAnnotations.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ public function getExtraValue(string $parameter)
1515
{
1616
return $parameter;
1717
}
18+
19+
public function setExtraValue2(string $parameter)
20+
{
21+
}
1822
}

Tests/Fixtures/Attributes/IgnoreDummyAdditionalGetter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ public function getExtraValue(string $parameter)
1818
{
1919
return $parameter;
2020
}
21+
22+
public function setExtraValue2(string $parameter)
23+
{
24+
}
2125
}

Tests/Fixtures/Attributes/IgnoreDummyAdditionalGetterWithoutIgnoreAnnotations.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ public function getExtraValue(string $parameter)
1515
{
1616
return $parameter;
1717
}
18+
19+
public function setExtraValue2(string $parameter)
20+
{
21+
}
1822
}

Tests/Mapping/Loader/AnnotationLoaderTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ public function testIgnoreGetterWirhRequiredParameterIfIgnoreAnnotationIsUsed()
157157

158158
$attributes = $classMetadata->getAttributesMetadata();
159159
self::assertArrayNotHasKey('extraValue', $attributes);
160+
self::assertArrayHasKey('extraValue2', $attributes);
160161
}
161162

162163
public function testIgnoreGetterWirhRequiredParameterIfIgnoreAnnotationIsNotUsed()
@@ -166,6 +167,7 @@ public function testIgnoreGetterWirhRequiredParameterIfIgnoreAnnotationIsNotUsed
166167

167168
$attributes = $classMetadata->getAttributesMetadata();
168169
self::assertArrayNotHasKey('extraValue', $attributes);
170+
self::assertArrayHasKey('extraValue2', $attributes);
169171
}
170172

171173
abstract protected function createLoader(): AnnotationLoader;

0 commit comments

Comments
 (0)