stripTags() ->when( $this->decodeEntities, fn (Stringable $str) => $str->pipe( fn (Stringable $s) => html_entity_decode( $s->value(), ENT_QUOTES | ENT_HTML5, 'UTF-8' ) ) ) ->replace("\r\n", "\n") ->trim() ->length('UTF-8'); if ($length > $this->max) { $fail('validation.max.string')->translate([ 'attribute' => $attribute, 'max' => $this->max, ]); } } }