Edit report at http://pear.php.net/bugs/bug.php?id=18117&edit=1
ID: 18117
Updated by: gsherwood@squiz.net
Reported By: develop at dieploegers dot de
Summary: PEAR coding standard: Method constructor not sniffed
as a function
Status: Open
Type: Bug
Package: PHP_CodeSniffer
Operating System: openSuSE 11
Package Version: 1.3.0RC1
PHP Version: 5.3.3
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:
-Assigned To:
+Assigned To: squiz
I have no idea why the sniff was coded like that in the first place, but
it was obviously deliberate because there are even unit tests to ensure
creating new objects is ignored.
I'll dig through the history a bit and see if there is any good reason
for it. If not, I agree it should be removed and just follow the same
rules. The PEAR coding standard doesn't say anything specific about
objects as far as I can see.
Previous Comments:
------------------------------------------------------------------------
[2010-12-15 14:04:27] dploeger
Description:
------------
In the PEAR coding standard,
PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php on line #80, the
parsers exits the function code sniffer, because he's creating a new
object.
But isn't that wrong? Isn't a new object with the embedded call to the
constructor also a function call.
That way, this is valid:
$myNewObj = new NewObj("blablabla long text"
. "further long text blablabla"
);
A function call, however, prohibits the use of content after the first
open bracket...
Dennis
------------------------------------------------------------------------