On 23/04/2019 13:32, Benjamin Morel wrote:
Aw. I did not think about a possible conflict here, thanks for bringing
this up!

It keeps coming back to the feature we've all been praying to the PHP Gods for... generics.

function cast<type T>(object $obj): T {
  if ($obj instanceof T) {
    return $obj;
  }

  throw new InvalidArgumentException('Cast expected ' . T);
}

$x = cast<App.Object>($obj);

--
Mark Randall

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to