Hi, I guess it would work like an inline type-hint.
Something along the lines of: $circle = ShapeFactory::createShape('circle'); if (!$circle instanceof Circle) { throw …; } I would like something like this, since it saves quite some code. Cheers Jannik Am Mittwoch, 24. April 2013 um 19:19 schrieb Stas Malyshev: > Hi! > > > Are there any plans to add object type casting support in PHP? > > > > For example: > > $circle = (Circle) ShapeFactory::createShape('circle'); > > $circle->radius = 10; > > echo $circle->getArea(); > > > > > What is this supposed to do? I.e. what createShape returns and what > (Circle) operator is doing to it? > > > It would be great if this feature could be added to 5.5 :) > > 5.5 is in feature freeze, so it won't happen in any case. > > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >