Volodymyr Panivko created THRIFT-5960:
-----------------------------------------
Summary: Adopt strict_types and native parameter / return /
property types in lib/php/lib/
Key: THRIFT-5960
URL: https://issues.apache.org/jira/browse/THRIFT-5960
Project: Thrift
Issue Type: New Feature
Components: PHP - Library
Affects Versions: 0.24.0
Reporter: Volodymyr Panivko
Assignee: Volodymyr Panivko
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)