rfc:callable-types

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
rfc:callable-types [2016/05/23 13:59] – added a chapter about Reflection nikita2206rfc:callable-types [2016/06/06 21:25] nikita2206
Line 1: Line 1:
-====== PHP RFC: Callable Types ======+====== PHP RFC: Callable Prototypes ======
   * Version: 1.0   * Version: 1.0
   * Date: 2015-08-27   * Date: 2015-08-27
   * Authors: Nikita Nefedov <inefedor@gmail.com>, Márcio Almada <marcio3w@gmail.com>   * Authors: Nikita Nefedov <inefedor@gmail.com>, Márcio Almada <marcio3w@gmail.com>
-  * Status: Under Discussion+  * Status: Declined
   * First Published at: http://wiki.php.net/rfc/callable-types   * First Published at: http://wiki.php.net/rfc/callable-types
  
Line 195: Line 195:
 </code> </code>
  
-Optional parameters count just like any other arguments if they are typed:+Optional parameters count just like any other parameters if they are typed:
 <code php> <code php>
 function foo(callable() $cb) { } function foo(callable() $cb) { }
Line 240: Line 240:
  
 There's no way to declare that you expect a callable that returns reference due to syntax limitations. There's no way to declare that you expect a callable that returns reference due to syntax limitations.
 +
 +==== Parameters with default values ====
 +
 +It's not possible to declare default value of a parameter in a callable prototype. Because currently PHP doesn't consider parameter's default values in signature validation (their invariance is not enforced in overridden methods in classes).
  
 ==== Syntax Choices ==== ==== Syntax Choices ====
Line 399: Line 403:
      */      */
     public function getName(): string;     public function getName(): string;
- 
-    /** 
-     * Tells whether type of the parameter is a class 
-     */     
-    public function isClassType(): bool; 
-     
-    /** 
-     * Returns ReflectionClass instance representing class typehinted class 
-     */ 
-    public function getClass(): ReflectionClass; 
  
     /**     /**
Line 473: Line 467:
 while PHP lacks first class packages. while PHP lacks first class packages.
  
-==== Reflection API ====+===== Votes =====
  
-An extension to the reflection API will be proposed in case the RFC is approved. +This RFC requires a 2/3 majority to pass. Vote started on May 23, 2016, ends June 6, 2016.
- +
-===== Votes =====+
  
-This RFC requires a 2/3 majority to pass.+<doodle title="Accept callable prototypes?" auth="nikita2206" voteType="single" closed="true"> 
 +   * Yes 
 +   * No 
 +</doodle>
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
rfc/callable-types.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1