Skip to content

Commit 8360186

Browse files
committed
fix(serializer): remove dead native-type guards in AbstractItemNormalizerTest
The #8393 nullable denormalization tests guarded on method_exists(PropertyInfoExtractor::class, 'getType') with an unqualified class (resolving to the test namespace), so they were always skipped and PHPStan flagged the call as always-false. With the Symfony ^7.4 floor native types are guaranteed; drop the guards so the tests actually run.
1 parent 88f458a commit 8360186

1 file changed

Lines changed: 0 additions & 14 deletions

File tree

src/Serializer/Tests/AbstractItemNormalizerTest.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,12 +1193,6 @@ public function testUnionTypeCollectionDenormalizationAcceptsAnyMember(): void
11931193

11941194
public function testDenormalizeNullableCollectionOfBackedEnums(): void
11951195
{
1196-
// Nullable collection value types (NullableType wrapping ObjectType/BackedEnumType) only exist
1197-
// in the native TypeInfo system.
1198-
if (!method_exists(PropertyInfoExtractor::class, 'getType')) {
1199-
$this->markTestSkipped('Requires symfony/property-info >= 7.1 (native types).');
1200-
}
1201-
12021196
$data = ['notificationType' => ['email']];
12031197

12041198
$propertyNameCollectionFactory = $this->createStub(PropertyNameCollectionFactoryInterface::class);
@@ -1244,11 +1238,6 @@ public function testDenormalizeNullableCollectionOfBackedEnums(): void
12441238

12451239
public function testDenormalizeWrongTypedValueForNullableObjectPropertyPreservesNormalizerException(): void
12461240
{
1247-
// Nullable object types (NullableType wrapping ObjectType) only exist in the native TypeInfo system.
1248-
if (!method_exists(PropertyInfoExtractor::class, 'getType')) {
1249-
$this->markTestSkipped('Requires symfony/property-info >= 7.1 (native types).');
1250-
}
1251-
12521241
// What Symfony's DateTimeNormalizer throws for a value it cannot parse.
12531242
$normalizerException = NotNormalizableValueException::createForUnexpectedDataType('The data is either not an string, an empty string, or null; you should pass a string that can be parsed with the passed format or a valid DateTime string.', false, ['string'], 'dummyDate', true);
12541243

@@ -1267,9 +1256,6 @@ public function testDenormalizeWrongTypedValueForNullableObjectPropertyPreserves
12671256

12681257
public function testDenormalizeWrongTypedValueForNonNullableObjectPropertyPreservesNormalizerException(): void
12691258
{
1270-
if (!method_exists(PropertyInfoExtractor::class, 'getType')) {
1271-
$this->markTestSkipped('Requires symfony/property-info >= 7.1 (native types).');
1272-
}
12731259

12741260
$normalizerException = NotNormalizableValueException::createForUnexpectedDataType('The data is either not an string, an empty string, or null; you should pass a string that can be parsed with the passed format or a valid DateTime string.', false, ['string'], 'dummyDate', true);
12751261

0 commit comments

Comments
 (0)