PHP 8.4.6 Released!

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

User Contributed Notes

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

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant