Bug #19424 [Opn->Bgs]: Squiz.Objects.ObjectInstantiation wrongly reports violation
| From: | gsherwood at squiz dot net | Date: | Tue, 05 Jun 2012 00:31:06 +0000 |
| Subject: | Bug #19424 [Opn->Bgs]: Squiz.Objects.ObjectInstantiation wrongly reports violation | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-8702@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19424&edit=1
ID: 19424
Updated by: gsherwood@squiz.net
Reported By: sb at sebastian-bergmann dot de
Summary: Squiz.Objects.ObjectInstantiation wrongly reports
violation
-Status: Open
+Status: Bogus
Type: Bug
Package: PHP_CodeSniffer
Operating System: Irrelevant
Package Version: 1.3.4
PHP Version: Irrelevant
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:
-Status: Open
+Status: Bogus
-Assigned To:
+Assigned To: squiz
This is actually the intention of the sniff. The message reads "New
objects must be
assigned to a variable" and B is a new object.
This code also produces the same error and is in the unit test for the
sniff:
$object->myFunction(new MyClass());
Previous Comments:
------------------------------------------------------------------------
[2012-05-18 11:08:31] sebastian
Description:
------------
Squiz.Objects.ObjectInstantiation wrongly reports violation when a newly
instantiated object is passed as an argument
Test script:
---------------
<?php
$a = new A(new B);
Expected result:
----------------
No violation
Actual result:
--------------
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
2 | ERROR | New objects must be assigned to a variable
--------------------------------------------------------------------------------
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19424&edit=1