<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://wiki.php.net/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://wiki.php.net/feed.php">
        <title>PHP Wiki - rfc:default_expression</title>
        <description></description>
        <link>https://wiki.php.net/</link>
        <image rdf:resource="https://wiki.php.net/_media/wiki/dokuwiki.svg" />
       <dc:date>2026-04-25T13:40:26+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://wiki.php.net/rfc/default_expression/type_safety?rev=1743685723&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://wiki.php.net/_media/wiki/dokuwiki.svg">
        <title>PHP Wiki</title>
        <link>https://wiki.php.net/</link>
        <url>https://wiki.php.net/_media/wiki/dokuwiki.svg</url>
    </image>
    <item rdf:about="https://wiki.php.net/rfc/default_expression/type_safety?rev=1743685723&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-04-03T13:08:43+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>type_safety</title>
        <link>https://wiki.php.net/rfc/default_expression/type_safety?rev=1743685723&amp;do=diff</link>
        <description>&lt;table&gt;&lt;tr&gt;&lt;th colspan=&quot;2&quot; width=&quot;50%&quot;&gt;2024/09/01 12:39&lt;/th&gt;&lt;th colspan=&quot;2&quot; width=&quot;50%&quot;&gt;current&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;diff-blockheader&quot; colspan=&quot;2&quot;&gt;Line 113:&lt;/td&gt;
&lt;td class=&quot;diff-blockheader&quot; colspan=&quot;2&quot;&gt;Line 113:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-lineheader&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&quot;diff-context&quot;&gt;&amp;#160; - Change the contract of methods to state that default values are covariant, rather than contravariant. To be precise, that the default value of a parameter in a sub-class must be of the same concrete type as the default value in the parent, or a sub-type of it, regardless of the parameter&amp;#039;s declared type. This would invalidate a non-trivial amount of existing code, so would need to be introduced in a major version, probably with a deprecation period.&lt;/td&gt;&lt;td class=&quot;diff-lineheader&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&quot;diff-context&quot;&gt;&amp;#160; - Change the contract of methods to state that default values are covariant, rather than contravariant. To be precise, that the default value of a parameter in a sub-class must be of the same concrete type as the default value in the parent, or a sub-type of it, regardless of the parameter&amp;#039;s declared type. This would invalidate a non-trivial amount of existing code, so would need to be introduced in a major version, probably with a deprecation period.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-lineheader&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&quot;diff-context&quot;&gt;&amp;#160; - Limit the expressions allowed to those where &amp;#039;&amp;#039;default&amp;#039;&amp;#039; can be safely substituted for any type (i.e. where it can be analysed as of type &amp;#039;&amp;#039;mixed&amp;#039;&amp;#039;). In practice, this means conditional expressions where &amp;#039;&amp;#039;default&amp;#039;&amp;#039; is used unchanged as the result, such as &amp;lt;php&amp;gt;$condition ? &amp;#039;explicit value&amp;#039; : default&amp;lt;/php&amp;gt;. This probably requires a different implementation, where &amp;#039;&amp;#039;default&amp;#039;&amp;#039; is compiled as a placeholder value which triggers the function call to act as though no value was passed.&lt;/td&gt;&lt;td class=&quot;diff-lineheader&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&quot;diff-context&quot;&gt;&amp;#160; - Limit the expressions allowed to those where &amp;#039;&amp;#039;default&amp;#039;&amp;#039; can be safely substituted for any type (i.e. where it can be analysed as of type &amp;#039;&amp;#039;mixed&amp;#039;&amp;#039;). In practice, this means conditional expressions where &amp;#039;&amp;#039;default&amp;#039;&amp;#039; is used unchanged as the result, such as &amp;lt;php&amp;gt;$condition ? &amp;#039;explicit value&amp;#039; : default&amp;lt;/php&amp;gt;. This probably requires a different implementation, where &amp;#039;&amp;#039;default&amp;#039;&amp;#039; is compiled as a placeholder value which triggers the function call to act as though no value was passed.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-lineheader&quot;&gt;-&lt;/td&gt;&lt;td class=&quot;diff-deletedline&quot;&gt;&amp;#160; - Limit use further, to only using &amp;#039;&amp;#039;default&amp;#039;&amp;#039; as a stand-alone token to skip a parameter. This is essentially what was proposed and declined in [[skipparams]].&lt;/td&gt;&lt;td class=&quot;diff-lineheader&quot;&gt;+&lt;/td&gt;&lt;td class=&quot;diff-addedline&quot;&gt;&amp;#160; - Limit use further, to only using &amp;#039;&amp;#039;default&amp;#039;&amp;#039; as a stand-alone token to skip a parameter. This is essentially what was proposed and declined in [[&lt;strong class=&quot;diff-mark&quot;&gt;rfc/&lt;/strong&gt;skipparams&lt;strong class=&quot;diff-mark&quot;&gt;|Stas Malyshev&amp;#039;s &amp;quot;Skipping optional parameters for functions&amp;quot; RFC&lt;/strong&gt;]].&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-lineheader&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&quot;diff-context&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-lineheader&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&quot;diff-context&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-lineheader&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&quot;diff-context&quot;&gt;This RFC currently proposes option 1.&lt;/td&gt;&lt;td class=&quot;diff-lineheader&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&quot;diff-context&quot;&gt;This RFC currently proposes option 1.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-lineheader&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&quot;diff-context&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-lineheader&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&quot;diff-context&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-lineheader&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&quot;diff-context&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-lineheader&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&quot;diff-context&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</description>
    </item>
</rdf:RDF>
