Skip to content

Commit 18b8c18

Browse files
authored
Fix analyzer RCS1108 (#1469)
1 parent 0dc268d commit 18b8c18

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Fix analyzer [RCS1108](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1108) ([PR](https://github.com/dotnet/roslynator/pull/1469))
13+
1014
## [4.12.3] - 2024-05-10
1115

1216
### Fixed

src/Analyzers/CSharp/Analysis/AddStaticModifierToAllPartialClassDeclarationsAnalyzer.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,9 @@ private static void AnalyzeNamedType(SymbolAnalysisContext context)
5454

5555
foreach (SyntaxReference syntaxReference in syntaxReferences)
5656
{
57-
var classDeclaration = (ClassDeclarationSyntax)syntaxReference.GetSyntax(context.CancellationToken);
57+
var classDeclaration = syntaxReference.GetSyntax(context.CancellationToken) as ClassDeclarationSyntax;
5858

59-
SyntaxTokenList modifiers = classDeclaration.Modifiers;
60-
61-
if (!modifiers.Contains(SyntaxKind.StaticKeyword))
59+
if (classDeclaration?.Modifiers.Contains(SyntaxKind.StaticKeyword) == false)
6260
{
6361
DiagnosticHelpers.ReportDiagnostic(
6462
context,

0 commit comments

Comments
 (0)