class KnownProblemsRegistry (View source)

Registry for known validation problems in stubs.

Some PHP entities (functions, methods) have known issues where stubs cannot perfectly match reflection data. Common cases:

  • Overloaded function signatures (multiple valid signatures, reflection returns only one)
  • Version-specific parameter changes
  • Internal implementation details that differ from public API

This registry uses a Provider pattern to load problems from type-safe PHP code, providing compile-time validation and IDE support.

Methods

__construct(KnownProblemsProvider $provider = new DefaultKnownProblemsProvider())

No description

getInstance(KnownProblemsProvider|null $provider = null)

Get singleton instance of the registry.

bool
hasProblem(string $entityType, string $entityId, string $checkName, string $phpVersion)

Check if an entity has a known problem for a specific check and PHP version.

bool
shouldSkipValidation(string $entityType, string $entityId, string $checkName, string $phpVersion)

Check if validation should be skipped for an entity.

string|null
getSkipReason(string $entityType, string $entityId, string $checkName, string $phpVersion)

Get skip reason for an entity (for logging/reporting).

static void
reset()

Reset the singleton instance (useful for testing).

array
getAllProblems()

Get all registered problems (for debugging/reporting).

array
getProblemsIndex()

Get problems index (for debugging/reporting).

Details

__construct(KnownProblemsProvider $provider = new DefaultKnownProblemsProvider())

No description

Parameters

KnownProblemsProvider $provider

static KnownProblemsRegistry getInstance(KnownProblemsProvider|null $provider = null)

Get singleton instance of the registry.

Parameters

KnownProblemsProvider|null $provider

Optional custom provider (mainly for testing)

Return Value

KnownProblemsRegistry

bool hasProblem(string $entityType, string $entityId, string $checkName, string $phpVersion)

Check if an entity has a known problem for a specific check and PHP version.

Parameters

string $entityType

Entity type: 'functions', 'methods', 'classes'

string $entityId

Fully qualified entity ID (e.g., '\dba_fetch' or 'DateTime::format')

string $checkName

Name of the check class (e.g., 'ParameterNamesCheck')

string $phpVersion

PHP version being tested (e.g., '8.0')

Return Value

bool

True if entity has a known problem for this check and version

bool shouldSkipValidation(string $entityType, string $entityId, string $checkName, string $phpVersion)

Check if validation should be skipped for an entity.

Parameters

string $entityType

Entity type: 'functions', 'methods', 'classes'

string $entityId

Fully qualified entity ID

string $checkName

Name of the check class

string $phpVersion

PHP version being tested

Return Value

bool

True if validation should be skipped

string|null getSkipReason(string $entityType, string $entityId, string $checkName, string $phpVersion)

Get skip reason for an entity (for logging/reporting).

Parameters

string $entityType

Entity type: 'functions', 'methods', 'classes'

string $entityId

Fully qualified entity ID

string $checkName

Name of the check class

string $phpVersion

PHP version being tested

Return Value

string|null

Skip reason or null if validation should not be skipped

static void reset()

Reset the singleton instance (useful for testing).

Return Value

void

array getAllProblems()

Get all registered problems (for debugging/reporting).

Return Value

array

All problems from provider

array getProblemsIndex()

Get problems index (for debugging/reporting).

Return Value

array