sveneld opened a new pull request, #3474: URL: https://github.com/apache/thrift/pull/3474
Type the protected/private serialization helpers shared by `TBase` and its HackTown duplicate on `TException`. **Typed signatures:** ```php protected function readStruct(string $class, array $spec, TProtocol $input): int protected function writeStruct(string $class, array $spec, TProtocol $output): int private function readMap(mixed &$var, array $spec, TProtocol $input): int private function readList(mixed &$var, array $spec, TProtocol $input, bool $set = false): int private function writeMap(array $var, array $spec, TProtocol $output): int private function writeList(array $var, array $spec, TProtocol $output, bool $set = false): int ``` **Design notes:** - **Read by-ref** uses `mixed &$var` because callers commonly pass an uninitialised local (or `null`) which the helper assigns an `array` into. PHP forbids re-typing a non-mixed reference once bound; `mixed` is the only PHP type that admits the "starts as null, becomes array" lifecycle. - **Write** pins `$var` to `array` since callers always pass a PHP array for map/set/list values. - The HackTown duplication of helpers between `TBase` and `TException` is preserved as-is (motivated comment is in the source). **Library changes:** - `lib/php/lib/Base/TBase.php`: all six helper signatures typed; `TProtocol` import was already there from earlier modernization. - `lib/php/lib/Exception/TException.php`: all six helper signatures typed. Adds `use Thrift\Protocol\TProtocol;` (re-ordering imports alphabetically). **Validation (Docker `thrift-php-dev:local`):** - `phpcs` — 0 errors - `phpstan` (level 1) — 0 errors - `phpunit` Unit Suite — 635 tests, 0 failures - `phpunit` Integration Suite — 108 tests, 0 failures Completes the in-library typing pass started by [THRIFT-5981](https://issues.apache.org/jira/browse/THRIFT-5981) (TProtocol abstract + concrete protocols) and [THRIFT-5985](https://issues.apache.org/jira/browse/THRIFT-5985) (TException public surface). Part of the umbrella ticket [THRIFT-5960](https://issues.apache.org/jira/browse/THRIFT-5960). - [x] Did you create an Apache Jira ticket? — [THRIFT-5995](https://issues.apache.org/jira/browse/THRIFT-5995) - [x] PR title follows the pattern "THRIFT-NNNN: describe my issue" - [x] Squashed to a single commit - [x] No breaking changes (helpers are `private`/`protected`; subclasses that override via custom transports would have already type-checked through existing fixtures) 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]
