[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-doc-cvs
Subject:    [DOC-CVS] [doc-en] master: Add paragraph that Stringable objects are not accepted as strings when st
From:       NickSdot via GitHub <noreply () php ! net>
Date:       2023-10-29 14:45:38
Message-ID: rO3YE7DP7wWT24SWPvzUQ8tnZF6r8oak2wlZoupCb4 () main ! php ! net
[Download RAW message or body]

Author: NickSdot (NickSdot)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2023-10-29T14:48:52Z

Commit: https://github.com/php/doc-en/commit/5e15a6c3e4d5819102361ae78e73c90a06238c8a
Raw diff: https://github.com/php/doc-en/commit/5e15a6c3e4d5819102361ae78e73c90a06238c8a.diff


Add paragraph that Stringable objects are not accepted as strings when strict types \
enabled (#2844)

Co-authored-by: George Peter Banyard <girgias@php.net>

Changed paths:
  M  language/oop5/magic.xml


Diff:

diff --git a/language/oop5/magic.xml b/language/oop5/magic.xml
index dd40a793d49..fc30bbcbdab 100644
--- a/language/oop5/magic.xml
+++ b/language/oop5/magic.xml
@@ -275,6 +275,13 @@ class Connection
      <link linkend="language.types.declarations.strict">strict typing</link>
      is disabled.
     </para>
+    <para>
+     A <interfacename>Stringable</interfacename> object will
+     <emphasis>not</emphasis> be accepted by a <type>string</type> type declaration \
if +     <link linkend="language.types.declarations.strict">strict typing</link>
+     is enabled. If such behaviour is wanted the type declaration must accept
+     <interfacename>Stringable</interfacename> and <type>string</type> via a union \
type. +    </para>
     <para>
      As of PHP 8.0.0, any class that contains a <link \
                linkend="object.tostring">__toString()</link>
      method will also implicitly implement the \
<interfacename>Stringable</interfacename> interface, and will

-- 
PHP Documentation Commits Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic