•  
      request #37539 Forbid PHP double quotes unless necessary
    Infos
    #37539
    Joris MASSON (jmasson)
    2024-03-28 11:02
    2024-03-28 09:38
    39130
    Details
    Forbid PHP double quotes unless necessary

    In PHP, single-quoted strings and double-quoted strings do not have the same features [0]. Double-quoted strings allow variable interpolation, but single-quoted strings do not.
    The proposed style rule is to forbid double quotes unless variable interpolation or other escaped characters (like \n character) are used. The goal is to make it clear when we intend to use variable interpolation or other double-quoted strings features. Most of the time, we just want to write a plain string of characters, so those features are not needed and could be unintentionally used.

    Please note that this will create a difference with TypeScript where double quotes are mandatory.

    [0] https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double

    Other
    Empty
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Joris MASSON (jmasson)
    Closed
    2024-03-28
    Attachments
    Empty
    References

    Follow-ups