[ 
https://issues.apache.org/jira/browse/THRIFT-5959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jens Geyer resolved THRIFT-5959.
--------------------------------
    Fix Version/s: 0.24.0
       Resolution: Fixed

> Adopt PSR-12 across the PHP library and align C++ generator emission style
> --------------------------------------------------------------------------
>
>                 Key: THRIFT-5959
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5959
>             Project: Thrift
>          Issue Type: New Feature
>          Components: PHP - Library
>    Affects Versions: 0.24.0
>            Reporter: Volodymyr Panivko
>            Assignee: Volodymyr Panivko
>            Priority: Major
>             Fix For: 0.24.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> The PHP coding standard documented at lib/php/coding_standards.md is
> PSR-2 (frozen since 2019; superseded by PSR-12). The PHP-CodeSniffer
> config at phpcs.xml.dist still pins it. Meanwhile, generated PHP code
> emitted by the C++ generator at compiler/cpp/src/thrift/generate/
> t_php_generator.cc has its own hand-written formatting that does not
> follow either standard precisely.
> This ticket adopts PSR-12 across both surfaces in one cycle to avoid
> two style families coexisting in the repo:
>   * Add friendsofphp/php-cs-fixer as a require-dev dependency.
>   * Add lib/php/.php-cs-fixer.dist.php with @PSR12 + @PHP81Migration
>     presets (see roadmap doc for full ruleset).
>   * Run php-cs-fixer fix once across lib/php/lib/ and lib/php/test/ to
>     reformat to PSR-12.
>   * Update phpcs.xml.dist to reference PSR12 instead of PSR2 (or remove
>     it if cs-fixer fully replaces it — to be decided in PR).
>   * Update lib/php/coding_standards.md to point at PSR-12.
>   * Update C++ generator emission in t_php_generator.cc so newly
>     generated PHP matches PSR-12: indentation, blank lines, brace
>     placement, namespace block, use ordering.
>   * Regenerate golden test fixtures under test/php/gen-php/,
>     test/php/gen-phpi/, test/php/gen-php-classmap/.
>   * Add lib-php-quality CI step that runs php-cs-fixer in --dry-run
>     mode (alongside the existing phpstan step from THRIFT-5957).
> This is a breaking change for downstream users whose own coding-style
> linters rely on the previous format of generated files. Plain runtime
> behaviour is unaffected — pure formatting.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to