From 732520905d52f4614474505f5afee9a3bbb3c826 Mon Sep 17 00:00:00 2001 From: IWASE Shigeaki Date: Mon, 23 Jun 2025 22:47:30 +0900 Subject: [PATCH 1/6] =?UTF-8?q?Fixed=20examples,=20and=20made=20some=20sel?= =?UTF-8?q?f-contained=20=E3=82=92=E5=8F=96=E3=82=8A=E8=BE=BC=E3=81=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 差分ページ https://github.com/php/doc-en/commit/d6f54016d62904cfd8200604aadd5e3f0d9bad97#diff-efd8446f27c7eac04b8ed976baac78ce391a5486b44bd167287bad4fe8a5c0d3 --- language/oop5/property-hooks.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/language/oop5/property-hooks.xml b/language/oop5/property-hooks.xml index 6ebae328db..9dec5a2be4 100644 --- a/language/oop5/property-hooks.xml +++ b/language/oop5/property-hooks.xml @@ -213,6 +213,7 @@ class Example Date: Mon, 23 Jun 2025 22:55:08 +0900 Subject: [PATCH 2/6] =?UTF-8?q?Added=20notes=20stating=20that=20these=20fe?= =?UTF-8?q?atures=20were=20added=20in=208.4:=E3=82=92=E5=8F=96=E3=82=8A?= =?UTF-8?q?=E8=BE=BC=E3=81=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 差分ページ https://github.com/php/doc-en/commit/617cc59b5902de0cadd32883b72b113bf62cf1b6#diff-efd8446f27c7eac04b8ed976baac78ce391a5486b44bd167287bad4fe8a5c0d3 --- language/oop5/property-hooks.xml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/language/oop5/property-hooks.xml b/language/oop5/property-hooks.xml index 9dec5a2be4..c4869a257f 100644 --- a/language/oop5/property-hooks.xml +++ b/language/oop5/property-hooks.xml @@ -44,7 +44,15 @@ アクセス自体の制限も行いたい場合、 非対称可視性プロパティ を使ってください。 - + + + バージョン情報 + + プロパティフックは PHP 8.4 で導入されました。 + + + + 基本的なフック構文 フックを宣言する一般的な構文は次のとおりです。 From 7ef524973efd4091972626a73dae2467e9464f95 Mon Sep 17 00:00:00 2001 From: IWASE Shigeaki Date: Mon, 23 Jun 2025 22:57:02 +0900 Subject: [PATCH 3/6] =?UTF-8?q?Fix=20property=20hooks=20example=E3=82=92?= =?UTF-8?q?=E5=8F=96=E3=82=8A=E8=BE=BC=E3=81=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit php/doc-en#4550 --- language/oop5/property-hooks.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/language/oop5/property-hooks.xml b/language/oop5/property-hooks.xml index c4869a257f..544a4fdcce 100644 --- a/language/oop5/property-hooks.xml +++ b/language/oop5/property-hooks.xml @@ -316,7 +316,7 @@ class Example Date: Mon, 23 Jun 2025 23:05:01 +0900 Subject: [PATCH 4/6] =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- language/oop5/property-hooks.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/language/oop5/property-hooks.xml b/language/oop5/property-hooks.xml index 544a4fdcce..1eecca4e6c 100644 --- a/language/oop5/property-hooks.xml +++ b/language/oop5/property-hooks.xml @@ -283,7 +283,7 @@ class Example 仮想プロパティは、値を保持しないプロパティです。 getset いずれのフックも プロパティ自体を正確に参照していない場合、それは仮想プロパティになります。 - 例えば、$foo という名前のプロパティのフックに $this->foo というコード含まれれば、それはバックドプロパティです。 + 例えば、$foo という名前のプロパティのフックに $this->foo というコードが含まれれば、それはバックドプロパティです。 次のプロパティはバックドプロパティではなく、エラーが発生します: From d3d9638dff87ca02fab4a9ba47cb1f0066ca4bc7 Mon Sep 17 00:00:00 2001 From: IWASE Shigeaki Date: Tue, 24 Jun 2025 00:08:47 +0900 Subject: [PATCH 5/6] =?UTF-8?q?Fix=20hooks=20example=20(#4392)=20=E3=82=92?= =?UTF-8?q?=E5=8F=96=E3=82=8A=E8=BE=BC=E3=81=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit php/doc-en#4392 --- language/oop5/property-hooks.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/language/oop5/property-hooks.xml b/language/oop5/property-hooks.xml index 1eecca4e6c..4c9c352f0b 100644 --- a/language/oop5/property-hooks.xml +++ b/language/oop5/property-hooks.xml @@ -509,7 +509,10 @@ class PositivePoint extends Point フックは、自分自身のプロパティにおける親フック以外は呼び出せません。 - 上記の例をより効率的に書くと、以下のようになります。 + 上記の例は以下のように書き換えることができます。このようにすると、 + 将来 Point クラスに独自の set + フックを追加しても問題になりません(前述の例では、 + 親クラスに追加されたフックが子クラスで無視されてしまいます)。 親フックへのアクセス (set) @@ -529,7 +532,7 @@ class PositivePoint extends Point if ($value < 0) { throw new \InvalidArgumentException('Too small'); } - $this->x = $value; + parent::$x::set($value); } } } From 8178f0f85ca22013b84bff6ca9504754cb64010e Mon Sep 17 00:00:00 2001 From: IWASE Shigeaki Date: Wed, 25 Jun 2025 16:37:23 +0900 Subject: [PATCH 6/6] =?UTF-8?q?=E3=82=B3=E3=83=9F=E3=83=83=E3=83=88?= =?UTF-8?q?=E3=83=8F=E3=83=83=E3=82=B7=E3=83=A5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- language/oop5/property-hooks.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/language/oop5/property-hooks.xml b/language/oop5/property-hooks.xml index 4c9c352f0b..691a1fd99c 100644 --- a/language/oop5/property-hooks.xml +++ b/language/oop5/property-hooks.xml @@ -1,6 +1,6 @@ - + プロパティフック