Hi Thomas, > On 12 Dec 2014, at 15:42, Thomas Bley <ma...@thomasbley.de> wrote: > > 1) I think it would be better to have ObjectSafe Calls, e.g. > > class User { > ... > public function delete() { > // delete ... > } > } > class Users { > public function find($id) { > if ($this->db->query(...)) return new User($id); > return 'not found'; > } > } > > $users = new Users(); > $result = $users->find(42)?->delete(); // $result = 'not found'; > > That way we can use scalars as return for further processing. > > Definition: > Calling $obj?->foo(..) behaves identically to $obj->foo(..) if $obj is an > object. If $obj is not an $object, then it returns $obj.
This would prevent adding methods for scalars or arrays in future, so I don’t like it. Thanks. -- Andrea Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php