sveneld opened a new pull request, #3465:
URL: https://github.com/apache/thrift/pull/3465

   Type the public surface of the PHP exception hierarchy in 
`lib/php/lib/Exception/`.
   
   **Changes:**
   
   - `TException::__construct(string|array|null $p1 = null, int|array $p2 = 0)` 
— preserves the **bridge constructor** that accepts either standard Exception 
args (`message`, `code`) or Thrift Base `spec`/`vals`. Union types capture the 
polymorphism explicitly.
   - `TApplicationException` — typed `__construct(?string $message = null, int 
$code = 0)` plus `read(TProtocol $output): int` and `write(TProtocol $output): 
int`. Added `use Thrift\Protocol\TProtocol;`.
   - `TProtocolException` — typed `__construct(?string $message = null, int 
$code = 0)`.
   - `TTransportException` — typed `__construct(?string $message = null, int 
$code = 0)`.
   
   **Out of scope:**
   
   The internal serialization helpers in `TException` (`readMap`, `readList`, 
`readStruct`, `writeMap`, `writeList`, `writeStruct`) mirror the same untyped 
helpers on `TBase`. Typing those is a separate concern (would need to be 
applied consistently across both classes and would touch broader by-ref 
dynamic-dispatch behavior).
   
   **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
   
   Part of the umbrella ticket 
[THRIFT-5960](https://issues.apache.org/jira/browse/THRIFT-5960) (PHP 
modernization).
   
   - [x] Did you create an Apache Jira ticket? — 
[THRIFT-5985](https://issues.apache.org/jira/browse/THRIFT-5985)
   - [x] PR title follows the pattern "THRIFT-NNNN: describe my issue"
   - [x] Squashed to a single commit
   - [x] No breaking changes (subclass narrowing `string|null` from 
`string|array|null` is a no-op for the standard `new TXxx($msg, $code)` call 
pattern; the bridge `new TException($spec, $vals)` still works at the base 
class)
   
   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]

Reply via email to