function LinesOfCode::__construct
@psalm-param non-negative-int $linesOfCode @psalm-param non-negative-int $commentLinesOfCode @psalm-param non-negative-int $nonCommentLinesOfCode @psalm-param non-negative-int $logicalLinesOfCode
Throws
File
-
vendor/
sebastian/ lines-of-code/ src/ LinesOfCode.php, line 46
Class
- LinesOfCode
- @psalm-immutable
Namespace
SebastianBergmann\LinesOfCodeCode
public function __construct(int $linesOfCode, int $commentLinesOfCode, int $nonCommentLinesOfCode, int $logicalLinesOfCode) {
/** @psalm-suppress DocblockTypeContradiction */
if ($linesOfCode < 0) {
throw new NegativeValueException('$linesOfCode must not be negative');
}
/** @psalm-suppress DocblockTypeContradiction */
if ($commentLinesOfCode < 0) {
throw new NegativeValueException('$commentLinesOfCode must not be negative');
}
/** @psalm-suppress DocblockTypeContradiction */
if ($nonCommentLinesOfCode < 0) {
throw new NegativeValueException('$nonCommentLinesOfCode must not be negative');
}
/** @psalm-suppress DocblockTypeContradiction */
if ($logicalLinesOfCode < 0) {
throw new NegativeValueException('$logicalLinesOfCode must not be negative');
}
if ($linesOfCode - $commentLinesOfCode !== $nonCommentLinesOfCode) {
throw new IllogicalValuesException('$linesOfCode !== $commentLinesOfCode + $nonCommentLinesOfCode');
}
$this->linesOfCode = $linesOfCode;
$this->commentLinesOfCode = $commentLinesOfCode;
$this->nonCommentLinesOfCode = $nonCommentLinesOfCode;
$this->logicalLinesOfCode = $logicalLinesOfCode;
}