On Wed, Jun 8, 2022 at 5:37 AM Claude Pache <claude.pa...@gmail.com> wrote:
> > > > Le 8 juin 2022 à 05:34, Sara Golemon <poll...@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. > > Declare statements shouldn't have any impact outside of the file in which they appear. Declaring strict types doesn't force other classes that interact with the defined class to also use strict types. A declare to change how newlines after closing tags are handled within a single file forces anything that uses the classes/functions defined in that file to know that it handles them in a possibly different ways. I personally don't see a need for a new closing tag. I'm not usually swayed by the "it adds confusion to the language" and would be against removing such a tag if it existed and that was the reason for removing it. However, I do think it's something to consider when adding something new to the language. In this case, I don't think the positives outweigh the negatives, especially in light of the fact it's really easy to accomplish this without changes. > —Claude > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > -- Chase Peeler chasepee...@gmail.com