class ParseTypeTestHelper (View source)

Exposes the protected parseType() method for testing.

Traits

Shared utility methods for serializers: type parsing and JSON-safe conversion.

Methods

string|null
shortClassName(string|null $name)

Return the short (unqualified) form of a possibly-qualified class name.

toJsonSafe($value)

Convert value to JSON-safe format, filtering out resources and closures

parseType(string|null $typeStr)

Parse a type string (already fully-qualified, as stored in the cache) back into the correct type object. Leaf names are used verbatim — see {TypeStringParser} for the grammar handled.

parse(string|null $typeStr)

No description

Details

protected string|null shortClassName(string|null $name)

Return the short (unqualified) form of a possibly-qualified class name.

E.g. "\Foo\Bar" or "Foo\Bar" -> "Bar"; "Bar" -> "Bar".

Parameters

string|null $name

Return Value

string|null

protected toJsonSafe($value)

Convert value to JSON-safe format, filtering out resources and closures

Parameters

$value

protected StandaloneType|UnionType|NullableType|NoType|IntersectionType parseType(string|null $typeStr)

Parse a type string (already fully-qualified, as stored in the cache) back into the correct type object. Leaf names are used verbatim — see {TypeStringParser} for the grammar handled.

Parameters

string|null $typeStr

Return Value

StandaloneType|UnionType|NullableType|NoType|IntersectionType

StandaloneType|UnionType|NullableType|NoType|IntersectionType parse(string|null $typeStr)

No description

Parameters

string|null $typeStr

Return Value

StandaloneType|UnionType|NullableType|NoType|IntersectionType