Hi Viktor, On Mon, Feb 17, 2025 at 4:42 PM Viktor Khramov <dev.999.vic...@gmail.com> wrote:
> Hi! > > The point is here: > https://gist.github.com/vhood/665418835e65be26d5a818fded92ab75 > > Is it possible? May I create an RFC for this? > Already possible like this: class Decision { #[Main] public function __construct( private readonly Uuid $id, private readonly string $comment, ) { } public static function fromEmail(string $mailSubject, string $mailBody): static { $id = preg_replace('/pattern/', "$1", $mailSubject); $comment = preg_replace('/pattern/', "$1", $mailBody); return new static( id: new Uuid($id), comment: $comment, ); } } Related to overloading, that is binding to the correct function in Java/C# at compile time, and IMO is not matching with the dynamic nature of PHP. I think we're not losing much by not having this feature in PHP, but feel free to think more about what the implementation would look like. -- Alex