Skip to content

REPL cannot read or write static properties #10

Description

@MarcelloDuarte

Static property access is not implemented:

phunkie > class Counter { public static int $count = 0; }
// class Counter defined
phunkie > Counter::$count
Error: Evaluation error: Unsupported expression type: PhpParser\Node\Expr\StaticPropertyFetch

evaluateNode() has no Expr\StaticPropertyFetch branch, so it falls through to the catch-all at src/Functions/evaluation.php:415. Assignment (Counter::$count = 1) fails the same way.

Static methods and class constants both work, so this is an isolated hole rather than a general lack of static support.

It also blocks acceptance coverage for a PHP 8.5 feature: asymmetric visibility on static properties (public private(set) static string $x), which cannot be demonstrated without reading the property back.

Needs read and write branches, plus static::/self::/parent:: resolution and visibility enforcement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions