Relative class types

- « Never

- Value types »

- PHP Manual
- Types
- Relative class types

## 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.