rector/packages/BetterPhpDocParser/ValueObject/StartAndEnd.php

36 lines
664 B
PHP
Raw Normal View History

2019-10-13 05:59:52 +00:00
<?php
declare (strict_types=1);
namespace Rector\BetterPhpDocParser\ValueObject;
2019-02-28 21:50:53 +00:00
use Rector\Core\Exception\ShouldNotHappenException;
final class StartAndEnd
2019-02-28 21:50:53 +00:00
{
/**
* @readonly
2019-02-28 21:50:53 +00:00
* @var int
*/
private $start;
/**
* @readonly
2019-02-28 21:50:53 +00:00
* @var int
*/
private $end;
public function __construct(int $start, int $end)
{
$this->start = $start;
$this->end = $end;
if ($end < $start) {
throw new ShouldNotHappenException();
}
2019-02-28 21:50:53 +00:00
}
public function getStart() : int
2019-02-28 21:50:53 +00:00
{
return $this->start;
}
public function getEnd() : int
2019-02-28 21:50:53 +00:00
{
return $this->end;
}
}