sveneld opened a new pull request, #3480: URL: https://github.com/apache/thrift/pull/3480
Type the remaining untyped methods across core lib classes and fix two real defects surfaced by the typing audit. ## Real bug fixes - **`TException::$tmethod` was missing `TType::UUID => 'Uuid'`** — TBase has had it since [THRIFT-5980](https://issues.apache.org/jira/browse/THRIFT-5980), but the HackTown-duplicated map on TException drifted. Effect: UUID-typed fields in Thrift `exception` structs fell through to the slow recursive STRUCT path instead of the scalar fast-path during read/write. Added a unit test (`testTmethodMirrorsTBase`) guarding parity between the two maps to prevent future drift. - **`TMultiplexedProcessor::process()`** now declares `: mixed` (was untyped). Return value is propagated from the dispatched underlying processor, whose return shape is generator-emitted; can tighten to `: bool` once the generator passes through a follow-up PR. ## Typing - `TBase::__construct(?array $spec = null, ?array $vals = null)` - `TBase::__wakeup(): void` - `ThriftClassLoader::registerNamespace(string $namespace, string|array $paths): void` - `ThriftClassLoader::registerDefinition(string $namespace, string|array $paths): void` - `ThriftClassLoader::register(bool $prepend = false): void` - `ThriftClassLoader::loadClass(string $class): void` - `ThriftClassLoader::findFileInApcu(string $class): ?string` — corrects the previous loose contract; `apcu_fetch` returns `false` on cache-miss, so we coerce to `null` to match the nullable return - `TSocketPool::apcuFetch(string $key, ?bool &$success = null): mixed` - `TSocketPool::apcuStore(string $key, mixed $var, int $ttl = 0): bool` - `TConstant::get(string $constant): mixed` ## Validation (Docker `thrift-php-dev:local`) - `phpcs` — 0 errors - `phpstan` (level 5) — 0 errors - `phpunit` Unit Suite — 636 tests (+1 new `tmethod`-parity guard), 0 failures - `phpunit` Integration Suite — 108 tests, 0 failures Follow-up to [THRIFT-6000](https://issues.apache.org/jira/browse/THRIFT-6000) within the umbrella [THRIFT-5960](https://issues.apache.org/jira/browse/THRIFT-5960). - [x] Apache Jira ticket — [THRIFT-6001](https://issues.apache.org/jira/browse/THRIFT-6001) - [x] PR title follows the pattern "THRIFT-NNNN: …" - [x] Squashed to a single commit - [x] `TBase::__construct` signature change widens `null` (was untyped, now `?array`); backwards compatible — any existing caller that passed null or an array continues to work, while passing a different scalar now fails loudly under strict types instead of silently mis-iterating. 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]
