Bug #19412 [Opn]: Incorrect error about assigning objects to variables when inside inline IF
| From: | gsherwood at squiz dot net | Date: | Thu, 10 May 2012 04:59:37 +0000 |
| Subject: | Bug #19412 [Opn]: 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-8636@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 "New objects must be assigned to a
variable"
+Summary: Incorrect error about assigning objects to variables
when inside inline IF
Status: Open
Type: Bug
Package: PHP_CodeSniffer
Package Version: 1.3.3
PHP Version: 5.3.6
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:
-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
Previous Comments:
------------------------------------------------------------------------
[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