mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-13 14:42:23 +00:00
* 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>
39 lines
702 B
PHP
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;
|
|
}
|
|
}
|