Skip to content

Instantly share code, notes, and snippets.

@Danack

Danack/foo.php Secret

Created November 29, 2020 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Danack/f10e46b544c5ace1652eb669fa9d292e to your computer and use it in GitHub Desktop.
Save Danack/f10e46b544c5ace1652eb669fa9d292e to your computer and use it in GitHub Desktop.
clonis
<?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