Skip to content

Conversation

Wykaz
Copy link

@Wykaz Wykaz commented Sep 19, 2025

What

Adds a new allow_partial_paths configuration option that allows type coverage analysis to run even when analyzing only specific subpaths (e.g., vendor/bin/phpstan analyze src/Controller).

Why

By default, type-coverage only triggers when full paths are analyzed to avoid false positives from incomplete data. However, there are cases where users want to check type coverage on specific subpaths despite potential inaccuracies.

How

  • Added allow_partial_paths: bool configuration option (defaults to false)
  • Modified all coverage rules to respect this new option via ScopeConfigurationResolver::shouldSkipPartialPathsAnalysis()
  • Updated documentation with usage examples and warnings

Usage

# phpstan.neon
parameters:
    type_coverage:
        return: 50
        param: 35.5
        property: 70
        
        allow_partial_paths: true  # Enable analysis on partial paths

@TomasVotruba
Copy link
Owner

Hi, thanks for proposal.
I understand the use case, but I want to keep this package as simple as possible, to do one job. Full type coverage.

Goal of this package is to provide type coverage to full project, not just parts of the project. Only 99 % type coverage in the whole project is job well done for this tool 👍

Thanks for understanding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants