Return values in constructor
| From: | Eric Bouwers | 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_TarAuth:
PrefManager.php - Auth_PrefManagerCrypt/;
CDC.php - Crypt_CBCDB:
NestedSet.php - DB_NestedSet_Node Table.php - DB_TableHTML:
Progress/DM.php - HTML_Progress_DM Progress.php - HTML_Progress Table.php - HTML_TableMail_Queue:
Queue.php - Mail_QueueNet_Geo:
Geo.php - Net_GeoChemistry:
Coordinates - Science_Chemistry_CoordinatesSOAP:
Value.php - SOAP_AttachmentSystem:
Mount.php - System_Mount_Entry