Skip to content

Commit c3e93f1

Browse files
IvovdBruggenIvo van der BruggenIvo van der BruggenAndyButland
authored
Fix nullability of return types that can be non-null (#15927)
* Fix nullability of Children extension * Fix nullability of methods throughout the CMS * Fix return types of some methods that cannot return null * Revert nullable changes to result of ConvertSourceToIntermediate for property editors (whilst some property editors we know won't return null, it seems more consistent to adhere to the base class and interface nullability definition). * Updated new webhook events to align with new nullability definitions. * Reverted content editing service updates to align with base classes. * Applied collection nullability updates on content repository to interface. * Reverted value converter updates to match interface. * Applied further collection updates to interface. * Aligned media service interface with implementation for nullability. * Update from code review. --------- Co-authored-by: Ivo van der Bruggen <[email protected]> Co-authored-by: Ivo van der Bruggen <[email protected]> Co-authored-by: Andy Butland <[email protected]>
1 parent c6bc4ef commit c3e93f1

File tree

154 files changed

+172
-172
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+172
-172
lines changed

src/Umbraco.Cms.Api.Common/Extensions/MethodInfoApiCommonExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ namespace Umbraco.Extensions;
88
public static class MethodInfoApiCommonExtensions
99
{
1010

11-
public static string? GetMapToApiVersionAttributeValue(this MethodInfo methodInfo)
11+
public static string GetMapToApiVersionAttributeValue(this MethodInfo methodInfo)
1212
{
1313
MapToApiVersionAttribute[] mapToApis = methodInfo.GetCustomAttributes(typeof(MapToApiVersionAttribute), inherit: true).Cast<MapToApiVersionAttribute>().ToArray();
1414

15-
return string.Join("|", mapToApis.SelectMany(x=>x.Versions));
15+
return string.Join("|", mapToApis.SelectMany(x => x.Versions));
1616
}
1717

1818
public static string? GetMapToApiAttributeValue(this MethodInfo methodInfo)

src/Umbraco.Core/DeliveryApi/ApiContentPathProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ public class ApiContentPathProvider : IApiContentPathProvider
1111
public ApiContentPathProvider(IPublishedUrlProvider publishedUrlProvider)
1212
=> _publishedUrlProvider = publishedUrlProvider;
1313

14-
public virtual string? GetContentPath(IPublishedContent content, string? culture)
14+
public virtual string GetContentPath(IPublishedContent content, string? culture)
1515
=> _publishedUrlProvider.GetUrl(content, UrlMode.Relative, culture);
1616
}

src/Umbraco.Core/Dictionary/UmbracoCultureDictionary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public DefaultCultureDictionary(CultureInfo specificCulture, ILocalizationServic
8181
/// </summary>
8282
/// <param name="key"></param>
8383
/// <returns></returns>
84-
public string? this[string key]
84+
public string this[string key]
8585
{
8686
get
8787
{

src/Umbraco.Core/Extensions/UriExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public static Uri MakeAbsolute(this Uri uri, Uri baseUri)
181181
public static Uri WithoutPort(this Uri uri) =>
182182
new Uri(uri.GetComponents(UriComponents.AbsoluteUri & ~UriComponents.Port, UriFormat.UriEscaped));
183183

184-
private static string? GetSafeQuery(this Uri uri)
184+
private static string GetSafeQuery(this Uri uri)
185185
{
186186
if (uri.IsAbsoluteUri)
187187
{

src/Umbraco.Core/Models/DictionaryItemExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static class DictionaryItemExtensions
1010
/// <param name="d"></param>
1111
/// <param name="isoCode"></param>
1212
/// <returns></returns>
13-
public static string? GetTranslatedValue(this IDictionaryItem d, string isoCode)
13+
public static string GetTranslatedValue(this IDictionaryItem d, string isoCode)
1414
{
1515
IDictionaryTranslation? trans = d.Translations.FirstOrDefault(x => x.LanguageIsoCode == isoCode);
1616
return trans == null ? string.Empty : trans.Value;

src/Umbraco.Core/Models/ReadOnlyContentBaseAdapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ private ReadOnlyContentBaseAdapter(IContentBase content) =>
2525

2626
public int Level => _content.Level;
2727

28-
public string? Path => _content.Path;
28+
public string Path => _content.Path;
2929

3030
public int SortOrder => _content.SortOrder;
3131

src/Umbraco.Core/Models/UserExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public static bool HasAccessToSensitiveData(this IUser user)
143143
/// <summary>
144144
/// Calculate start nodes, combining groups' and user's, and excluding what's in the bin
145145
/// </summary>
146-
public static int[]? CalculateAllowedLanguageIds(this IUser user, ILocalizationService localizationService)
146+
public static int[] CalculateAllowedLanguageIds(this IUser user, ILocalizationService localizationService)
147147
{
148148
var hasAccessToAllLanguages = user.Groups.Any(x => x.HasAccessToAllLanguages);
149149

src/Umbraco.Core/Persistence/Repositories/IContentRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public interface IContentRepository<in TId, TEntity> : IReadWriteQueryRepository
5252
/// <summary>
5353
/// Gets the recycle bin content.
5454
/// </summary>
55-
IEnumerable<TEntity>? GetRecycleBin();
55+
IEnumerable<TEntity> GetRecycleBin();
5656

5757
/// <summary>
5858
/// Gets the count of content items of a given content type.

src/Umbraco.Core/PropertyEditors/TextStringValueConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ public PropertyCacheLevel GetDeliveryApiPropertyCacheLevel(IPublishedPropertyTyp
5757
public Type GetDeliveryApiPropertyValueType(IPublishedPropertyType propertyType)
5858
=> GetPropertyValueType(propertyType);
5959

60-
public object ConvertIntermediateToDeliveryApiObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview, bool expanding)
60+
public object? ConvertIntermediateToDeliveryApiObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview, bool expanding)
6161
=> ConvertIntermediateToObject(owner, propertyType, referenceCacheLevel, inter, preview);
6262
}

src/Umbraco.Core/PropertyEditors/ValueConverters/BigintValueTypeConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Umbraco.Cms.Core.Models.PublishedContent;
1+
using Umbraco.Cms.Core.Models.PublishedContent;
22
using Umbraco.Extensions;
33

44
namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters;

0 commit comments

Comments
 (0)