Line numbers as immutable value objects.
With a WeakMap based repository in the background.
composer require davidschwarz/line-number
require __DIR__ . '/vendor/autoload.php';
use DavidSchwarz\LineNumber\Line;
$startLine = Line::number(0);
$otherLine = $startLine->add(2);
$otherLine->equals($startLine); // FALSE
$otherLine->equals(2); // TRUE
(string) Line::number(7); // '7'
Line::number(7)->i; // 7
Line::number(-1); // throws ...\NegativeValueError
Line::number(0)->subtract(2); // throws ...\NegativeResultError