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

   Final phase of the umbrella ticket 
[THRIFT-5960](https://issues.apache.org/jira/browse/THRIFT-5960) PHP 
modernization. Step `lib/php/phpstan.neon` level from 1 to 5 and address every 
issue PHPStan surfaces along the way.
   
   ## Real fixes
   
   - **`TBinaryProtocol::readI64`** — cast `$arr[1]` / `$arr[2]` to `int` 
before bitwise-NOT on 32-bit hosts. `unpack('N2', …)` is documented to return 
ints but the static return type is `array|false`; the explicit casts silence 
PHPStan and document intent.
   - **`TSocket::write`** — drop the dead `$written === -1` branch from the 
post-`fwrite()` check. `fwrite()` returns `int|false`, never `-1`, so the 
comparison was strict-false at every call.
   - **`ThriftClassLoader::findFile`** — convert return type to `?string` (was 
documented `string` but the body had an empty `return;` for the "wrong call" 
path) and change `return;` / implicit fall-through to explicit `return null;`. 
Drops a `#HOW TO TEST THIS?` rhetorical comment.
   - **`TMultiplexedProcessor::registerProcessor`** — type the parameters as 
`(string $serviceName, object $processor): void` and reformat the Javadoc-style 
`@param` tags to PHP convention.
   
   ## Defensive dead-code baseline
   
   The non-scalar map-key path in `TBase::writeMap` / `TException::writeMap` 
mirrors the Thrift IDL `map<Struct|Map|List|Set, V>` semantics, but PHP arrays 
only admit `int|string` keys so this arm is unreachable at runtime. The four 
corresponding messages are baselined with an explanatory comment.
   
   The pre-existing `ThriftClassLoader::findFile` baseline entry is removed 
since the real fix above closes it.
   
   ## Validation
   
   - `phpcs` — 0 errors (lib + test)
   - `phpstan` level 5 — 0 errors
   - `phpunit` Unit Suite — 635 tests, 0 failures
   - `phpunit` Integration Suite — 108 tests, 0 failures
   
   Completes the umbrella 
[THRIFT-5960](https://issues.apache.org/jira/browse/THRIFT-5960).
   
   - [x] Did you create an Apache Jira ticket? — 
[THRIFT-5999](https://issues.apache.org/jira/browse/THRIFT-5999)
   - [x] PR title follows the pattern "THRIFT-NNNN: describe my issue"
   - [x] Squashed to a single commit
   - [x] No breaking changes (`findFile`'s return type now correctly reflects 
existing behavior; `registerProcessor`'s typed parameters were the documented 
contract)
   
   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