rfc:static_return_type

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rfc:static_return_type [2020/01/08 11:39]
nikic
rfc:static_return_type [2020/02/17 10:51] (current)
nikic
Line 3: Line 3:
   * Author: Nikita Popov <nikic@php.net>   * Author: Nikita Popov <nikic@php.net>
   * Target Version: PHP 8.0   * Target Version: PHP 8.0
-  * Status: Under Discussion+  * Status: Implemented
   * Implementation: https://github.com/php/php-src/pull/5062   * Implementation: https://github.com/php/php-src/pull/5062
  
Line 72: Line 72:
 </PHP> </PHP>
  
-Under the Liskov substitution principle (LSP), we should be able to substitute class ''B'' anywhere class ''A'' is expected. However, in this example passing ''B'' instead of ''A'' will throw a ''TypError'', because ''B::test()'' does not accept a ''A'' as a parameter.+Under the Liskov substitution principle (LSP), we should be able to substitute class ''B'' anywhere class ''A'' is expected. However, in this example passing ''B'' instead of ''A'' will throw a ''TypeError'', because ''B::test()'' does not accept a ''A'' as a parameter.
  
 More generally, ''static'' is only sound in covariant contexts, which at present are only return types. More generally, ''static'' is only sound in covariant contexts, which at present are only return types.
Line 171: Line 171:
 ===== Vote ===== ===== Vote =====
  
-Yes/No.+Voting started 2020-01-28 and ends 2020-02-11. 
 + 
 +<doodle title="Add static return type?" auth="nikic" voteType="single" closed="true"> 
 +   Yes 
 +   No 
 +</doodle>
  
rfc/static_return_type.1578483550.txt.gz · Last modified: 2020/01/08 11:39 by nikic