Re: Adding new closing tag =?> for keeping trailing newline
| From: | Claude Pache | Date: | Wed, 08 Jun 2022 09:37:19 +0000 |
| Subject: | Re: Adding new closing tag =?> for keeping trailing newline | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117873@lists.php.net to get a copy of this message | ||
> Le 8 juin 2022 à 05:34, Sara Golemon <pollita@php.net> a écrit :
>
>
> <?php
> declare(ignore_newline_after_close_tag=false); // defaults to true, i.e
> existing behavior
>
> This would avoid any new syntax rules, but still provide the ability for
> php-as-template-engine to behave in the user's preferred mode.
>
No, because the user’s preferred mode is not a global one, it is a local one. You do not want to
keep newlines in the following situation:
```
* line 1
<?php if ($foo): ?>
* line 2
* line 3
<?php endif; ?>
* line 4
```
With a global switch, not only you have failed to solve the real problem (doing the Right Thing with
newlines), but also you have created another one (looking at the top of the file in order to
understand the code). You have the worst of both world.
—Claude