mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Explain what consistitutes a more specific type
Closes GH-457
This commit is contained in:
parent
d446e9e831
commit
871df69f47
1 changed files with 22 additions and 0 deletions
|
@ -13,6 +13,28 @@
|
|||
of its parent's method. Whereas, contravariance allows a parameter type to be less
|
||||
specific in a child method, than that of its parent.
|
||||
</para>
|
||||
<para>
|
||||
A type declaration is considered more specific in the following case:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
A type is removed from a union type
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
A class type is changed to a child class type
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<type>float</type> is changed to <type>int</type>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
A type class is considered less specific if the opposite is true.
|
||||
</para>
|
||||
|
||||
<sect2 xml:id="language.oop5.variance.covariance">
|
||||
<title>Covariance</title>
|
||||
|
|
Loading…
Reference in a new issue