PHP 8.1.31 Released!

The Override attribute

(PHP 8 >= 8.3.0)

Introduzione

Sommario della classe

final class Override {
/* Metodi */
public __construct()
}

Esempi

<?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

Vedere anche:

Indice dei contenuti

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top