final | |
|---|---|
implements |
CompoundType |
uses |
DelegatingTypeTrait |
A type that contains itself, like @phpstan-type Selection = array<string, true|Selection>
or __recursive<array<string, true|__recursion>> in a stub.
The body holds a RecursiveTypeReference wherever the type contains itself. The methods that answer questions about the values of the type ask the body with those references replaced by this type, which is one level deeper and contains this type, never more. describe(), equals(), traverse() and the other methods that walk the structure of a type stay on the body, so they end at the references.
Comparing two recursive types with each other comes back to the same two types once their bodies are compared one level deeper. The comparison then assumes it holds, because nothing it has compared so far says otherwise.
The id tells apart the references to nested recursive types. An alias uses its name
in the declaring class, a __recursive<…> the depth of its nesting.
| Methods | ||
|---|---|---|
public
static
|
create(callable(Type): Type $build): Type
|
# |