Skip to content

Commit

Permalink
Fix casing and ignore errors with hashmap keys.
Browse files Browse the repository at this point in the history
  • Loading branch information
SilasKenneth committed Oct 3, 2023
1 parent e75387d commit c0e2014
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion it/php/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ parameters:
- src
ignoreErrors:
- '#Parameter [\w\W]+ \$errorMappings of method [\w\\]+RequestAdapter::send[\w]+\(\) expects [\w\W\s]+ given\.#'
- '#getFieldDeserializers\(\) should return array\<string, callable\(Microsoft\\Kiota\\Abstractions\\Serialization\\ParseNode\)\: void\> but returns array\{[\d]\: Closure\(Microsoft\\Kiota\\Abstractions\\Serialization\\ParseNode\)\: void.+#'
- '#getFieldDeserializers\(\) should return array\<string, callable\(Microsoft\\Kiota\\Abstractions\\Serialization\\ParseNode\)\: void\> but returns array\{[\d]+\: Closure\(Microsoft\\Kiota\\Abstractions\\Serialization\\ParseNode\)\: void.+#'
4 changes: 2 additions & 2 deletions src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ private string GetDocCommentReturnType(CodeMethod codeMethod)
{
return codeMethod.Kind switch
{
CodeMethodKind.Deserializer => "array<string, callable(ParseNode): void>",
CodeMethodKind.Deserializer => "array<string|int, callable(ParseNode): void>",
CodeMethodKind.Getter when codeMethod.AccessedProperty?.IsOfKind(CodePropertyKind.AdditionalData) ?? false => "array<string, mixed>",
CodeMethodKind.Getter when codeMethod.AccessedProperty?.Type.IsCollection ?? false => $"array<{conventions.TranslateType(codeMethod.AccessedProperty.Type)}>",
_ => conventions.GetTypeString(codeMethod.ReturnType, codeMethod)
Expand Down Expand Up @@ -719,7 +719,7 @@ private void WriteRequestExecutorBody(CodeMethod codeElement, CodeClass parentCl
writer.IncreaseIndent(2);
errorMappings.ToList().ForEach(errorMapping =>
{
writer.WriteLine($"'{errorMapping.Key}' => [{errorMapping.Value.Name}::class, '{CreateDiscriminatorMethodName}'],");
writer.WriteLine($"'{errorMapping.Key}' => [{errorMapping.Value.Name.ToFirstCharacterUpperCase()}::class, '{CreateDiscriminatorMethodName}'],");
});
writer.DecreaseIndent();
writer.WriteLine("];");
Expand Down

0 comments on commit c0e2014

Please sign in to comment.