style: idiomatic cleanups in small metadata/storage utility files - #414
Merged
Conversation
is-null patterns, ??-style null checks, drop Yoda conditions, and expression-bodied trivial accessors across the smaller PhoneNumbers/ support files. No behavior change.
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (87.87%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #414 +/- ##
==========================================
- Coverage 87.42% 87.38% -0.04%
==========================================
Files 41 41
Lines 3856 3852 -4
Branches 990 992 +2
==========================================
- Hits 3371 3366 -5
Misses 283 283
- Partials 202 203 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
📊 Benchmark Results
PR branch
PR base
|
CodeQL (cs/equals-uses-as) flagged the "is" type check in Equals: it treats any subclass as a match, which can break Equals' symmetry contract if a subclass adds its own comparable state. Switch to a strict GetType() check, matching the standard fix for this pattern. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Aug 26, 2026
This was referenced Aug 28, 2026
Closed
Open
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of an ongoing sweep applying idiomatic-C# readability cleanups across the codebase (same spirit as #409): pattern matching (
is null/is not null), dropping Yoda conditions, expression-bodied trivial members. No behavior change, no Java-parity changes — same logic, nicer expression.Files touched:
AreaCodeMapStorageStrategy.cs,DefaultMapStorage.cs,FlyweightMapStorage.cs,LeniencyExtensions.cs,LocaleData.cs,LocaleNames.cs,MetadataLoader.cs,MetadataManager.cs,MetadataSource.cs,PhoneNumberMatch.cs,TimezoneMapDataReader.cs.(
Util.cs,RegexCache.cs,MissingMetadataException.cs,PhoneNumberFormat.cs,PhoneNumberType.cs,InternalRegexOptions.cs,PhoneRegex.cs,NumberParseException.cs,BuildPrefixMapFromBin.cswere reviewed and left untouched — already idiomatic.)Test plan
dotnet build csharp/PhoneNumbers.slnx— clean, 0 warnings (repo hasTreatWarningsAsErrors)dotnet test csharp/PhoneNumbers.Test— 414/414 passing on net8.0 and net10.0