Skip to content

Standardize coding style in sniff XML documentation code examples #1132

@rodrigoprimo

Description

@rodrigoprimo
Contributor

As discussed in #1108 (comment), currently, there is no established coding style for code examples in the sniff XML documentation files. This has led to inconsistencies in how code examples are formatted across different XML docs.

I'm not sure what the best approach is, but I do think we should have one.

Some options for consideration:

Activity

jrfnl

jrfnl commented on Jun 14, 2025

@jrfnl
Member

Use the PHPCS coding style.

Not so sure about that as the PHPCS coding style is quite custom. I think PSR12 might be more appropriate in that case.

Having said that, I agree it would be nice to set some standard, but only if we can also safeguard it - which may be difficult for the "invalid" code samples.

All in all, low priority.

rodrigoprimo

rodrigoprimo commented on Jun 17, 2025

@rodrigoprimo
ContributorAuthor

Having said that, I agree it would be nice to set some standard, but only if we can also safeguard it - which may be difficult for the "invalid" code samples.

Not only for the "invalid" code samples, but also for the "valid" code samples, if a particular sniff enforces a rule that goes against the standard that gets chosen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @rodrigoprimo@jrfnl

        Issue actions

          Standardize coding style in sniff XML documentation code examples · Issue #1132 · PHPCSStandards/PHP_CodeSniffer