davidschwarz / line-number
Line numbers as immutable value objects. With a WeakMap based repository in the background.
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:value-object
Requires
- php: 8.2.*
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.13
- phpunit/phpunit: ^9
- psalm/plugin-phpunit: ^0.18.4
- vimeo/psalm: ^5.2
README
Line numbers as immutable value objects.
With a WeakMap based repository in the background.
installation
composer require davidschwarz/line-number
example
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