rfc:heredoc-scanner-loosening
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:heredoc-scanner-loosening [2014/08/29 12:51] – datibbaw | rfc:heredoc-scanner-loosening [2018/06/10 10:26] (current) – RFC is obsolete due to accepted “RFC: Flexible Heredoc and Nowdoc Syntaxes” cmb | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2014-08-29 | * Date: 2014-08-29 | ||
* Author: Tjerk Meesters, datibbaw@php.net | * Author: Tjerk Meesters, datibbaw@php.net | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | Currently the rules for ending a heredoc or nowdoc are quite restrictive, | + | Currently the rules for ending a heredoc or nowdoc are quite restrictive, |
- | This proposal aims to loosen or altogether remove that restriction. | + | For instance, this is how you would declare an array comprising a heredoc and regular string: |
- | + | ||
- | ===== Proposal ===== | + | |
- | A fix for the following scenario: | + | |
<code php> | <code php> | ||
- | eval(" | + | $strings = [<<< |
+ | hello | ||
+ | EOS | ||
+ | , ' world' | ||
</ | </ | ||
- | //The above just illustrates | + | The comma that you would normally put on the same line as the previous element must now be put on the next line. |
- | Allow more liberal | + | Currently, this restriction also causes a parse error with code such as this: |
+ | |||
+ | <code php> | ||
+ | return <<< | ||
+ | Foo! | ||
+ | EOS; // <-- file ends here | ||
+ | </ | ||
+ | |||
+ | ===== Proposal ===== | ||
+ | This proposal aims to lift the current newline restriction and make it less awkward to use heredocs and nowdocs within | ||
<code php> | <code php> | ||
Line 44: | Line 53: | ||
</ | </ | ||
- | Two ways in which this can be achieved | + | The proposal suggests two distinct |
==== Loosened restrictions ==== | ==== Loosened restrictions ==== | ||
- | Ends a quotation | + | Ends a quotation |
==== Removed restrictions ==== | ==== Removed restrictions ==== | ||
Line 99: | Line 108: | ||
Voting choices will be: | Voting choices will be: | ||
- No, leave the scanner as it is. | - No, leave the scanner as it is. | ||
- | - Yes, loosen the newline restriction with a selected set of characters. | + | - Yes, loosen the newline restriction with characters |
- Yes, remove the newline restriction altogether. | - Yes, remove the newline restriction altogether. | ||
rfc/heredoc-scanner-loosening.1409316680.txt.gz · Last modified: 2017/09/22 13:28 (external edit)