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

Abstract Or Not

<?php

abstract class a {
    abstract function __construct($a);
}

class b extends a {
    function __construct() {}
    
}

A parent method must have a compatible signature with the same method in any child.

The only exception are constructor, __construct, which are not required to keep the signature compatible between parent and child.

This exception to the rule may be explicitly enforced by making the constructor abstract, or by setting the constructor in an interface: in fact, methods in an interface are considered abstract by default.

See Also

PHP Error Messages

PHP Features

Last updated: 10 September 2026