sveneld opened a new pull request, #3460:
URL: https://github.com/apache/thrift/pull/3460
Migrates the public methods on `lib/php/lib/Transport/` from PHPDoc
`@param`/`@return` annotations to native parameter and return types. Completes
the typing trajectory for the Transport subtree started by THRIFT-5976
(properties), THRIFT-5977 (ctor promotion), THRIFT-5978 (`strict_types`) and
THRIFT-5979 (Server + Factory method types).
## Library
- **`TTransport` abstract** — `isOpen(): bool`, `open(): void`, `close():
void`, `read(int): string`, `readAll(int): string`, `write(string): void`,
`flush(): void`.
- **`TSocket` / `TSSLSocket` / `TSocketPool`** — open/close/read/write/flush
typed; setSendTimeout/setRecvTimeout/setDebug/setNumRetries/etc typed; getHost
/ getPort typed; setHandle return typed.
- **`TBufferedTransport` / `TFramedTransport` / `TMemoryBuffer` /
`TNullTransport` / `TPhpStream`** — all method overrides typed to match the
abstract.
- **`TFramedTransport::write`** keeps the legacy `?int $len = null` optional
parameter so existing internal callers in `TBinaryProtocol` /
`TCompactProtocol` still type-check; the non-write path now delegates with just
the buffer.
- **`TCurlClient` / `THttpClient`** — read/write/flush/close/open typed;
timeout setters typed as `float|int|null`; `addHeaders` typed `array`.
## Small fixes surfaced by typing
- **`TJSONProtocol::writeJSONDouble` /
`TSimpleJSONProtocol::writeJSONDouble`** — `json_encode` returns `string|false`
(the latter for NAN/INF), now cast to `(string)` before writing into the typed
transport.
- **`TSocket::setSendTimeout` / `setRecvTimeout`** — switched from
`floor($timeout / 1000)` to `intdiv($timeout, 1000)` so the typed int property
assignment matches `int` exactly (`floor` returns `float`).
## Tests
- **`TBinaryProtocolTest` / `TCompactProtocolTest` /
`TBufferedTransportTest` / `TFramedTransportTest`** — dropped `->willReturn(N)`
from mocks of the now-`void` write/open/close/flush. Behavior unchanged;
PHPUnit refuses to mock returning a value for void methods.
- **`TFramedTransportTest::testWrite`** — mock `with('12345', 5)` updated to
`with('12345')` after the non-write path now passes only the buffer to the
underlying transport.
Part of [THRIFT-5960](https://issues.apache.org/jira/browse/THRIFT-5960) —
modernizing PHP runtime library typing.
- [x] Did you create an [Apache
Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket? —
[THRIFT-5980](https://issues.apache.org/jira/browse/THRIFT-5980)
- [x] If a ticket exists: Does your pull request title follow the pattern
"THRIFT-NNNN: describe my issue"? — yes
- [x] Did you squash your changes to a single commit? — yes
- [x] Did you do your best to avoid breaking changes? — yes; abstract
signatures match what implementations already produced, no public-API removal,
covariant return narrowings only. The two small `(string) json_encode(...)`
casts are correctness fixes for NAN/INF.
- [ ] If your change does not involve any code, include `[skip ci]` anywhere
in the commit message to free up build resources. — N/A (code change)
Generated-by: Claude Opus 4.7
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]