Re: Re: svn: /phpdoc/en/trunk/reference/datetime/datetime/ add.xml modify.xml setdate.xml setisodate.xml settime.xml settimestamp.xml settimezone.xml
sub.xml
| From: | Daniel Convissor | Date: | Sat, 08 May 2010 19:20:39 +0000 |
| Subject: | Re: Re: svn: /phpdoc/en/trunk/reference/datetime/datetime/ add.xml modify.xml setdate.xml setisodate.xml settime.xml settimestamp.xml settimezone.xml sub.xml |
||
| References: | 1 2 3 4 5 6 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969381808@lists.php.net to get a copy of this message | ||
Hi Folks:
On Wed, May 05, 2010 at 10:31:15AM +0200, Hannes Magnusson wrote:
>
> None of our docs mention this (see intl and mysqli for example).
>
> It is clearly expected behavior and is documented in the oo chapters.
Just because a function takes an object as a parameter does not mean the
function has to modify that object. The DateTime functions return a
DateTime object. In the following example:
$date = date_create();
$result = date_date_set($date, 2001, 2, 3);
An unsuspecting user could think only $result contains the new date and
go about needlessly writing in new variables rather than just using
$date. And eventually some such user will add a user comment telling
people that $date gets modified.
It seems to me the documentation should be explicit as to how things
work. The current parameter text says:
Procedural style only: A DateTime object returned by date_create()
I suggest it say something like:
Procedural style only: A DateTime object returned by date_create().
The function modifies this object.
What do people think?
Thanks,
--Dan
--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
data intensive web and database programming
http://www.AnalysisAndSolutions.com/
4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409