Dutch PHP Conference 2025 - Call For Papers

The Override class

(PHP 8 >= 8.3.0)

Вступ

Короткий огляд класу

final class Override {
/* Методи */
public __construct()
}

Приклади

<?php

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

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

?>

В PHP 8.3 поданий вище приклад виведе щось схоже на:

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

Прогляньте також

Зміст

add a note

User Contributed Notes

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