|
5 | 5 | /** |
6 | 6 | * Regression tests for the per-AST identity map on native parser nodes. |
7 | 7 | * |
8 | | - * The native extension constructs a fresh PHP wrapper for every accessor |
9 | | - * call. Without interning, two reads of the same logical node would yield |
10 | | - * distinct objects, and a mutation made through a still-live wrapper would be |
11 | | - * invisible through the second. WP_Parser_Node exposes public mutators and |
12 | | - * stable child identity, so the native wrapper must preserve both. |
| 8 | + * The native extension materializes PHP wrappers from Rust-owned arena nodes. |
| 9 | + * Without interning, two reads of the same logical node would yield distinct |
| 10 | + * objects, and a mutation made through a still-live wrapper would be invisible |
| 11 | + * through the second. WP_Parser_Node exposes public mutators and stable child |
| 12 | + * identity, so the native wrapper must preserve both. |
13 | 13 | * |
14 | | - * Skipped when the native extension is not loaded — the pure-PHP code |
| 14 | + * Skipped when the native extension is not loaded; the pure-PHP code |
15 | 15 | * path already has stable identity by construction. |
16 | 16 | */ |
17 | 17 | class WP_MySQL_Native_Parser_Node_Identity_Tests extends TestCase { |
@@ -96,11 +96,9 @@ public function test_mutation_on_child_survives_re_read(): void { |
96 | 96 | $child = $tree->get_first_child_node(); |
97 | 97 | $this->assertNotNull( $child ); |
98 | 98 |
|
99 | | - // Mutate via the public WP_Parser_Node API — this is exactly the |
100 | | - // kind of state the reviewer worried would be lost when accessors |
101 | | - // hand back fresh wrappers. rule_name is a declared public property |
102 | | - // that the parser itself sets, so PHP 8.2's dynamic-property |
103 | | - // deprecation does not apply here. |
| 99 | + // Mutate via the public WP_Parser_Node API. This catches regressions |
| 100 | + // where accessors hand back fresh wrappers and lose state written |
| 101 | + // through a previously returned child. |
104 | 102 | $child->rule_name = 'mutated-rule'; |
105 | 103 |
|
106 | 104 | $same_child = $tree->get_first_child_node(); |
|
0 commit comments