rfc:scalar-pseudo-type

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
rfc:scalar-pseudo-type [2017/12/24 17:29] – Added more Examples fleshgrinderrfc:scalar-pseudo-type [2017/12/24 23:32] – Added Section about Weak Mode fleshgrinder
Line 81: Line 81:
  
 The function [[https://php.net/is-scalar|is_scalar]] to determine whether a value is ''scalar'' or not already exist in PHP since a long time and must not be added. The function [[https://php.net/is-scalar|is_scalar]] to determine whether a value is ''scalar'' or not already exist in PHP since a long time and must not be added.
 +
 +====== Weak Mode ======
 +Objects with a magic ''toString'' method are accepted and treated as strings in weak mode. The behavior is 1:1 the same as if the type constraint would have been ''string'' in the first place for objects. This ensures perfect consistency and adheres to the principle of least astonishment.
  
 ====== Examples ====== ====== Examples ======
Line 154: Line 157:
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
 ''scalar'' is implemented as reserved name, therefore a class, interface, or trait named ''scalar'' cannot be declared.  ''scalar'' is implemented as reserved name, therefore a class, interface, or trait named ''scalar'' cannot be declared. 
- 
-===== Open Issues ===== 
-  * Whether ''scalar'' should accept objects with a magic ''toString'' method in weak mode like the ''string'' constraint does. 
  
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
rfc/scalar-pseudo-type.txt · Last modified: 2017/12/24 23:33 by fleshgrinder