can someone explain me why this was changed?

2009-10-15 Thread Martin Radosta

Check this mark-story commit:

http://code.cakephp.org/commits/view/332f6add6a97bdf738f8d1d71106834c82a46dc7#highlight

specialy this line (710):
if (in_array($options['type'], array('date', 'datetime'))) {

was changed by this line (710):
if ($options['type'] === 'date' || $options['type'] === 'datetime') {


I can remember a post (nate's post I think, but not sure) recommending 
the use of in_array because of code maintainability and readability, 
which make sence to me.

The only argument (I can imagine) against this approach is performance. 
But the Micro-optimization kind ( 
http://code.cakephp.org/tickets/view/170#c428 )

Is there any other reason?

Thanks

MARTIN






--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: can someone explain me why this was changed?

2009-10-15 Thread Gonzalo Servat
On Fri, Oct 16, 2009 at 12:19 AM, Martin Radosta martinrado...@gmail.comwrote:


 Check this mark-story commit:


 http://code.cakephp.org/commits/view/332f6add6a97bdf738f8d1d71106834c82a46dc7#highlight

 specialy this line (710):
 if (in_array($options['type'], array('date', 'datetime'))) {

 was changed by this line (710):
 if ($options['type'] === 'date' || $options['type'] === 'datetime') {


[..snip..]

Perhaps Mark made the change to check on the type? Then again, this can be
achieved by specifying 'true' as the third argument to in_array() so yeah,
not sure why the change was made (unless he didn't know about the optional
third argument to in_array())

- GS

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---