Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.4.2

Bug #19412 Incorrect error about assigning objects to variables when inside inline IF
Submitted: 2012-05-10 01:28 UTC
From: petdance Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.3.3)
PHP Version: 5.3.6 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2012-05-10 01:28 UTC] petdance (Andy Lester)
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.

Comments

 [2012-05-10 09:59 UTC] squiz (Greg Sherwood)
-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-10 10:57 UTC] squiz (Greg Sherwood)
 [2012-05-11 10:41 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed