Skip to content

UnusedDeclaration inspection on the main source directory #2661

@Haehnchen

Description

@Haehnchen

Bash(cat > /tmp/find_test_only_v3.kt << 'EOF'
import com.intellij.openapi.application.ReadAction…)
⎿  Executing: /tmp/find_test_only_v3.kt
Project: Symfony Plugin http://127.0.0.1:8568
Execution time: 87120 ms
… +56 lines (ctrl+o to expand)
⎿  (timeout 10m)

● Here are the results:


Phase 1: Truly Unused Code (UnusedDeclaration / UnusedSymbol)

Only 7 warnings in one file:

src/main/kotlin/.../mcp/McpToolSetting.kt

  • Two constructors never used
  • setToolId, getToolName, setToolName, getDescription, setDescription — all unused

Phase 2: Methods Only Used in Tests (93 found)

Checked 4,747 methods/functions across 801 files. Notable findings:

High-value candidates to review (many test refs = well-tested but dead in production):

┌───────────────────────────────────────────────┬───────────┐
│ Method │ Test refs │
├───────────────────────────────────────────────┼───────────┤
│ DoctrineMetadataModel#getField │ 107 │
├───────────────────────────────────────────────┼───────────┤
│ SymfonyImplicitUsageProvider#isImplicitUsage │ 42 │
├───────────────────────────────────────────────┼───────────┤
│ ServiceIndexUtil#matchesResourcesGlob │ 26 │
├───────────────────────────────────────────────┼───────────┤
│ ServicePropertyInsertUtil#getInjectionService │ 16 │
├───────────────────────────────────────────────┼───────────┤
│ ContainerCollectionResolver#hasServiceNames │ 14 │
├───────────────────────────────────────────────┼───────────┤
│ TwigPathIndex#getNamespacePaths │ 16 │
└───────────────────────────────────────────────┴───────────┘

Parsers only called from tests (likely should be internal/test helpers):

  • ConsoleCommandServiceParser#parser, DomainMappings#parser, EntityNamesServiceParser#parser, TwigPathServiceParser#parser, XmlTagParser#parser, etc.

Interface implementations called only from tests (the interface contract may prevent deletion):

  • TwigBlockSymbolContributor#processElementsWithName/processNames
  • TemplateReference#bindToElement/handleElementRename
  • AddServiceXmlArgumentLocalQuickFix#startInWriteAction

Kotlin-only:

  • SymfonyConsoleRunAnythingProvider#getMainListItem/getValues
  • SymfonyEndpointProvider (5 methods)
  • SymfonyShellCommandSpecsProvider#getCommandSpecs

Note: Some of these are interface/extension point implementations that IntelliJ calls via reflection — those shouldn't be deleted even if no direct code references them. Focus cleanup on parser helpers and utility methods first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions