rfc:flexible_heredoc_nowdoc_syntaxes

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:flexible_heredoc_nowdoc_syntaxes [2017/10/27 18:13]
tpunt
rfc:flexible_heredoc_nowdoc_syntaxes [2018/04/13 19:59] (current)
nikic Implementation landed
Line 3: Line 3:
   * Date: 2017-09-16   * Date: 2017-09-16
   * Author: Thomas Punt, tpunt@php.net   * Author: Thomas Punt, tpunt@php.net
-  * Status: Draft+  * Status: Implemented (in PHP 7.3)
   * First Published at: https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes   * First Published at: https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes
  
Line 136: Line 136:
 </code> </code>
  
-This change was actually brought up in a previous RFC ([[rfc:heredoc-scanner-loosening|PHP RFC: Loosening heredoc/nowdoc scanner]]). One of the big gotchas that it mentioned, however, was that if the ending marker was found at the start of a line, then regardless of whether it was apart of another word, it would still be considered as the ending marker. For example, the following would not work (due to ''ENDING'' containing ''END''):+This change was actually brought up in a previous RFC ([[rfc:heredoc-scanner-loosening|PHP RFC: Loosening heredoc/nowdoc scanner]]). One of the big gotchas that it mentioned, however, was that if the ending marker was found at the start of a line, then regardless of whether it was a part of another word, it would still be considered as the ending marker. For example, the following would not work (due to ''ENDING'' containing ''END''):
 <code php> <code php>
 $values = [<<<END $values = [<<<END
Line 178: Line 178:
   * the colliding marker can be seen as standalone, valid symbol name   * the colliding marker can be seen as standalone, valid symbol name
  
-The changes proposed in this RFC therefore comes down to whether you believe developers are responsible enough to choose non-colliding markers. I firmly believe that since we give developers the power to choose their own markers, then they should be responsible enough to choose markers that do not collide with the inner multiline text+The changes proposed by this RFC therefore come down to whether you believe developers are responsible enough to choose non-colliding markers. I firmly believe that since we give developers the power to choose their own markers, then they should be responsible enough to choose markers that do not collide with the inner multiline text.
- +
-Therefore, I believe the tradeoff of making the heredoc and nowdoc syntaxes more flexible in return for requiring developers to actually choose good marker names is a tradeoff worth making.+
  
 So to quickly reiterate, the changes proposed by this RFC will enable for code such as the following: So to quickly reiterate, the changes proposed by this RFC will enable for code such as the following:
Line 217: Line 215:
  
 There will be two votes, both requiring a 2/3 majority. The first will be regarding whether the closing marker can be indented. The second will be whether the closing marker should remove the new line requirement. These votes are orthogonal to one-another (if one fails and the other passes, then the other still passes). There will be two votes, both requiring a 2/3 majority. The first will be regarding whether the closing marker can be indented. The second will be whether the closing marker should remove the new line requirement. These votes are orthogonal to one-another (if one fails and the other passes, then the other still passes).
 +
 +Voting starts on 2017.11.01 and ends on 2017.11.15.
 +
 +<doodle title="Allow for the closing marker to be indented and for the leading whitespace to be stripped?" auth="tpunt" voteType="single" closed="true">
 +   * Yes
 +   * No
 +</doodle>
 +''''
 +<doodle title="Remove the trailing new line requirement from the closing marker?" auth="tpunt" voteType="single" closed="true">
 +   * Yes
 +   * No
 +</doodle>
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
rfc/flexible_heredoc_nowdoc_syntaxes.1509128009.txt.gz · Last modified: 2017/10/27 18:13 by tpunt