Skip to content

Commit

Permalink
Fix analyzer RCS1108 (#1469)
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt committed May 15, 2024
1 parent 0dc268d commit 18b8c18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fix analyzer [RCS1108](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1108) ([PR](https://github.com/dotnet/roslynator/pull/1469))

## [4.12.3] - 2024-05-10

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ private static void AnalyzeNamedType(SymbolAnalysisContext context)

foreach (SyntaxReference syntaxReference in syntaxReferences)
{
var classDeclaration = (ClassDeclarationSyntax)syntaxReference.GetSyntax(context.CancellationToken);
var classDeclaration = syntaxReference.GetSyntax(context.CancellationToken) as ClassDeclarationSyntax;

SyntaxTokenList modifiers = classDeclaration.Modifiers;

if (!modifiers.Contains(SyntaxKind.StaticKeyword))
if (classDeclaration?.Modifiers.Contains(SyntaxKind.StaticKeyword) == false)
{
DiagnosticHelpers.ReportDiagnostic(
context,
Expand Down

0 comments on commit 18b8c18

Please sign in to comment.