Return values in constructor

From: Date: Sun, 05 Nov 2006 21:20:00 +0000
Subject: Return values in constructor
Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-4046@lists.php.net to get a copy of this message
Hi, I have been working on PHP-Sat, a tool for statically analyzing PHP source code. This tool currently supports 14 bugpatterns, one of them finds constructors with a return value. This pattern is partly based on this thread: http://beeblex.com/lists/index.php/php.pear.qa/531?s=l:php.pear.qa in which Michael Wallner reports 11 constructors that return a value. I examined the stable packages from pear with the use of the tool and found 13 constructors that (still) return a value. Some of the constructors are even documented with a '@return' which states that the constructors actually return these values. I was wondering whether a return value in a constructor is considered a bug within Pear. It does not break the code, but it is useless and could potentially confuse other programmers. Kind regards, Eric Bouwers === The following projects - files - classes have a constructor that returns a value: Archive:
 Tar.php                  - Archive_Tar
Auth:
 PrefManager.php    - Auth_PrefManager
Crypt/;
 CDC.php               - Crypt_CBC
DB:
 NestedSet.php       - DB_NestedSet_Node
 Table.php              - DB_Table
HTML:
 Progress/DM.php    - HTML_Progress_DM
 Progress.php          - HTML_Progress
 Table.php               - HTML_Table
Mail_Queue:
 Queue.php             - Mail_Queue
Net_Geo:
 Geo.php                - Net_Geo
Chemistry:
 Coordinates           - Science_Chemistry_Coordinates
SOAP:
 Value.php              - SOAP_Attachment
System:
 Mount.php             - System_Mount_Entry


« previous php.pear.qa (#4046) next »