NotNull
extends ObjAttribute
in package
Attribute to mark a field as NOT NULL in the database.
Useful when you want to enforce NOT NULL regardless of PHP type nullability, or to make the requirement explicit in code.
Tags
Attributes
- #[Attribute]
- \Attribute::TARGET_PROPERTY
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.