-
-
Save Danack/f10e46b544c5ace1652eb669fa9d292e to your computer and use it in GitHub Desktop.
clonis
This file contains 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 | |
class Point { | |
public function __construct( | |
public immutable int $x, | |
public immutable int $y, | |
private immutable string $label, | |
) {} | |
public function label() { return $this->label; } | |
public function withLabel(string $label) { | |
return clone($this, label: $label); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment