Eddie Drapkin wrote:
> On Tue, Jan 19, 2010 at 11:05 AM, Stanislav Malyshev <s...@zend.com> wrote:
>> The second was next on my list, while the first seems to me kind of exotic -
>> why create object only to call one method and immediately drop it? Why this
>> method is not static then?
> 
> 
> Why would this imply "dropping" the object?
> 
> This:
>    $foo = (new bar())->someSetter();
> Looks a lot better than this
>    $foo = new bar();
>    $foo->someSetter();

The second version is much clearer.  You know exactly what $foo is.  In
the shortened version you have no idea what $foo is without reading the
code for the someSetter() method.  On first glance I would assume that
$foo would be the success/failure return of the setter and that the
object is dropped.

-Rasmus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to