phpEZ v0.2.0

DoNotSerialize extends ObjAttribute
in package

Attribute to exclude a property from serialization.

Properties marked with #[DoNotSerialize] will not be included in the output of __serialize(), even if they have values. Useful for internal state, computed fields, or sensitive data that should never be sent to clients.

Usage:

class User extends Obj {
  public string $name;
  #[DoNotSerialize]
  private string $passwordHash;
}
Tags
subpackage

iface

Table of Contents

Methods

of()  : static|false
Extract an attribute instance from a reflected property.

Methods

of()

Extract an attribute instance from a reflected property.

public static of(ReflectionProperty $field) : static|false

Searches the property's attributes for one matching this class name and instantiates it with the attribute's arguments.

Parameters
$field : ReflectionProperty

The property to inspect for attributes.

Return values
static|false

The attribute instance if found, false otherwise.

On this page

Search results