Adding not null when annotation (#17379)

This commit is contained in:
Elitsa Marinovska
2024-10-28 11:35:48 +01:00
committed by GitHub
parent 853e605665
commit 5cc0a35665
2 changed files with 5 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.Navigation;
using Umbraco.Cms.Core.Persistence.Repositories;
@@ -64,11 +65,10 @@ internal abstract class ContentNavigationServiceBase
public bool TryGetSiblingsKeysInBin(Guid key, out IEnumerable<Guid> siblingsKeys)
=> TryGetSiblingsKeysFromStructure(_recycleBinNavigationStructure, key, out siblingsKeys);
public bool TryGetLevel(Guid contentKey, out int? level)
public bool TryGetLevel(Guid contentKey, [NotNullWhen(true)] out int? level)
{
level = 1;
Guid? parentKey;
if (TryGetParentKey(contentKey, out parentKey) is false)
if (TryGetParentKey(contentKey, out Guid? parentKey) is false)
{
level = null;
return false;

View File

@@ -1,3 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using Umbraco.Extensions;
namespace Umbraco.Cms.Core.Services.Navigation;
@@ -44,5 +45,5 @@ public interface INavigationQueryService
bool TryGetSiblingsKeys(Guid key, out IEnumerable<Guid> siblingsKeys);
bool TryGetLevel(Guid contentKey, out int? level);
bool TryGetLevel(Guid contentKey, [NotNullWhen(true)] out int? level);
}