Volodymyr Panivko created THRIFT-5979:
-----------------------------------------

             Summary: Add native method types to PHP Server and Factory classes
                 Key: THRIFT-5979
                 URL: https://issues.apache.org/jira/browse/THRIFT-5979
             Project: Thrift
          Issue Type: Improvement
          Components: PHP - Library
            Reporter: Volodymyr Panivko


After the typing groundwork in THRIFT-5976 (properties), THRIFT-5977 
(constructor promotion) and THRIFT-5978 (strict_types + writeString hierarchy), 
the public methods on the PHP Server and Factory classes still rely on PHPDoc 
`@param`/`@return` annotations only. This sub-ticket migrates them to native 
parameter and return types.

h2. Scope

* `lib/php/lib/Server/`
** TServer abstract: serve()
** TSimpleServer::serve()
** TForkingServer::serve() + supporting protected methods
** TServerTransport abstract: listen(), close(), accept(), acceptImpl()
** TServerSocket::listen(), close(), accept(), acceptImpl(), setAcceptTimeout()
** TSSLServerSocket::listen(), acceptImpl()
* `lib/php/lib/Factory/`
** TProtocolFactory interface
** TTransportFactoryInterface
** TBinaryProtocolFactory::getProtocol()
** TCompactProtocolFactory::getProtocol()
** TJSONProtocolFactory::getProtocol()
** TTransportFactory::getTransport()
** TFramedTransportFactory::getTransport()

h2. Out of scope

* Exception hierarchy (TException / TApplicationException / TProtocolException 
/ TTransportException) — bridge constructor with dual-mode signatures, extends 
\Exception. Separate ticket.
* Transport hierarchy method types — separate ticket (medium-risk LSP cascade 
through TTransport abstract).
* Protocol hierarchy method types — separate ticket (by-ref params, ~6 concrete 
impls to update synchronously).
* Generated test fixtures.

h2. Risk

Low-medium. Server and Factory subtrees are isolated — Transport / Protocol 
abstractions are referenced only via untyped composition in these classes, so 
adding native types here will not cascade out. Within each subtree the 
abstract/interface signatures match the concrete signatures, so LSP is 
maintained.

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` (629 pass)
# `./vendor/bin/phpunit -c lib/php/phpunit.xml --testsuite="Thrift PHP 
Integration Test Suite" --no-coverage` (106 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