Skip to content

ReflectionProperty::__toString() renders const-expression defaults as source instead of the evaluated value #235

Description

@lisachenko

Pre-existing parity gap documented during the #223 investigation (see PR #228, "Deliberately not fixed" notes; kept out of that PR's scope).

For a property default that is a constant expression, e.g.:

class Migration {
    public const PREFIX = 'migration_';
    public string $table = self::PREFIX . 'books';
}

Go\ParserReflection\ReflectionProperty::__toString() renders the default as the source expression (self::PREFIX . 'books'), while native reflection renders the evaluated value ('migration_books'). getDefaultValue() already evaluates correctly via NodeExpressionResolver — only the string rendering diverges.

Expected: __toString() prints the evaluated default like native reflection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions