code: private static function normalizeMaxLength($model, $attribute, &$options)
      {
          if (isset($options['maxlength']) && $options['maxlength'] === true) {
              unset($options['maxlength']);
              $attrName = static::getAttributeName($attribute);
              foreach ($model->getActiveValidators($attrName) as $validator) {
                  if ($validator instanceof StringValidator && $validator->max !== null) {
                      $options['maxlength'] = $validator->max;
                      break;
                  }
              }
          }
      }
docs: If `maxlength` option is set true and the model attribute is validated by a string validator,
  the `maxlength` option will take the value of [[\yii\validators\StringValidator::max]].
  @param Model $model the model object
  @param string $attribute the attribute name or expression.
  @param array $options the tag options in terms of name-value pairs.