FunctionPhpDocConformsSignatureCheck
class FunctionPhpDocConformsSignatureCheck extends AbstractCallableCheck (View source)
Validates that PhpDoc types in stubs are compatible with their signature types for global functions.
This is a stubs-only check (reflection data is never used). For each function identified by $entityId the validator:
- Looks up the function in stubs using version-aware selection.
- If not found, silently succeeds — FunctionExistsCheck handles absence.
- For both return type and each parameter, compares the signature type with the PhpDoc type using the permissive compatibility algorithm in PhpDocConformanceTrait.
- Reports mismatches where sig and PhpDoc types share no common component.
Intentional patterns (typed-array narrowing, phpstan generics, resource widening, bool/false split) are accepted by the algorithm and will not be reported.
Known problems are supported at function level:
- EntityType::FUNCTION + functionId + 'PhpDocConformsSignatureCheck' → skips the check for that specific function.
Properties
| protected ReflectionProviderInterface | $reflectionProvider | from AbstractReflectionCheck | |
| protected KnownProblemsRegistry | $knownProblemsRegistry | from AbstractReflectionCheck | |
| protected EntityLookupService | $entityLookup | from AbstractCallableCheck |
Methods
No description
Records a skipped-success result if a known problem covers this entity, and returns true.
Find a function or method in the given storage.
No description
Details
__construct(ReflectionProviderInterface|null $reflectionProvider = null, KnownProblemsRegistry|null $knownProblemsRegistry = null, PhpDocConformanceService|null $conformanceService = null)
No description
protected bool
skipWithKnownProblem(CheckResultSet $results, string $entityType, string $entityId, string $checkName, string $phpVersion)
Records a skipped-success result if a known problem covers this entity, and returns true.
Returns false if validation should proceed normally.
protected PHPFunction|null
findCallable(StubDataQueryInterface $storage, string $entityId, string $phpVersion)
Find a function or method in the given storage.
bool
supports(string $phpVersion)
No description
CheckResultSet
run(StubDataQueryInterface $stubs, string $entityId, string $phpVersion)
No description