Or chained the constructor (available since php 5.4) `$contract = (new Contract())->setType($type);`