rfc:stringable

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
Next revisionBoth sides next revision
rfc:stringable [2020/01/22 15:29] nicolasgrekasrfc:stringable [2020/01/25 12:13] nicolasgrekas
Line 11: Line 11:
  
 It has two goals: It has two goals:
-  - allow using ''string|Stringable'' to express ''string | object-with-%%__toString()%%''+  - allow using ''string|Stringable'' to express ''string|object-with-%%__toString()%%''
   - provide a forward upgrade path from PHP 7 to 8   - provide a forward upgrade path from PHP 7 to 8
  
Line 21: Line 21:
 By being simple and without any magic capabilities on its own, this interface is trivially polyfilled on PHP < 8. By being simple and without any magic capabilities on its own, this interface is trivially polyfilled on PHP < 8.
  
-Once a polyfill becomes widely available (e.g. as part of symfony/polyfill-php80), we can expect code style checkers to be able to enforce declaring the interface when ''%%__toString()%%'' is used. For projects that don't use cs checkers, they'll notice quickly that they missed adding the interface when their users will ask for it if they do.+Once a polyfill becomes widely available (e.g. [[https://github.com/symfony/polyfill/pull/224|as part of symfony/polyfill-php80]]), we can expect code style checkers to be able to enforce declaring the interface when ''%%__toString()%%'' is used. For projects that don't use cs checkers, they'll notice quickly that they missed adding the interface when their users will ask for it if they do.
  
 Here is the stub declaration of the interface: Here is the stub declaration of the interface:
rfc/stringable.txt · Last modified: 2020/08/01 23:38 by carusogabriel