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

Volodymyr Panivko updated THRIFT-5981:
--------------------------------------
        Parent: THRIFT-5960
    Issue Type: Sub-task  (was: Improvement)

> Add native method types to PHP Protocol hierarchy
> -------------------------------------------------
>
>                 Key: THRIFT-5981
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5981
>             Project: Thrift
>          Issue Type: Sub-task
>          Components: PHP - Library
>            Reporter: Volodymyr Panivko
>            Assignee: Volodymyr Panivko
>            Priority: Minor
>              Labels: pull-request-available
>
> Continue the typing groundwork laid by THRIFT-5976/5977/5978/5979/5980 by 
> migrating the public methods on `lib/php/lib/Protocol/` from PHPDoc-only 
> annotations to native PHP parameter and return types. Completes typing of the 
> three core hierarchies (Transport, Server/Factory, Protocol).
> h2. Scope
> * `TProtocol` abstract: write*: int, read* with nullable by-ref parameters 
> (e.g. `readMessageBegin(?string &$name, ?int &$type, ?int &$seqid): int`).
> * Concrete implementations (must update synchronously to satisfy LSP):
> ** TBinaryProtocol
> ** TBinaryProtocolAccelerated
> ** TCompactProtocol
> ** TJSONProtocol
> ** TSimpleJSONProtocol
> ** TMultiplexedProtocol
> ** TProtocolDecorator
> * Update affected test mocks/fixtures.
> h2. By-ref param strategy
> The `read*` methods use by-ref output parameters by convention. PHP allows 
> native types on by-ref params; we use `?T &$name` so callers can pass 
> uninitialized (null) variables and the protocol fills them. Generated code 
> passes already-null vars, so this matches existing call patterns.
> h2. Out of scope
> * Exception hierarchy method types — separate ticket.
> * Generator regen — separate ticket (G).
> h2. Risk
> High. By-ref params plus 7 concrete implementations need synchronized updates 
> in one atomic commit. LSP-cascade through TProtocol abstract is wide.
> h2. Verification
> # `./vendor/bin/phpcs --report=summary` (0 errors)
> # `./vendor/bin/phpstan analyse -c lib/php/phpstan.neon --no-progress` (0 
> errors)
> # `./vendor/bin/phpunit -c lib/php/phpunit.xml --testsuite="Thrift PHP Unit 
> Test Suite" --no-coverage` (639+ pass)
> # `./vendor/bin/phpunit -c lib/php/phpunit.xml --testsuite="Thrift PHP 
> Integration Test Suite" --no-coverage` (108 pass)
> # Cross-test matrix (CI).
> Part of THRIFT-5960 umbrella to modernize PHP runtime library typing.



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

Reply via email to