Volodymyr Panivko created THRIFT-5976:
-----------------------------------------
Summary: Add native types to PHP library properties (PHPDoc @var →
declared types)
Key: THRIFT-5976
URL: https://issues.apache.org/jira/browse/THRIFT-5976
Project: Thrift
Issue Type: Improvement
Reporter: Volodymyr Panivko
h2. Background
The PHP runtime library {{lib/php/lib/}} documents property types via PHPDoc
({{@var X}}) but doesn't declare them natively. PHP 8.1+ supports typed
properties, which catch type errors at runtime and enable phpstan to verify
access. This is a no-LSP-cascade additive change: typed properties are
inherited as-is by subclasses (no contravariance issues like with method
parameters).
h2. Scope
* Convert {{@var T}} PHPDoc on properties to native PHP type declarations
across {{lib/php/lib/}}.
* Where parent and child both declare the same property, type both consistently
in this commit.
* Where parent declares an untyped {{protected $foo}} accessed by children that
initialize with values of consistent shape, declare the appropriate type on
parent.
* Constructor property promotion in factory classes that take params 1:1 mapped
to properties (e.g. TBinaryProtocolFactory).
* Skip method parameters / return types — those are tracked separately under
THRIFT-5960.
h2. Out of scope
* Method parameter / return types (deferred to follow-up sub-tickets).
* Generator changes (deferred).
* {{declare(strict_types=1)}} (separate sub-ticket).
h2. Verification
* {{composer phpstan}} clean.
* {{vendor/bin/phpcs}} clean.
* {{vendor/bin/phpunit}} Unit + Integration green.
* Class-loading does not fatal due to type mismatches.
Parent: THRIFT-5960
Client: php
--
This message was sent by Atlassian Jira
(v8.20.10#820010)