Nexus API Reference

TypeRegistry
in package

FinalYes
Tags
psalm-api

Bidirectional mapping between message class names and their wire-format type identifiers.

Table of Contents

Methods

allClasses()  : array<int, string>
All registered message classes — the natural allow-list for {@see PhpNativeSerializer}. Remember to append nested value-object classes that appear inside messages but are not registered types.
classForName()  : string|null
Returns the class name for a type name, or null if not registered.
nameForClass()  : string|null
Returns the type name for a class, or null if not registered.
register()  : void
Registers a bidirectional mapping between a class name and a type name.
registerFromAttribute()  : void
Reads the #[MessageType] attribute from the given class and registers it.

Methods

allClasses()

All registered message classes — the natural allow-list for {@see PhpNativeSerializer}. Remember to append nested value-object classes that appear inside messages but are not registered types.

public allClasses() : array<int, string>
Return values
array<int, string>

classForName()

Returns the class name for a type name, or null if not registered.

public classForName(string $typeName) : string|null
Parameters
$typeName : string
Return values
string|null

nameForClass()

Returns the type name for a class, or null if not registered.

public nameForClass(string $className) : string|null
Parameters
$className : string
Return values
string|null

register()

Registers a bidirectional mapping between a class name and a type name.

public register(string $className, string $typeName) : void
Parameters
$className : string
$typeName : string
Tags
throws
LogicException

If the type name is already registered

registerFromAttribute()

Reads the #[MessageType] attribute from the given class and registers it.

public registerFromAttribute(class-string $className) : void
Parameters
$className : class-string
Tags
throws
LogicException

If the class has no #[MessageType] attribute or the type name is already registered

On this page

Search results