protected function getValueByAnnotatedType(ReflectionProperty $property, $value)
    {
        $comment = $property->getDocComment();
        if (preg_match('/@var (.+?)(\|null)? /', $comment, $matches)) {
            switch ($matches[1]) {
                case 'integer':
                case 'int':
                    $value = (int) $value;
                    break;
                case 'float':
                    $value = (float) $value;
                    break;
            }
        }

        return $value;
    }
protected function getValueByAnnotatedType(ReflectionProperty $property, $value)
    {
        $comment = $property->getDocComment();
        if (preg_match('/@var (.+?)(\|null)? /', $comment, $matches)) {
            switch ($matches[1]) {
                case 'integer':
                case 'int':
                    $value = (int) $value;
                    break;
                case 'float':
                    $value = (float) $value;
                    break;
            }
        }

        return $value;
    }
protected function getValueByAnnotatedType ( ReflectionProperty $ property , $ value ) { $ comment = $ property -> getDocComment ( ) ; if ( preg_match ( '/@var (.+?)(\|null)? /' , $ comment , $ matches ) ) { switch ( $ matches [ 1 ] ) { case 'integer' : case 'int' : $ value = ( int ) $ value ; break ; case 'float' : $ value = ( float ) $ value ; break ; } } return $ value ; }
Guesses and converts property type by phpdoc comment.

@param ReflectionProperty $property
@param  mixed $value
@return mixed
Guesses and converts property type by phpdoc comment .