@var annotations with included variable throw exception
Currently all @var annotations which contain whitespaces are regarded as illformed and throw a InvalidPropertyTypeException.
However, it is common - at least for 3rd party code - to write @var annotations that look as follows:
/** * @var integer $number */ protected $number;
A good example for this are the gedmo doctrine extensions.
Hence I suggest to parse out all variable references in the annotation before deciding on being illformed.
$declaredType = trim(implode(' ', $this->getPropertyTagValues($className, $propertyName, 'var')), ' \\');
const VARIABLE_NAME_REGEX = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/'; ... $declaredType = implode(' ', $this->getPropertyTagValues($className, $propertyName, 'var')); $declaredType = trim(preg_replace(self::VARIABLE_NAME_REGEX, '', $declaredType), ' \\');