On May 10, 2013, at 3:22 AM, Tim Starling tstarling@wikimedia.org wrote:
On 09/05/13 10:26, Krinkle wrote:
I'm obviously biased, but I think the same goes for "require_once" (and "include", "require" etc.). Right now this is causing quite a few warnings in our php-checkstyle report.
include and require return a value, so they are more like functions than return or print. See e.g. ResourceLoader.php:
$this->register( include( "$IP/resources/Resources.php" ) );
You could compare them to pseudo-functions like empty and isset. I suppose you could write:
$this->register( include "$IP/resources/Resources.php" );
But that looks kind of weird to me.
-- Tim Starling
It might take some getting used to, but I don't think it looks off.
It is similar to the "new" keyword, which also returns value.
$masterdb->add( new SlaveDB() );
-- Krinkle