> > Currently PHP supports generic castings like (string), (int), ... maybe is > time to allow class castings like (ToClass) $fromObject?
I've proposed something similar a year ago: https://externals.io/message/105332 My intention wasn't to create an object from a scalar, nor was it to limit to a class' methods & properties (hardly possible in PHP), but to ensure that the value is an instance of the given class/interface, or throw an exception. My proposal wasn't so well received, though. — Ben