Override 类

(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 add a note

User Contributed Notes

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