<?php
class Point {
public function __construct(
private int $x,
private int $y,
) {}
public function manhattan(): int {
return abs($this->x) + abs($this->y);
}
}
echo (new Point(3, -4))->manhattan();constructor property promotion