•  
      request #45607 PHPCS 4.0 changed the way files without extensions are taken into account
    Infos
    #45607
    Manuel Vacelet (vaceletm)
    2025-11-13 15:49
    2025-11-10 18:01
    47329
    Details
    PHPCS 4.0 changed the way files without extensions are taken into account

    I thought it was a bug, it it's an intended change: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/1317

    Explanation is in the PR: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/1022 as the file without extension is passed in CLI, phpcs now scans it.

    The problem is not visible when running it locally because there are differences due to short_open_tag that is enabled in nix deployment but not in docker images run in CI (it fails only in CI).

    Possibilities:

    1. Run php with short_open_tag=On in CI to skip the issue
    • is crappy
    1. Filter list of files given to phpcs to ignore files without extensions
    • is brittle because it means we maintain a double list of exclusion, one in ruleset, one for CI scanning. Risk to misconfigure and conflicts.
    1. Add every single file without extension in phpcs ruleset ignore list
    • will lead to a long list of useless entries in phpcs
    1. Run phpcs on the whole code base instead of trying to be smart
    • will make the CI job longer and consume more resources.
    Empty
    Empty
    Empty
    • [ ] enhancement
    • [x] internal improvement
    Empty
    Stage
    Thomas Gerbet (tgerbet)
    Closed
    2025-11-13
    Attachments
    Empty
    References
    Referencing request #45607

    Follow-ups

    User avatar
    Thomas Gerbet (tgerbet)2025-11-13 10:01

    Taking this one, I have been bothered by it for third time yesterday and I bumped PHPCS...