Volodymyr Panivko created THRIFT-5980:
-----------------------------------------
Summary: Add native method types to PHP Transport hierarchy
Key: THRIFT-5980
URL: https://issues.apache.org/jira/browse/THRIFT-5980
Project: Thrift
Issue Type: Improvement
Components: PHP - Library
Reporter: Volodymyr Panivko
Continue the typing groundwork laid by THRIFT-5976 (properties), THRIFT-5977
(constructor promotion), THRIFT-5978 (strict_types) and THRIFT-5979 (Server +
Factory method types) by migrating the public methods on
`lib/php/lib/Transport/` from PHPDoc-only annotations to native PHP parameter
and return types.
h2. Scope
* `TTransport` abstract: isOpen(), open(), close(), read(), readAll(), write(),
flush()
* Concrete implementations (must update synchronously to satisfy LSP):
** TSocket
** TSSLSocket
** TSocketPool
** TBufferedTransport
** TFramedTransport
** TMemoryBuffer
** TNullTransport
** TPhpStream
** TCurlClient
** THttpClient
* Update affected test mocks/fixtures to match the new contracts.
h2. Out of scope
* Protocol hierarchy method types — separate ticket (by-ref params, ~6 concrete
impls).
* Exception hierarchy — separate ticket (bridge constructor with dual-mode
signature).
* Generator regen — separate ticket (G).
h2. Risk
Medium. TTransport is an abstract base with many concretes; method signatures
must change atomically in one commit. Generated client/server code under
`lib/php/test/Resources/packages/` and `test/php/gen-php-classmap/` calls these
methods from loose-mode files, so loose-mode coercion at the call boundary will
handle any scalar mismatches the typed contracts surface. Internal lib callers
(Protocol classes, Factory, Server) are all already strict and pass through the
typed values.
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` (636+ 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)