From a11a427056b66757b83d3802f03e2bb58c15ff0a Mon Sep 17 00:00:00 2001 From: Microsoft Graph DevX Tooling Date: Mon, 2 Dec 2024 12:49:27 +0300 Subject: [PATCH] Default to get String values --- .../Writers/Php/CodeMethodWriter.cs | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs index 22438c7cf0..5d228ee5db 100644 --- a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs @@ -494,7 +494,7 @@ private string GetDeserializationMethodName(CodeTypeBase propType, CodeMethod me if (currentType.TypeDefinition is null) { //Set the parseNodeMethod to the appropriate method for the collection of primitive values - parseNodeMethod = $"getCollectionOfPrimitiveValues()"; + parseNodeMethod = $"getStringValue()"; } // else if (conventions.PrimitiveTypes.Contains(currentType.TypeDefinition.Name.ToLowerInvariant())) // { @@ -932,15 +932,7 @@ private void WriteFactoryMethodBodyForIntersectionModel(CodeMethod codeElement, { var deserializationMethodName = $"{ParseNodeVarName}->{GetDeserializationMethodName(propertyType, codeElement)}"; writer.StartBlock($"{(includeElse ? "} else " : string.Empty)}if ({deserializationMethodName} !== null) {{"); - if (deserializationMethodName.Contains("getCollectionOfPrimitiveValues", StringComparison.Ordinal)) - { - writer.WriteLine($"{ResultVarName}->{property.Setter!.Name.ToFirstCharacterLowerCase()}({ParseNodeVarName}->getStringValue());"); - } - else - { - writer.WriteLine($"{ResultVarName}->{property.Setter!.Name.ToFirstCharacterLowerCase()}({deserializationMethodName});"); - } - + writer.WriteLine($"{ResultVarName}->{property.Setter!.Name.ToFirstCharacterLowerCase()}({deserializationMethodName});"); writer.DecreaseIndent(); } if (!includeElse) @@ -1011,14 +1003,7 @@ private void WriteFactoryMethodBodyForUnionModelForUnDiscriminatedTypes(CodeMeth { var serializationMethodName = $"{ParseNodeVarName}->{GetDeserializationMethodName(property.Type, currentElement)}"; writer.StartBlock($"{(includeElse ? "} else " : string.Empty)}if ({serializationMethodName} !== null) {{"); - if (serializationMethodName.Contains("getCollectionOfPrimitiveValues", StringComparison.Ordinal)) - { - writer.WriteLine($"{ResultVarName}->{property.Setter!.Name.ToFirstCharacterLowerCase()}({ParseNodeVarName}->getStringValue());"); - } - else - { - writer.WriteLine($"{ResultVarName}->{property.Setter!.Name.ToFirstCharacterLowerCase()}({serializationMethodName});"); - } + writer.WriteLine($"{ResultVarName}->{property.Setter!.Name.ToFirstCharacterLowerCase()}({serializationMethodName});"); writer.DecreaseIndent(); if (!includeElse) includeElse = true;