[DOC-CVS] [doc-en] master: Fix error in deconstructor example 5 (#4714)

[email protected] (Pierre Ambroise via GitHub)
Newsgroups php.doc.cvs
Message-ID <[email protected]>
Author: Pierre Ambroise (Fan2Shrek)
Committer: GitHub (web-flow)
Pusher: sy-records
Date: 2025-06-03T16:32:26+08:00

Commit: https://github.com/php/doc-en/commit/82fc6a1c8670b96f1bd2b40932b6eb19929f4f6f
Raw diff: https://github.com/php/doc-en/commit/82fc6a1c8670b96f1bd2b40932b6eb19929f4f6f.diff

Fix error in deconstructor example 5 (#4714)

Changed paths:
  M  language/oop5/decon.xml


Diff:

diff --git a/language/oop5/decon.xml b/language/oop5/decon.xml
index 931a792184f1..dd17425e800c 100644
--- a/language/oop5/decon.xml
+++ b/language/oop5/decon.xml
@@ -262,7 +262,7 @@ class Product {
     public static function fromXml(string $xml): static {
         $data = simplexml_load_string($xml);
         $new = new static();
-        $new->id = $data->id;
+        $new->id = (int) $data->id;
         $new->name = $data->name;
         return $new;
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.