File tree Expand file tree Collapse file tree 3 files changed +34
-7
lines changed Expand file tree Collapse file tree 3 files changed +34
-7
lines changed Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" utf-8" ?>
22<!-- $Revision$ -->
3- <!-- EN-Revision: 984188eb6941dc419f49eed6c1a55a6b749a823d Maintainer: hirokawa Status: ready -->
3+ <!-- EN-Revision: c1f37a6c270aadbbb3da56a3973ffd62197adf2b Maintainer: hirokawa Status: ready -->
44<!-- CREDITS: shimooka -->
55
66<sect1 xml : id =" language.oop5.abstract" xmlns =" http://docbook.org/ns/docbook" >
@@ -196,8 +196,8 @@ class C extends A
196196 前の例のように、<literal >get</literal > または <literal >set</literal > のどちらかを、定義せず宣言のみ行います。
197197 </simpara >
198198 <example >
199- <title >抽象プロパティの例 </title >
200- <programlisting role =" php" >
199+ <title >フック付きの抽象プロパティの例 </title >
200+ <programlisting role =" php" annotations = " non-interactive " >
201201<![CDATA[
202202<?php
203203
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" utf-8" ?>
22<!-- $Revision$ -->
3- <!-- EN-Revision: a9edd62d087ab1eb6292c795b7256e14ff9f1234 Maintainer: takagi Status: ready -->
3+ <!-- EN-Revision: d6f54016d62904cfd8200604aadd5e3f0d9bad97 Maintainer: takagi Status: ready -->
44
55<sect1 xml : id =" language.oop5.anonymous" xmlns =" http://docbook.org/ns/docbook" >
66 <title >無名クラス</title >
@@ -174,6 +174,33 @@ class@anonymous/in/oNi1A0x7f8636ad2021
174174 </screen >
175175 </informalexample >
176176 </note >
177+
178+ <sect2 xml : id =" language.oop5.anonymous.readonly" >
179+ <title >読み取り専用の無名クラス</title >
180+ <simpara >
181+ PHP 8.3.0 以降では、
182+ 無名クラスにも <literal >readonly</literal > を適用できます。
183+ </simpara >
184+ <example xml : id =" language.oop5.anonymous.readonly.example" >
185+ <title >読み取り専用の無名クラスを定義する</title >
186+ <programlisting role =" php" >
187+ <![CDATA[
188+ <?php
189+ // Using an anonymous class
190+ var_dump(new readonly class('[DEBUG]') {
191+ public function __construct(private string $prefix)
192+ {
193+ }
194+
195+ public function log($msg)
196+ {
197+ echo $this->prefix . ' ' . $msg;
198+ }
199+ });
200+ ]]>
201+ </programlisting >
202+ </example >
203+ </sect2 >
177204</sect1 >
178205
179206<!-- Keep this comment at the end of the file
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" utf-8" ?>
22<!-- $Revision$ -->
3- <!-- EN-Revision: 22583751fbfdaa3eaa41aeb6470d1343f5cb2c78 Maintainer: hirokawa Status: ready -->
3+ <!-- EN-Revision: c1f37a6c270aadbbb3da56a3973ffd62197adf2b Maintainer: hirokawa Status: ready -->
44<!-- Credits: mumumu -->
55
66 <sect1 xml : id =" language.oop5.autoload" xmlns =" http://docbook.org/ns/docbook" >
5454 <filename >MyClass1.php</filename > および
5555 <filename >MyClass2.php</filename > からロードします。
5656 </para >
57- <programlisting role =" php" >
57+ <programlisting role =" php" annotations = " interactive " >
5858<![CDATA[
5959<?php
6060spl_autoload_register(function ($class_name) {
@@ -99,7 +99,7 @@ Fatal error: Interface 'ITest' not found in ...
9999 これは Composer によって管理されているパッケージを自動的に読み込むよう設定されています。
100100 このファイルを読み込むことで、これらのパッケージを追加の作業なしで利用できるようになります。
101101 </simpara >
102- <programlisting role =" php" >
102+ <programlisting role =" php" annotations = " interactive " >
103103<![CDATA[
104104<?php
105105require __DIR__ . '/vendor/autoload.php';
You can’t perform that action at this time.
0 commit comments