From d892c51b5cab65b6ec4e905e03ff7bcefdd9a33a Mon Sep 17 00:00:00 2001 From: Microsoft Graph DevX Tooling Date: Fri, 29 Nov 2024 15:02:17 +0300 Subject: [PATCH] Defaulted parseNode method to a string incase type definition is null --- src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs index d8ac6dbc6c..6f569913fe 100644 --- a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs @@ -493,7 +493,7 @@ private string GetDeserializationMethodName(CodeTypeBase propType, CodeMethod me // }; if (currentType.TypeDefinition is null) { - parseNodeMethod = $"getCollectionOfPrimitiveValues()"; + parseNodeMethod = "string"; } else if (conventions.PrimitiveTypes.Contains(currentType.TypeDefinition.Name.ToLowerInvariant())) { @@ -501,7 +501,7 @@ private string GetDeserializationMethodName(CodeTypeBase propType, CodeMethod me } else if (conventions.CustomTypes.Contains(currentType.TypeDefinition.Name.ToFirstCharacterUpperCase())) { - parseNodeMethod = currentType.TypeDefinition.Name.ToFirstCharacterUpperCase(); + parseNodeMethod = currentType.TypeDefinition.Name.ToLowerInvariant(); } else if (currentType.TypeDefinition is CodeEnum) { @@ -525,6 +525,8 @@ private string GetDeserializationMethodName(CodeTypeBase propType, CodeMethod me "streaminterface" => "getBinaryContent()", "byte" => "getByteValue()", "string" => "getStringValue()", + "date" => "getDateValue()", + "datetime" => "getDateTimeValue()", _ when conventions.PrimitiveTypes.Contains(lowerCaseType) => $"get{propertyType.ToFirstCharacterUpperCase()}Value()", _ => $"getObjectValue([{propertyType.ToFirstCharacterUpperCase()}::class, '{CreateDiscriminatorMethodName}'])", } : parseNodeMethod;