$ ./guess_the_languageProgramming Languages
Programming Languages · hard · #559

Which programming language is this?

final class Money
{
    public function __construct(
        public readonly int $cents,
    ) {}

    public static function zero(): static { return new static(0); }
}

Answer: PHP

Constructor property promotion with public readonly int $cents and the static return type are modern PHP.
Play Programming Languages ▸