Bug #19412 [Asn]: Incorrect error about assigning objects to variables when inside inline IF
| From: | gsherwood at squiz dot net | Date: | Thu, 10 May 2012 05:57:28 +0000 |
| Subject: | Bug #19412 [Asn]: Incorrect error about assigning objects to variables when inside inline IF | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-8637@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19412&edit=1
ID: 19412
Updated by: gsherwood@squiz.net
Reported By: andy at petdance dot com
Summary: Incorrect error about assigning objects to variables
when inside inline IF
Status: Assigned
Type: Bug
Package: PHP_CodeSniffer
Package Version: 1.3.3
PHP Version: 5.3.6
Assigned To: squiz
Roadmap Versions:
New Comment:
Fixed in git repo:
https://github.com/squizlabs/PHP_CodeSniffer/commit/7f703b27a70d041cb6cb86b49
d8e03c4a11b25fa
Previous Comments:
------------------------------------------------------------------------
[2012-05-10 05:59:37] squiz
-Summary: Incorrect "New objects must be assigned to a
variable"
+Summary: Incorrect error about assigning objects to
variables when inside inline IF
-Assigned To:
+Assigned To: squiz
------------------------------------------------------------------------
[2012-05-09 21:28:10] petdance
Description:
------------
When I run php_cs on the attached program, it complains with a "New
objects must be assigned to a variable" error. Actually, it complains
with two errors, both referring to the same line.
php_cs seems to be confounded by the conditional ?: operator.
Test script:
---------------
class Foo { }
class Bar { }
$x = FALSE;
$doodad = $x ? new Foo : new Bar;
Expected result:
----------------
I expect that php_cs not complain about the results of the constructor
being unused.
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19412&edit=1