magic method error on __construct()Description:
------------
Occasionally we've been running into errors where phpcs is
reporting valid magic functions as invalid due to the double
underscore.
"156 | ERROR | Function name "__construct" is invalid; only
PHP magic methods should be prefixed with a double
underscore"vanderhuge
vanderhugehttp://pear.php.net/bugs/19411
PHP_CodeSniffer Bug
Reported by vanderhuge
2012-05-08T02:10:23+00:00
PHP: 5.3.5 OS: Ubuntu Package Version: 1.3.3
Description:
------------
Occasionally we've been running into errors where phpcs is
reporting valid magic functions as invalid due to the double
underscore.
"156 | ERROR | Function name "__construct" is invalid; only
PHP magic methods should be prefixed with a double
underscore"]]>PHP_CodeSniffer Bug
Reported by vanderhuge
2012-05-08T02:10:23+00:00
PHP: 5.3.5 OS: Ubuntu Package Version: 1.3.3
Description:
------------
Occasionally we've been running into errors where phpcs is
reporting valid magic functions as invalid due to the double
underscore.
"156 | ERROR | Function name "__construct" is invalid; only
PHP magic methods should be prefixed with a double
underscore"]]>2012-05-08T02:10:23+00:00
vanderhuge [2012-05-14 19:43] http://pear.php.net/bugs/19411#1337024597
Outstanding! Will let you know if we encounter any issues with the patch.]]>Outstanding! Will let you know if we encounter any issues with the patch.]]>2012-05-14T19:43:17+00:00
squiz [2012-05-11 05:40] http://pear.php.net/bugs/19411#1336714837
<div id="changeset">
<span class="removed">-Status: Feedback</span>
<span class="added">+Status: Closed</span>
</div>Fixed in git repo:
https://github.com/squizlabs/PHP_CodeSniffer/commit/766f102ca453e685e7a445f28
8043213cb7cde11
Thanks again for the sample file. There is no way I could have tracked this down
without it.]]><div id="changeset">
<span class="removed">-Status: Feedback</span>
<span class="added">+Status: Closed</span>
</div>Fixed in git repo:
https://github.com/squizlabs/PHP_CodeSniffer/commit/766f102ca453e685e7a445f28
8043213cb7cde11
Thanks again for the sample file. There is no way I could have tracked this down
without it.]]>2012-05-11T05:40:37+00:00
squiz [2012-05-11 05:21] http://pear.php.net/bugs/19411#1336713671
Thanks a lot for sending the sample file. The problem is related to the ignore
comments. The smallest bit of code to reproduce for me is:
/* @codingStandardsIgnoreStart */
class MyClass
{
/* @codingStandardsIgnoreEnd */
public function __construct() {}
}]]>Thanks a lot for sending the sample file. The problem is related to the ignore
comments. The smallest bit of code to reproduce for me is:
/* @codingStandardsIgnoreStart */
class MyClass
{
/* @codingStandardsIgnoreEnd */
public function __construct() {}
}]]>2012-05-11T05:21:11+00:00
vanderhuge [2012-05-08 21:02] http://pear.php.net/bugs/19411#1336510977
Thanks for the quick response - I'll clarify.
My occasionally I mean it doesn't error on every __construct() we have and I
haven't been able to suss out the pattern of which it has problems with and which it
does not.
These projects are all hosted on the same server / use the same version of PHP /
same version of PHPCS. We use basic PEAR standards without customization.
For standards training (punishment?) we occasionally have devs bring a random file
under standards - I'll e-mail you a copy of the most recent file we've run into it on.]]>Thanks for the quick response - I'll clarify.
My occasionally I mean it doesn't error on every __construct() we have and I
haven't been able to suss out the pattern of which it has problems with and which it
does not.
These projects are all hosted on the same server / use the same version of PHP /
same version of PHPCS. We use basic PEAR standards without customization.
For standards training (punishment?) we occasionally have devs bring a random file
under standards - I'll e-mail you a copy of the most recent file we've run into it on.]]>2012-05-08T21:02:57+00:00
squiz [2012-05-08 04:26] http://pear.php.net/bugs/19411#1336451206
<div id="changeset">
<span class="removed">-Status: Open</span>
<span class="added">+Status: Feedback</span>
<span class="removed">-Assigned To:</span>
<span class="added">+Assigned To: squiz</span>
</div>I can't replicate this.
What exactly does "occasionally" mean? The exact same version of PHPCS, PHP and
the code you are checking sometimes produces different results, or that PHPCS used
on different setups or code is causing issues?
Either way, are you able to provide me with code that I can run PHPCS over to make
it fail?
Also, what standard are you using? Is it a built-in one or a custom one?]]><div id="changeset">
<span class="removed">-Status: Open</span>
<span class="added">+Status: Feedback</span>
<span class="removed">-Assigned To:</span>
<span class="added">+Assigned To: squiz</span>
</div>I can't replicate this.
What exactly does "occasionally" mean? The exact same version of PHPCS, PHP and
the code you are checking sometimes produces different results, or that PHPCS used
on different setups or code is causing issues?
Either way, are you able to provide me with code that I can run PHPCS over to make
it fail?
Also, what standard are you using? Is it a built-in one or a custom one?]]>2012-05-08T04:26:46+00:00