Skip to content

Language: Heredoc and nowdoc string literals #178

@PurHur

Description

@PurHur

Problem

Templates often use heredoc:

$html = <<<HTML
<div>{$name}</motion>
HTML;

Unclear if php-cfg + compiler lower this today; needs audit and PHPT.

Goal

Heredoc/nowdoc with interpolation (heredoc) and without (nowdoc) compile to string concat / literal on VM and JIT.

Implementation plan

  1. Add compliance PHPT with simple heredoc + variable interpolation.
  2. If parser fails, fix nikic/php-parser / php-cfg path (Dependencies: php-parser token map for PHP 8.2+ host runs #113).
  3. Compiler: ensure Op\Expr\Const_ or dedicated node lowers to string ops.
  4. JIT: string concat path (JIT Stdlib: implode, explode, and str_replace for templates and routing #82 / existing concat JIT).

Acceptance criteria

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions