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

   Adds `declare(strict_types=1);` to every PHP file in `lib/php/lib/` and 
non-fixture `lib/php/test/`, between the license docblock and the namespace 
declaration. Strict-mode runtime checking now enforces the native parameter and 
property types added by THRIFT-5976 (properties) and THRIFT-5977 (constructor 
property promotion) — silent scalar coercion (`"5"` → `5`, `0.5` → `0`) becomes 
a `TypeError` at the call site instead of slipping through.
   
   Pure additive change: 250 lines added across 124 files, no signature edits, 
no LSP cascade. Loose-mode generated fixtures under 
`lib/php/test/Resources/packages/` remain untouched and continue to call 
strict-mode lib code without issue (PHP enforces strictness at the *caller's* 
file, not the callee's).
   
   Two pre-existing coercion bugs were exposed and fixed:
   
   - `TPhpStream::__construct` was assigning the int result of `$mode & 
self::MODE_R` / `$mode & self::MODE_W` into typed `bool $read` / `bool $write` 
properties. PHP 7-style loose mode silently coerced int → bool; strict mode now 
requires an explicit cast. Added `(bool)` cast and tightened `$mode` parameter 
type to `int`.
   - `THttpClientTest::flushDataProvider` was passing `'port' => '80'` (string) 
into `THttpClient::__construct`, whose promoted `$port` is typed `int`. 
Replaced with literal `80`.
   
   Generated fixtures stay loose-typed; their regeneration is tracked 
separately under the THRIFT-5960 umbrella.
   
   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-5978](https://issues.apache.org/jira/browse/THRIFT-5978)
   - [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 (additive only; 
the two test/lib tweaks are existing-bug fixes, not new behavior)
   - [ ] 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]

Reply via email to