Does anyone know if the following expression will be possible in the next version(s) of PHP?
(new A())->a(); // Causes a syntax error
A new-expression can be used as a function argument. A function call can be used as the left-hand side of the member access operator. Therefore, you just need to define a single function:
function with($object) { return $object; }
with(new A()) -> a();
No additional efforts required on a per-class basis.