<?php $object = ...; if (is_string($object->name)) { $object->name; // string type } if ($object->var instanceof ArrayObject) { $object->var->append(1); }
Good point, it's similar to https://community.devsense.com/d/1709-type-check-conditions-should-override-out-of-scope-docblock