class ParseTypeTestHelper (View source)

Exposes the protected parseType() method for testing.

Traits

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

Methods

toJsonSafe($value)

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

parseType(string|null $typeStr)

Parse a type string back into the correct type object.

parse(string|null $typeStr)

No description

Details

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 back into the correct type object.

Rules: "" -> NoType "A&B" -> IntersectionType "(A&B)" -> IntersectionType (parenthesised pure intersection) "A|null" -> NullableType (exactly 2 parts, one is "null") "int|(A&B)|..." -> UnionType with IntersectionType member (DNF) "A|B|..." -> UnionType "?A" -> NullableType "A" -> StandaloneType

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