diff --git a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs index 5d228ee5db..a8601c382a 100644 --- a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs @@ -482,36 +482,12 @@ private string GetDeserializationMethodName(CodeTypeBase propType, CodeMethod me var parseNodeMethod = string.Empty; if (propType is CodeType currentType) { - var collectionMethod = propType.IsArray ? "Array" : "Collection"; if (isCollection) - // parseNodeMethod = currentType.TypeDefinition switch - // { - // //CodeType codeType when codeType.TypeDefinition == null => $"getCollectionOfPrimitiveValues([{conventions.TranslateType(propType)}::class, '{CreateDiscriminatorMethodName}'])", - // CodeEnum enumType => $"getCollectionOfEnumValues({enumType.Name.ToFirstCharacterUpperCase()}::class)", - // //CodeType codeType when conventions.PrimitiveTypes.Contains(codeType.Name.ToLowerInvariant()) => $"getCollectionOfPrimitiveValues([{conventions.TranslateType(propType)}::class, '{CreateDiscriminatorMethodName}'])", - // _ => $"getCollectionOfPrimitiveValues([{conventions.TranslateType(propType)}::class, '{CreateDiscriminatorMethodName}'])" - // }; - if (currentType.TypeDefinition is null) - { - //Set the parseNodeMethod to the appropriate method for the collection of primitive values - parseNodeMethod = $"getStringValue()"; - } - // else if (conventions.PrimitiveTypes.Contains(currentType.TypeDefinition.Name.ToLowerInvariant())) - // { - // parseNodeMethod = currentType.TypeDefinition.Name.ToLowerInvariant(); - // } - // else if (conventions.CustomTypes.Contains(currentType.TypeDefinition.Name.ToFirstCharacterUpperCase())) - // { - // parseNodeMethod = currentType.TypeDefinition.Name.ToLowerInvariant(); - // } - else if (currentType.TypeDefinition is CodeEnum) + parseNodeMethod = currentType.TypeDefinition switch { - parseNodeMethod = $"getCollectionOfEnumValues({currentType.TypeDefinition.Name.ToFirstCharacterUpperCase()}::class)"; - } - else - { - parseNodeMethod = $"getCollectionOfObjectValues([{conventions.TranslateType(propType)}::class, '{CreateDiscriminatorMethodName}'])"; - } + CodeEnum enumType => $"getCollectionOfEnumValues({enumType.Name.ToFirstCharacterUpperCase()}::class)", + _ => $"getCollectionOfObjectValues([{conventions.TranslateType(propType)}::class, '{CreateDiscriminatorMethodName}'])" + }; else if (currentType.TypeDefinition is CodeEnum) parseNodeMethod = $"getEnumValue({propertyType.ToFirstCharacterUpperCase()}::class)"; } @@ -525,9 +501,6 @@ private string GetDeserializationMethodName(CodeTypeBase propType, CodeMethod me "decimal" or "double" => "getFloatValue()", "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; @@ -956,7 +929,6 @@ private void WriteFactoryMethodBodyForIntersectionModel(CodeMethod codeElement, writer.CloseBlock(decreaseIndent: false); } - private void WriteFactoryMethodBodyForUnionModelForDiscriminatedTypes(CodeMethod codeElement, CodeClass parentClass, LanguageWriter writer) { var includeElse = false;