rector/packages/BetterPhpDocParser/ValueObject/StartAndEnd.php
Abdul Malik Ikhsan fc10fce13d
[Rectify] [Php81] Enable Rectify on Readonly Property only (#1384)
* re-enable rectify and ecs

* [Rectify] [Php81] Enable Rectify on Readonly Property only

* comment

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

Co-authored-by: GitHub Action <action@github.com>
2021-12-04 15:32:52 +03:00

39 lines
702 B
PHP

<?php
declare(strict_types=1);
namespace Rector\BetterPhpDocParser\ValueObject;
use Rector\Core\Exception\ShouldNotHappenException;
final class StartAndEnd
{
public function __construct(
private readonly int $start,
private readonly int $end
) {
if ($end < $start) {
throw new ShouldNotHappenException();
}
}
public function getStart(): int
{
return $this->start;
}
public function getEnd(): int
{
return $this->end;
}
public function contains(int $position): bool
{
if ($position < $this->start) {
return false;
}
return $position < $this->end;
}
}