PHP 8.1.15 Released!

Relative class types

These types declarations can only be used within classes.

self

The value must be an instanceof the same class as the one in which the type declaration is used.

parent

The value must be an instanceof a parent of the class in which the type declaration is used.

static

static is a return-only type which requires that the value returned must be an instanceof the same class as the one the method is called in. Available as of PHP 8.0.0.

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top