diff --git a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs index 969bdccd0b..81598a7508 100644 --- a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs @@ -491,7 +491,15 @@ private string GetDeserializationMethodName(CodeTypeBase propType, CodeMethod me // //CodeType codeType when conventions.PrimitiveTypes.Contains(codeType.Name.ToLowerInvariant()) => $"getCollectionOfPrimitiveValues([{conventions.TranslateType(propType)}::class, '{CreateDiscriminatorMethodName}'])", // _ => $"getCollectionOfPrimitiveValues([{conventions.TranslateType(propType)}::class, '{CreateDiscriminatorMethodName}'])" // }; - if (currentType.TypeDefinition != null && conventions.PrimitiveTypes.Contains(currentType.TypeDefinition.Name.ToLowerInvariant())) + if (currentType.TypeDefinition is null) + { + parseNodeMethod = "object"; + } + else if (conventions.PrimitiveTypes.Contains(currentType.TypeDefinition.Name.ToLowerInvariant())) + { + parseNodeMethod = currentType.TypeDefinition.Name.ToLowerInvariant(); + } + else if (conventions.CustomTypes.Contains(currentType.TypeDefinition.Name.ToLowerInvariant())) { parseNodeMethod = currentType.TypeDefinition.Name.ToLowerInvariant(); }