This is what I’d like to do:
$app = (new Factory())->GetApp();
However, I get an “unexpected T_OBJECT_OPERATOR” error.
To avoid this, I have to do:
$Factory = new Factory();
$app = $Factory->GetApp();
Why is this necessary? I’m running PHP 5.2 if it makes any difference.
A slightly tautological answer, but it’s because that’s not supported in PHP 5.2.
However, it is in PHP 5.4 – see http://www.php.net/manual/en/migration54.other.php