rfc:get_debug_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:get_debug_type [2020/02/24 09:25]
marandall
rfc:get_debug_type [2020/08/01 23:41]
carusogabriel RFC was implemented
Line 3: Line 3:
   * Date: 2020-02-15   * Date: 2020-02-15
   * Author: Mark Randall, marandall@php.net   * Author: Mark Randall, marandall@php.net
-  * Status: Under Discussion+  * Status: Implemented
   * First Published at: https://wiki.php.net/rfc/get_debug_type   * First Published at: https://wiki.php.net/rfc/get_debug_type
  
Line 13: Line 13:
 <code php> <code php>
 $bar = $arr['key']; $bar = $arr['key'];
-if (!($bar instanceof Foo::class)) { +if (!($bar instanceof Foo)) {  
 +  // this shows the most simple of patterns, to get the real type an assoc array 
 +  // must be present to convert long-form "integer" into int etc.
   throw new TypeError('Expected ' . Foo::class . ' got ' . (is_object($bar) ? get_class($bar) : gettype($bar)));   throw new TypeError('Expected ' . Foo::class . ' got ' . (is_object($bar) ? get_class($bar) : gettype($bar)));
 +}
 +
 +// would become
 +if (!($bar instanceof Foo)) { 
 +  throw new TypeError('Expected ' . Foo::class . ' got ' . get_debug_type($bar));
 } }
  
Line 43: Line 50:
 PHP 8.0 PHP 8.0
  
-===== Proposed Voting Choices ===== +===== Voting =====
-Yes / no vote on adding the new function. +
- +
-Yes / no on resource names be resolved - Would appear as resource(resource_type).+
  
-(Optional) A vote on the name, if there is not a clear majority consensus during RFC discussion.+<doodle title="Add get_debug_type as described" auth="marandall" voteType="single" closed="true"> 
 +   * Yes 
 +   * No 
 +</doodle>
  
  
rfc/get_debug_type.txt · Last modified: 2020/08/01 23:41 by carusogabriel