StubConstantRegistry
final class StubConstantRegistry (View source)
Process-wide registry of constant values defined in the stub sources.
The stub parameter default-value evaluator (NikicParameterNode) resolves
ConstFetch / ClassConstFetch defaults against the running PHP runtime via
defined()/constant(). That only works when the extension defining the
constant happens to be loaded in the process that generates the cache;
otherwise the default silently degrades to null — e.g.
IntlBreakIterator::getPartsIterator()'s $type = IntlPartsIterator::KEY_SEQUENTIAL
is cached as null instead of 0 when ext-intl is absent.
This registry is populated from the parsed stub constants themselves while the stubs are parsed, so the evaluator can fall back to a deterministic, environment-independent value when the runtime lookup fails. It is purely additive: the runtime is always consulted first, and the registry is only used when the runtime cannot resolve the constant.
Methods
Register a constant value under its fully qualified name.
No description
No description
Reset the registry. Intended for test isolation.
Details
static void
register(string $fqn, mixed $value)
Register a constant value under its fully qualified name.
null values are ignored: they carry no information the evaluator could not already produce on its own, and storing them would mask the "unresolved" state the caller relies on.
static bool
has(string $fqn)
No description
static mixed
get(string $fqn)
No description
static void
clear()
Reset the registry. Intended for test isolation.