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 1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
2
<!-- $Revision$ -->
3
- <!-- EN-Revision: 984188eb6941dc419f49eed6c1a55a6b749a823d Maintainer: hirokawa Status: ready -->
3
+ <!-- EN-Revision: c1f37a6c270aadbbb3da56a3973ffd62197adf2b Maintainer: hirokawa Status: ready -->
4
4
<!-- CREDITS: shimooka -->
5
5
6
6
<sect1 xml : id =" language.oop5.abstract" xmlns =" http://docbook.org/ns/docbook" >
@@ -196,8 +196,8 @@ class C extends A
196
196
前の例のように、<literal >get</literal > または <literal >set</literal > のどちらかを、定義せず宣言のみ行います。
197
197
</simpara >
198
198
<example >
199
- <title >抽象プロパティの例 </title >
200
- <programlisting role =" php" >
199
+ <title >フック付きの抽象プロパティの例 </title >
200
+ <programlisting role =" php" annotations = " non-interactive " >
201
201
<![CDATA[
202
202
<?php
203
203
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
2
<!-- $Revision$ -->
3
- <!-- EN-Revision: a9edd62d087ab1eb6292c795b7256e14ff9f1234 Maintainer: takagi Status: ready -->
3
+ <!-- EN-Revision: d6f54016d62904cfd8200604aadd5e3f0d9bad97 Maintainer: takagi Status: ready -->
4
4
5
5
<sect1 xml : id =" language.oop5.anonymous" xmlns =" http://docbook.org/ns/docbook" >
6
6
<title >無名クラス</title >
@@ -174,6 +174,33 @@ class@anonymous/in/oNi1A0x7f8636ad2021
174
174
</screen >
175
175
</informalexample >
176
176
</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 >
177
204
</sect1 >
178
205
179
206
<!-- Keep this comment at the end of the file
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
2
<!-- $Revision$ -->
3
- <!-- EN-Revision: 22583751fbfdaa3eaa41aeb6470d1343f5cb2c78 Maintainer: hirokawa Status: ready -->
3
+ <!-- EN-Revision: c1f37a6c270aadbbb3da56a3973ffd62197adf2b Maintainer: hirokawa Status: ready -->
4
4
<!-- Credits: mumumu -->
5
5
6
6
<sect1 xml : id =" language.oop5.autoload" xmlns =" http://docbook.org/ns/docbook" >
54
54
<filename >MyClass1.php</filename > および
55
55
<filename >MyClass2.php</filename > からロードします。
56
56
</para >
57
- <programlisting role =" php" >
57
+ <programlisting role =" php" annotations = " interactive " >
58
58
<![CDATA[
59
59
<?php
60
60
spl_autoload_register(function ($class_name) {
@@ -99,7 +99,7 @@ Fatal error: Interface 'ITest' not found in ...
99
99
これは Composer によって管理されているパッケージを自動的に読み込むよう設定されています。
100
100
このファイルを読み込むことで、これらのパッケージを追加の作業なしで利用できるようになります。
101
101
</simpara >
102
- <programlisting role =" php" >
102
+ <programlisting role =" php" annotations = " interactive " >
103
103
<![CDATA[
104
104
<?php
105
105
require __DIR__ . '/vendor/autoload.php';
You can’t perform that action at this time.
0 commit comments