final |
|---|
Controls the verbosity of type descriptions in error messages.
When PHPStan describes a type for an error message, it uses VerbosityLevel to decide how much detail to include. Higher levels include more detail like constant values and array shapes.
The four levels (from least to most verbose):
Used as a parameter to Type::describe() to control output detail:
$type->describe(VerbosityLevel::typeOnly()) // "string"
$type->describe(VerbosityLevel::value()) // "'hello'"
$type->describe(VerbosityLevel::precise()) // "non-empty-lowercase-string"
The getRecommendedLevelByType() factory method automatically chooses the right level for error messages based on what types are involved — it picks the minimum verbosity needed to distinguish the accepting type from the accepted type.
| Methods | ||
|---|---|---|
public
static
|
typeOnly(): self
|
# |
public
static
|
value(): self
|
# |
public
static
|
precise(): self
|
# |
public
static
|
cache(): self
|
# |
public
static
|
getRecommendedLevelByType(Type $acceptingType, ?Type $acceptedType = null): self
|
# |