The Override class

(PHP 8 >= 8.3.0)

Introducción

Sinopsis de la Clase

finalclassOverride {
public__construct()
}

Ejemplos

<?php

class Base {
protected function
foo(): void {}
}

final class
Extended extends Base {
#[
\Override]
protected function
boo(): void {}
}

?>

Output of the above example in PHP 8.3 is similar to:

 Fatal error: Extended::boo() has #[\Override] attribute, but no matching parent method exists 

Tabla de contenidos

To Top