How about `$constant = (is_string($object) ? $object : get_class($object)).'::'.$constant;`