FunctionOptionalParametersCheck
class FunctionOptionalParametersCheck extends AbstractCallableCheck (View source)
Validates that parameters optional in reflection are also optional in stub functions.
The check is one-directional: if reflection reports a parameter as optional, the stub must also declare it optional. The reverse is not enforced — stubs may legitimately mark additional parameters as optional.
A stub parameter is considered optional when:
- It has a default value in the signature (e.g.
$mode = SORT_REGULAR), or - It is variadic (e.g.
...$args), or - Its @param description contains [optional].
If the stub function is not found it is silently skipped — existence is FunctionExistsCheck's responsibility.
Known problems are supported at function level:
- EntityType::FUNCTION + functionId + 'OptionalParametersCheck' → skips the optional-parameters 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, EntityLookupService|null $entityLookup = 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