Skip to content

Language: Ternary operator (?:) — lint parity and VM compliance (#114) - #403

Merged
PurHur merged 1 commit into
masterfrom
issue-114-ternary-operator
May 20, 2026
Merged

Language: Ternary operator (?:) — lint parity and VM compliance (#114)#403
PurHur merged 1 commit into
masterfrom
issue-114-ternary-operator

Conversation

@PurHur

@PurHur PurHur commented May 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Confirm ?: is already lowered by php-cfg to Stmt_JumpIf + phi merge before Compiler runs; VM and JIT use existing TYPE_JUMPIF lowering.
  • Remove stale Expr_Ternary entry from UnsupportedRegistry and docs/unsupported-syntax.md so phpc lint no longer reports a false unsupported gap.
  • Add test/compliance/cases/language/ternary.phpt for truthy/falsy and comparison guards.

Test plan

  • vendor/bin/phpunit test/compliance/VMTest.php test/unit/UnsupportedRegistryTest.php (Docker php-compiler:22.04-dev)
  • php bin/lint.php -r 'echo (1 ? 2 : 3);' exits 0

Closes #114

Made with Cursor

php-cfg lowers ?: to JumpIf/Phi before compile; VM and JIT already handle
TYPE_JUMPIF. Remove stale lint registry entry and add regression coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 968e4dc into master May 20, 2026
@PurHur
PurHur deleted the issue-114-ternary-operator branch May 20, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language: Ternary operator (?:) in compiler pipeline

1 participant