Skip to content

🚀 Feature: Add generic \wrap\ Twig filter to replace duplicated comment-wrapping logic #1479

@Parship12

Description

@Parship12

🔖 Feature description

Add a generic wrap(width, prefix) Twig filter to SDK.php that wraps a string to a given column width and prefixes each line with a given string. It will replace 10+ near-identical hardcoded comment filters spread across language classes and templates.

🎤 Pitch

Right now, the same wordwrap() logic is copy-pasted in around 8-10 places across the codebase, each hardcoded to a specific comment prefix: like in SDK.php, Web.php, Swift.php etc...

Also, 24 Twig templates (Kotlin, Android, Web, Node, React Native) do comment prefixing inline with replace({"\n": "\n * "}), which does not word-wrap at all. A single generic filter would fix all of this.

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions