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

Property hook cannot be both abstract and private

Description

Property hook may be private, as in only available to current class, or abstract, as in always redefined in a child class, but not both at the same time.

It is the same as for methods.

Example

<?php

class X {
    private abstract $property { get; }
}

?>

Alternatives

  • Make the method protected or public.
  • Remove the abstract keyword.