--TEST-- Generics extension: generic-like syntax inside strings and heredocs/nowdocs is not stripped --DESCRIPTION-- Tests that the strip_generics() function does not modify content inside: - Single-quoted strings - Double-quoted strings - Heredoc strings - Nowdoc strings Any <...> syntax appearing inside these contexts must be preserved verbatim. --SKIPIF-- --FILE-- '; echo $single . "\n"; // Double-quoted string: angle brackets must be preserved verbatim $double = "array"; echo $double . "\n"; // Double-quoted string with escaped quote inside $escaped = "He said \"array is cool\""; echo $escaped . "\n"; // Heredoc: angle brackets must be preserved verbatim $heredoc = << Map Collection> EOT; echo $heredoc . "\n"; // Nowdoc: angle brackets must be preserved verbatim $nowdoc = <<<'EOT' array Map Collection> EOT; echo $nowdoc . "\n"; // Verify that actual generic erasure still works outside strings class Container { private array $items = []; public function add(mixed $item): void { $this->items[] = $item; } public function first(): mixed { return $this->items[0] ?? null; } } $c = new Container(); $obj = new stdClass(); $obj->name = 'test'; $c->add($obj); echo $c->first()->name . "\n"; // Verify a string containing generic syntax does NOT affect the variable value $template = 'function foo(array $w) {}'; echo strlen($template) . "\n"; echo $template . "\n"; ?> --EXPECT-- array array He said "array is cool" array Map Collection> array Map Collection> test 33 function foo(array $w) {}