Skip to content

A typed class constant with a nullable type (PHP 8.3) is a parse error here #418

Closed

Description

@blacktrs

Summary

A typed class constant with a nullable type (PHP 8.3) is a parse error here.

Repro

<?php
class A { const ?int X = null; const string|int Y = 5; }
var_dump(A::X, A::Y);

Expected (php)

NULL
int(5)

Actual (manticore 35461ba2, Darwin arm64)

compile failed (rc=65):
tests/aot/repro/wrong/typed_class_constant_with_nullable_type_does_not_parse.php:3:17: error: expected const name
Found 1 error(s), 0 warning(s).
tests/aot/repro/wrong/typed_class_constant_with_nullable_type_does_not_parse.php: parse failed: expected const name at line 3, column 17
compile: front-end (parse/typeck/IR) returned null (rc=65)

Tracking

Known-bug repro: tests/aot/repro/wrong/typed_class_constant_with_nullable_type_does_not_parse.php — bash tests/aot/xfail.sh -k typed_class_constant_with_nullable_type_does_not_parse reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    wrong-answer
    on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions