class PHPEnumSerializer implements EntityTypeSerializerInterface (View source)

Serializer for PHPEnum entities.

Traits

Stubs-specific serialization extending the shared SubEntitySerializerTrait.

Shared sub-entity serialization logic for both Stubs and Reflection serializers.

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.

array
serializeMethod(PHPMethod $method, string|null $parentId = null, PhpDocRepository|null $phpDocStorage = null)

No description

array
serializeParameter(PHPParameter $parameter, PhpDocRepository|null $phpDocStorage = null)

No description

array
serializeProperty(PHPProperty $property, string|null $parentId = null, PhpDocRepository|null $phpDocStorage = null)

No description

array
serializeClassConstant(PHPClassConstant $constant)

No description

deserializeMethod(array $data, string|null $parentId = null, PhpDocRepository|null $phpDocStorage = null)

No description

deserializeParameter(array $data, PhpDocRepository|null $phpDocStorage = null)

No description

deserializeProperty(array $data, string|null $parentId = null, PhpDocRepository|null $phpDocStorage = null)

No description

void
enrichSerializedMethod(array $data, PHPMethod $method, string|null $parentId, PhpDocRepository|null $phpDocStorage)

No description

void
enrichSerializedParameter(array $data, PHPParameter $parameter)

No description

void
enrichSerializedProperty(array $data, PHPProperty $property, string|null $parentId, PhpDocRepository|null $phpDocStorage)

No description

void
enrichSerializedClassConstant(array $data, PHPClassConstant $constant)

No description

void
enrichDeserializedMethod(PHPMethod $method, array $data, string|null $parentId, PhpDocRepository|null $phpDocStorage)

No description

void
enrichDeserializedParameter(PHPParameter $parameter, array $data)

No description

void
enrichDeserializedProperty(PHPProperty $property, array $data, string|null $parentId, PhpDocRepository|null $phpDocStorage)

No description

void
enrichDeserializedClassConstant(PHPClassConstant $constant, array $data)

No description

string|null
serializePhpDoc(string|null $entityId, string|null $phpDoc, PhpDocRepository|null $phpDocStorage)

No description

string|null
deserializePhpDoc(string|null $entityId, string|null $inlinePhpDoc, PhpDocRepository|null $phpDocStorage)

No description

bool
supports(mixed $entity)

Check if this serializer supports the given entity.

array
serialize(mixed $entity, PhpDocRepository|null $phpDocStorage = null)

Serialize an entity to array format suitable for JSON encoding.

mixed
deserialize(array $data, PhpDocRepository|null $phpDocStorage = null)

Deserialize an entity from array format.

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

protected array serializeMethod(PHPMethod $method, string|null $parentId = null, PhpDocRepository|null $phpDocStorage = null)

No description

Parameters

PHPMethod $method
string|null $parentId
PhpDocRepository|null $phpDocStorage

Return Value

array

protected array serializeParameter(PHPParameter $parameter, PhpDocRepository|null $phpDocStorage = null)

No description

Parameters

PHPParameter $parameter
PhpDocRepository|null $phpDocStorage

Return Value

array

protected array serializeProperty(PHPProperty $property, string|null $parentId = null, PhpDocRepository|null $phpDocStorage = null)

No description

Parameters

PHPProperty $property
string|null $parentId
PhpDocRepository|null $phpDocStorage

Return Value

array

protected array serializeClassConstant(PHPClassConstant $constant)

No description

Parameters

PHPClassConstant $constant

Return Value

array

protected PHPMethod deserializeMethod(array $data, string|null $parentId = null, PhpDocRepository|null $phpDocStorage = null)

No description

Parameters

array $data
string|null $parentId
PhpDocRepository|null $phpDocStorage

Return Value

PHPMethod

protected PHPParameter deserializeParameter(array $data, PhpDocRepository|null $phpDocStorage = null)

No description

Parameters

array $data
PhpDocRepository|null $phpDocStorage

Return Value

PHPParameter

protected PHPProperty deserializeProperty(array $data, string|null $parentId = null, PhpDocRepository|null $phpDocStorage = null)

No description

Parameters

array $data
string|null $parentId
PhpDocRepository|null $phpDocStorage

Return Value

PHPProperty

protected PHPClassConstant deserializeClassConstant(array $data)

No description

Parameters

array $data

Return Value

PHPClassConstant

protected void enrichSerializedMethod(array $data, PHPMethod $method, string|null $parentId, PhpDocRepository|null $phpDocStorage)

No description

Parameters

array $data
PHPMethod $method
string|null $parentId
PhpDocRepository|null $phpDocStorage

Return Value

void

protected void enrichSerializedParameter(array $data, PHPParameter $parameter)

No description

Parameters

array $data
PHPParameter $parameter

Return Value

void

protected void enrichSerializedProperty(array $data, PHPProperty $property, string|null $parentId, PhpDocRepository|null $phpDocStorage)

No description

Parameters

array $data
PHPProperty $property
string|null $parentId
PhpDocRepository|null $phpDocStorage

Return Value

void

protected void enrichSerializedClassConstant(array $data, PHPClassConstant $constant)

No description

Parameters

array $data
PHPClassConstant $constant

Return Value

void

protected void enrichDeserializedMethod(PHPMethod $method, array $data, string|null $parentId, PhpDocRepository|null $phpDocStorage)

No description

Parameters

PHPMethod $method
array $data
string|null $parentId
PhpDocRepository|null $phpDocStorage

Return Value

void

protected void enrichDeserializedParameter(PHPParameter $parameter, array $data)

No description

Parameters

PHPParameter $parameter
array $data

Return Value

void

protected void enrichDeserializedProperty(PHPProperty $property, array $data, string|null $parentId, PhpDocRepository|null $phpDocStorage)

No description

Parameters

PHPProperty $property
array $data
string|null $parentId
PhpDocRepository|null $phpDocStorage

Return Value

void

protected void enrichDeserializedClassConstant(PHPClassConstant $constant, array $data)

No description

Parameters

PHPClassConstant $constant
array $data

Return Value

void

protected string|null serializePhpDoc(string|null $entityId, string|null $phpDoc, PhpDocRepository|null $phpDocStorage)

No description

Parameters

string|null $entityId
string|null $phpDoc
PhpDocRepository|null $phpDocStorage

Return Value

string|null

protected string|null deserializePhpDoc(string|null $entityId, string|null $inlinePhpDoc, PhpDocRepository|null $phpDocStorage)

No description

Parameters

string|null $entityId
string|null $inlinePhpDoc
PhpDocRepository|null $phpDocStorage

Return Value

string|null

bool supports(mixed $entity)

Check if this serializer supports the given entity.

Parameters

mixed $entity

The entity to check

Return Value

bool

True if this serializer can handle the entity

array serialize(mixed $entity, PhpDocRepository|null $phpDocStorage = null)

Serialize an entity to array format suitable for JSON encoding.

Parameters

mixed $entity

The entity to serialize

PhpDocRepository|null $phpDocStorage

Optional PhpDoc storage for external storage

Return Value

array

The serialized entity data

mixed deserialize(array $data, PhpDocRepository|null $phpDocStorage = null)

Deserialize an entity from array format.

Parameters

array $data

The serialized entity data

PhpDocRepository|null $phpDocStorage

Optional PhpDoc storage for external retrieval

Return Value

mixed

The reconstructed entity object