Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Relative Types

Relative types are types that are not explicit, but relative to the current class. There are three relative types:

  • static: this represents the current calling class. It is important when the class is not directly called, but one of its children is.
  • self: this represents the current class, at compilation time.
  • parent: this represents the first available parent of the current class. It usually is the direct parent, but may skip classes when the requested resource is not available, as in method calls.
<?php

    class Calf extends Elephpant {
        function trumpet() : self {}
        function forage() : static {}
        function migrate() : parent {}
    }

?>

Documentation

See Also