mirror of
https://github.com/safishamsi/graphify.git
synced 2026-07-16 12:27:06 +00:00
51f805e953
PHP 8 constructor property promotion (`__construct(private Repo $repo)`) parses the promoted parameter as `property_promotion_parameter`, not `simple_parameter`. The PHP parameter loop filtered on `simple_parameter` only, so promoted params were skipped entirely: their type emitted no `parameter_type` edge on the constructor, and — because a promoted param is also a real class field — no `field` edge on the class either. A non-promoted param in the same signature still emitted `parameter_type`, so the type reference was silently dropped for exactly the promoted case. The promoted param's type sits in the same direct named-child shape the loop already reads for `simple_parameter`, so widening the filter to accept `property_promotion_parameter` makes the existing type extraction emit the `parameter_type` edge. Additionally, for a promoted param, emit a `field`-context references edge on the class (mirroring the `property_declaration` handler), guarded so it only fires when a parent class is in scope and the target is not the class node itself. Normal `simple_parameter` behaviour is unchanged. Adds a promoted-property constructor to tests/fixtures/sample.php and test_php_constructor_property_promotion_contexts asserting the promoted type appears as both `field` and `parameter_type`, and that a non-promoted param does not leak a field edge.