20250204
This commit is contained in:
7
vendor/sebastian/lines-of-code/ChangeLog.md
vendored
7
vendor/sebastian/lines-of-code/ChangeLog.md
vendored
@@ -2,12 +2,6 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [4.0.0] - 2025-02-07
|
||||
|
||||
### Removed
|
||||
|
||||
* This component is no longer supported on PHP 8.2
|
||||
|
||||
## [3.0.1] - 2024-07-03
|
||||
|
||||
### Changed
|
||||
@@ -65,7 +59,6 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
* Initial release
|
||||
|
||||
[4.0.0]: https://github.com/sebastianbergmann/lines-of-code/compare/3.0...main
|
||||
[3.0.1]: https://github.com/sebastianbergmann/lines-of-code/compare/3.0.0...3.0.1
|
||||
[3.0.0]: https://github.com/sebastianbergmann/lines-of-code/compare/2.0...3.0.0
|
||||
[2.0.2]: https://github.com/sebastianbergmann/lines-of-code/compare/2.0.1...2.0.2
|
||||
|
2
vendor/sebastian/lines-of-code/LICENSE
vendored
2
vendor/sebastian/lines-of-code/LICENSE
vendored
@@ -1,6 +1,6 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2020-2025, Sebastian Bergmann
|
||||
Copyright (c) 2020-2024, Sebastian Bergmann
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
2
vendor/sebastian/lines-of-code/README.md
vendored
2
vendor/sebastian/lines-of-code/README.md
vendored
@@ -1,4 +1,4 @@
|
||||
[](https://packagist.org/packages/sebastian/lines-of-code)
|
||||
[](https://packagist.org/packages/sebastian/lines-of-code)
|
||||
[](https://github.com/sebastianbergmann/lines-of-code/actions)
|
||||
[](https://codecov.io/gh/sebastianbergmann/lines-of-code)
|
||||
|
||||
|
9
vendor/sebastian/lines-of-code/composer.json
vendored
9
vendor/sebastian/lines-of-code/composer.json
vendored
@@ -15,18 +15,17 @@
|
||||
"issues": "https://github.com/sebastianbergmann/lines-of-code/issues",
|
||||
"security": "https://github.com/sebastianbergmann/lines-of-code/security/policy"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.3",
|
||||
"php": ">=8.2",
|
||||
"nikic/php-parser": "^5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^12.0-dev"
|
||||
"phpunit/phpunit": "^11.0"
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "8.3"
|
||||
"php": "8.2"
|
||||
},
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true
|
||||
@@ -38,7 +37,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "4.0-dev"
|
||||
"dev-main": "3.0-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -48,6 +48,7 @@ final class Counter
|
||||
assert($nodes !== null);
|
||||
|
||||
return $this->countInAbstractSyntaxTree($linesOfCode, $nodes);
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Error $error) {
|
||||
throw new RuntimeException(
|
||||
|
16
vendor/sebastian/lines-of-code/src/Exception/NegativeValueException.php
vendored
Normal file
16
vendor/sebastian/lines-of-code/src/Exception/NegativeValueException.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of sebastian/lines-of-code.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace SebastianBergmann\LinesOfCode;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
final class NegativeValueException extends InvalidArgumentException implements Exception
|
||||
{
|
||||
}
|
@@ -43,17 +43,15 @@ final class LineCountingVisitor extends NodeVisitorAbstract
|
||||
$this->linesOfCode = $linesOfCode;
|
||||
}
|
||||
|
||||
public function enterNode(Node $node): null
|
||||
public function enterNode(Node $node): void
|
||||
{
|
||||
$this->comments = array_merge($this->comments, $node->getComments());
|
||||
|
||||
if (!$node instanceof Expr) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
$this->linesWithStatements[] = $node->getStartLine();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function result(): LinesOfCode
|
||||
|
@@ -41,9 +41,30 @@ final readonly class LinesOfCode
|
||||
* @param non-negative-int $logicalLinesOfCode
|
||||
*
|
||||
* @throws IllogicalValuesException
|
||||
* @throws NegativeValueException
|
||||
*/
|
||||
public function __construct(int $linesOfCode, int $commentLinesOfCode, int $nonCommentLinesOfCode, int $logicalLinesOfCode)
|
||||
{
|
||||
/** @phpstan-ignore smaller.alwaysFalse */
|
||||
if ($linesOfCode < 0) {
|
||||
throw new NegativeValueException('$linesOfCode must not be negative');
|
||||
}
|
||||
|
||||
/** @phpstan-ignore smaller.alwaysFalse */
|
||||
if ($commentLinesOfCode < 0) {
|
||||
throw new NegativeValueException('$commentLinesOfCode must not be negative');
|
||||
}
|
||||
|
||||
/** @phpstan-ignore smaller.alwaysFalse */
|
||||
if ($nonCommentLinesOfCode < 0) {
|
||||
throw new NegativeValueException('$nonCommentLinesOfCode must not be negative');
|
||||
}
|
||||
|
||||
/** @phpstan-ignore smaller.alwaysFalse */
|
||||
if ($logicalLinesOfCode < 0) {
|
||||
throw new NegativeValueException('$logicalLinesOfCode must not be negative');
|
||||
}
|
||||
|
||||
if ($linesOfCode - $commentLinesOfCode !== $nonCommentLinesOfCode) {
|
||||
throw new IllogicalValuesException('$linesOfCode !== $commentLinesOfCode + $nonCommentLinesOfCode');
|
||||
}
|
||||
|
Reference in New Issue
Block a user