Task #44566
RFC: Change CGL to remove closing PHP tag
Status: | Closed | Start date: | 2013-01-16 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | - | % Done: | 100% |
|
Category: | - Documentation - | |||
Target version: | - | |||
Sprint: | Has patch: | No | ||
PHP Version: | Complexity: |
Description
Having a closing PHP tag in class definitions is cumbersome, error prone (if whitespace is inserted after the tag) and not common in most other frameworks.
Therefore we should change this rule in our CGL
Always use the closing tag ?> at the end of a file, don’t leave it out (this ain’t no Zend Framework, dude)
to something like
Don't end files with the closing PHP tag
?>
The change can be easily automated with a code migration that we ship with the next Flow version.
History
#1 Updated by Adrian Föder over 2 years ago
but, what was the initial intention to enforce this? Obviously the author was aware that there are other frameworks ;) that omit the closing tag; so I think there is any reason to have it?
(btw I think it's neither cumbersome nor error-prone, because caring about leading and trailing whitespaces is what us PHP-guys is given us at hand from our first line of hello-world. At least it should have been. ;)
// edit: don't get me wrong, I'm quite inpassionate about this and would give my +1 in doubt; I just want(ed) to ask.
#2 Updated by Ralf Merz over 2 years ago
The closing tag in a PHP file is optional.
http://php.net/manual/en/language.basic-syntax.instruction-separation.php
If we put that into CGL, the sentence should be:
You must not end files with the closing PHP tag ?>
I mean the use of "must not" instead of "do not".
Just my 2 cents.
Regards
Ralf
#3 Updated by Bastian Waidelich over 2 years ago
I'm pretty insensible to this tbh, but this has the most votes in the Flow tracker! ;)
Ralf Merz wrote:
If we put that into CGL, the sentence should be:
You must not end files with the closing PHP tag ?>
I mean the use of "must not" instead of "do not".
Right, it should probably be even more strict: "PHP files must not contain the closing PHP tag ?>"
#4 Updated by Mathias Brodala almost 2 years ago
This seems to have been fixed with d9d6ff9.
#5 Updated by Christopher Hlubek almost 2 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
True, I'll close it.