Skip to content

Commit 0d1d2b7

Browse files
authored
Updated code to remove unnecessary null coalescing (#8340)
1 parent d8d95f9 commit 0d1d2b7

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

src/HotChocolate/AspNetCore/src/AspNetCore.Authorization.Opa/Request/DefaultQueryRequestFactory.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ public OpaQueryRequest CreateRequest(OpaAuthorizationHandlerContext context, Aut
4242

4343
var originalRequest = new OriginalRequest(
4444
httpContext.Request.Headers,
45+
#if NET8_0
46+
httpContext.Request.Host.Value,
47+
#else
4548
httpContext.Request.Host.Value ?? string.Empty,
49+
#endif
4650
httpContext.Request.Method,
4751
httpContext.Request.Path.Value!,
4852
httpContext.Request.Query,

src/HotChocolate/Core/src/Execution.Abstractions/GraphQLException.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public GraphQLException(IError error)
2929
/// <param name="errors">The errors.</param>
3030
public GraphQLException(params IError[] errors)
3131
{
32-
Errors = errors ?? [];
32+
Errors = errors;
3333
}
3434

3535
/// <summary>
@@ -38,7 +38,7 @@ public GraphQLException(params IError[] errors)
3838
/// <param name="errors">The errors.</param>
3939
public GraphQLException(IEnumerable<IError> errors)
4040
{
41-
Errors = new List<IError>(errors ?? []).AsReadOnly();
41+
Errors = new List<IError>(errors).AsReadOnly();
4242
}
4343

4444
/// <summary>

src/HotChocolate/Core/test/Execution.Tests/Integration/HelloWorldCodeFirst/QueryHelloWorld.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ protected override void Configure(IObjectTypeDescriptor descriptor)
1818

1919
descriptor.Field("hello")
2020
.Argument("to", a => a.Type<StringType>())
21-
.Resolve(c => c.ArgumentValue<string>("to") ?? "world");
21+
.Resolve(c => c.ArgumentValue<string?>("to") ?? "world");
2222

2323
descriptor.Field("state").Resolve(() => DataStore.State);
2424
}

src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadSchemaHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public string Upload(
5858

5959
if (objectSingle is not null)
6060
{
61-
return objectSingle.Bar!.Baz!.File!.ReadContents() ?? "null";
61+
return objectSingle.Bar!.Baz!.File!.ReadContents();
6262
}
6363

6464
if (objectList is not null)

0 commit comments

Comments
 (0)