Created
July 10, 2025 14:42
-
-
Save oddevan/45e14e1a40b72db5810fc339943cff5b to your computer and use it in GitHub Desktop.
Question about future PHP capabilities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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