Skip to content

Instantly share code, notes, and snippets.

@oddevan
Created July 10, 2025 14:42
Show Gist options
  • Save oddevan/45e14e1a40b72db5810fc339943cff5b to your computer and use it in GitHub Desktop.
Save oddevan/45e14e1a40b72db5810fc339943cff5b to your computer and use it in GitHub Desktop.
Question about future PHP capabilities
<?php
interface Entity {
public Uuid $id { get; }
}
readonly class Thing implements Entity {
public Uuid $id;
public function __construct(
public string $key
) {
$this->id = Utils::makeThingId($key);
}
}
<?php
interface Entity {
public Uuid $id { get; }
}
readonly class Thing implements Entity {
public function __construct(
public string $key
) {}
public Uuid $id {
get => Utils::makeThingId($this->key);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment