Req #65344 [Asn->Csd]: Script source commenting, add syntax which allows nesting
| From: | ab@php.net | Date: | Tue, 30 Jul 2013 15:45:29 +0000 |
| Subject: | Req #65344 [Asn->Csd]: Script source commenting, add syntax which allows nesting | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-180573@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65344&edit=1
ID: 65344
Updated by: ab@php.net
Reported by: marshall dot sorenson at gmail dot com
Summary: Script source commenting, add syntax which allows
nesting
-Status: Assigned
+Status: Closed
Type: Feature/Change Request
Package: *General Issues
Operating System: Any
PHP Version: Irrelevant
Assigned To: ab
Block user comment: N
Private report: N
New Comment:
That's the solution you've asked for. Your approach wouldn't work with class
methods as well "to only match the last comment closure per file". However you
can put the whole classes into the if blocks.
But other technics like including another file to rewrite methods one by one
would work too. Things like having index_dev.php in symfony or using mock
objects are still around.
Anyway, I wasn't intended to discourage you. If you still believe such a feature
is necessary, please discuss this on internals first. Once you've a positive
feedback, feel free to go on with RFC, patch and reopening this ticket.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2013-07-30 13:35:16] marshall dot sorenson at gmail dot com
The functionality you gave an example of definitely does NOT work in all cases.
For instance, that can't be used to "comment" out class methods.
------------------------------------------------------------------------
[2013-07-29 18:17:31] ab@php.net
The functionality you're looking for is already there,
if ($cond1) {
function hello() { /* version 1 */ }
} else if ($cond2) {
function hello() { /* version 2 */ }
} else ....
------------------------------------------------------------------------
[2013-07-26 14:12:02] marshall dot sorenson at gmail dot com
Description:
------------
It would be AMAZING if there was an additional extended comment syntax which
allowed nesting and overrode C-style comments. The idea would be to only match
the last comment closure per file to allow commenting out large blocks of
functions which are PHPdoc'd or where a developer used C-style comments for
multi-line comments.
This would only be useful during development since scripts would have to be
backwards compatible with older PHP versions. I have been a PHP developer for 12
years and this would help immensely when debugging code "inherited" from another
developer!
Even if it could only be enabled with a run time INI setting, that would be
fantastic just to have it available. Perhaps even the tokens could be customized
via INI setting.
I am imagining something like this...
/*===
foo
// bar
# baz
/* fu */
===*/
man
/* chu */
===*/
If there is any interest in this I would be willing to work on the patch but
would need some mentoring.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65344&edit=1