Composer installs update

This commit is contained in:
Clemens Schwaighofer
2022-03-14 19:49:37 +09:00
parent 40edbe271d
commit 38903020fb
33 changed files with 495 additions and 534 deletions

View File

@@ -2,6 +2,20 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [9.2.15] - 2022-03-07
### Fixed
* [#885](https://github.com/sebastianbergmann/php-code-coverage/issues/885): Files that have only `\r` (CR, 0x0d) EOL characters are not handled correctly
* [#907](https://github.com/sebastianbergmann/php-code-coverage/issues/907): Line with only `return [` is not recognized as executable
## [9.2.14] - 2022-02-28
### Fixed
* [#904](https://github.com/sebastianbergmann/php-code-coverage/issues/904): Lines of code containing the `match` keyword were not recognized as executable correctly
* [#905](https://github.com/sebastianbergmann/php-code-coverage/issues/905): Lines of code in constructors were not recognized as executable correctly when constructor property promotion is used
## [9.2.13] - 2022-02-23
### Changed
@@ -384,6 +398,8 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* This component is no longer supported on PHP 7.1
[9.2.15]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.14...9.2.15
[9.2.14]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.13...9.2.14
[9.2.13]: https://github.com/sebastianbergmann/php-code-coverage/compare/c011a0b6aaa4acd2f39b7f51fb4ad4442b6ec631...9.2.13
[9.2.12]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.11...c011a0b6aaa4acd2f39b7f51fb4ad4442b6ec631
[9.2.11]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.10...9.2.11

View File

@@ -10,21 +10,27 @@
namespace SebastianBergmann\CodeCoverage\StaticAnalysis;
use PhpParser\Node;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\ArrayDimFetch;
use PhpParser\Node\Expr\ArrayItem;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\CallLike;
use PhpParser\Node\Expr\Cast;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Expr\Match_;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\NullsafePropertyFetch;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\StaticPropertyFetch;
use PhpParser\Node\Expr\Ternary;
use PhpParser\Node\MatchArm;
use PhpParser\Node\Scalar\Encapsed;
use PhpParser\Node\Stmt\Break_;
use PhpParser\Node\Stmt\Case_;
use PhpParser\Node\Stmt\Catch_;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Continue_;
use PhpParser\Node\Stmt\Do_;
use PhpParser\Node\Stmt\Echo_;
@@ -60,6 +66,11 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
*/
private $propertyLines = [];
/**
* @psalm-var array<int, Return_>
*/
private $returns = [];
public function enterNode(Node $node): void
{
$this->savePropertyLines($node);
@@ -82,6 +93,8 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
*/
public function executableLines(): array
{
$this->computeReturns();
sort($this->executableLines);
return $this->executableLines;
@@ -98,6 +111,25 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
}
}
private function computeReturns(): void
{
foreach ($this->returns as $return) {
foreach (range($return->getStartLine(), $return->getEndLine()) as $loc) {
if (isset($this->executableLines[$loc])) {
continue 2;
}
}
$line = $return->getEndLine();
if ($return->expr !== null) {
$line = $return->expr->getStartLine();
}
$this->executableLines[$line] = $line;
}
}
/**
* @return int[]
*/
@@ -118,6 +150,46 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
return [$node->dim->getStartLine()];
}
if ($node instanceof Array_) {
$startLine = $node->getStartLine();
if (isset($this->executableLines[$startLine])) {
return [];
}
if ([] === $node->items) {
return [$node->getEndLine()];
}
if ($node->items[0] instanceof ArrayItem) {
return [$node->items[0]->getStartLine()];
}
}
if ($node instanceof ClassMethod) {
if ($node->name->name !== '__construct') {
return [];
}
$existsAPromotedProperty = false;
foreach ($node->getParams() as $param) {
if (0 !== ($param->flags & Class_::VISIBILITY_MODIFIER_MASK)) {
$existsAPromotedProperty = true;
break;
}
}
if ($existsAPromotedProperty) {
// Only the line with `function` keyword should be listed here
// but `nikic/php-parser` doesn't provide a way to fetch it
return range($node->getStartLine(), $node->name->getEndLine());
}
return [];
}
if ($node instanceof MethodCall) {
return [$node->name->getStartLine()];
}
@@ -134,6 +206,28 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
return $lines;
}
if ($node instanceof Match_) {
return [$node->cond->getStartLine()];
}
if ($node instanceof MatchArm) {
return [$node->body->getStartLine()];
}
if ($node instanceof Expression && (
$node->expr instanceof Cast ||
$node->expr instanceof Match_ ||
$node->expr instanceof MethodCall
)) {
return [];
}
if ($node instanceof Return_) {
$this->returns[] = $node;
return [];
}
return [$node->getStartLine()];
}
@@ -141,12 +235,14 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
{
return $node instanceof Assign ||
$node instanceof ArrayDimFetch ||
$node instanceof Array_ ||
$node instanceof BinaryOp ||
$node instanceof Break_ ||
$node instanceof CallLike ||
$node instanceof Case_ ||
$node instanceof Cast ||
$node instanceof Catch_ ||
$node instanceof ClassMethod ||
$node instanceof Closure ||
$node instanceof Continue_ ||
$node instanceof Do_ ||
@@ -160,6 +256,8 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
$node instanceof Foreach_ ||
$node instanceof Goto_ ||
$node instanceof If_ ||
$node instanceof Match_ ||
$node instanceof MatchArm ||
$node instanceof MethodCall ||
$node instanceof NullsafePropertyFetch ||
$node instanceof PropertyFetch ||

View File

@@ -13,6 +13,7 @@ use function array_unique;
use function assert;
use function file_get_contents;
use function is_array;
use function max;
use function sprintf;
use function substr_count;
use function token_get_all;
@@ -132,7 +133,7 @@ final class ParsingFileAnalyser implements FileAnalyser
}
$source = file_get_contents($filename);
$linesOfCode = substr_count($source, "\n");
$linesOfCode = max(substr_count($source, "\n") + 1, substr_count($source, "\r") + 1);
if ($linesOfCode === 0 && !empty($source)) {
$linesOfCode = 1;

View File

@@ -22,7 +22,7 @@ final class Version
public static function id(): string
{
if (self::$version === null) {
self::$version = (new VersionId('9.2.13', dirname(__DIR__)))->getVersion();
self::$version = (new VersionId('9.2.15', dirname(__DIR__)))->getVersion();
}
return self::$version;

View File

@@ -2,7 +2,7 @@
All notable changes of the PHPUnit 8.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
## [8.5.24] - 2022-MM-DD
## [8.5.24] - 2022-03-05 - #StandWithUkraine
### Changed
@@ -207,7 +207,7 @@ All notable changes of the PHPUnit 8.5 release series are documented in this fil
* [#3967](https://github.com/sebastianbergmann/phpunit/issues/3967): Cannot double interface that extends interface that extends `\Throwable`
* [#3968](https://github.com/sebastianbergmann/phpunit/pull/3968): Test class run in a separate PHP process are passing when `exit` called inside
[8.5.24]: https://github.com/sebastianbergmann/phpunit/compare/8.5.23...8.5
[8.5.24]: https://github.com/sebastianbergmann/phpunit/compare/8.5.23...8.5.24
[8.5.23]: https://github.com/sebastianbergmann/phpunit/compare/8.5.22...8.5.23
[8.5.22]: https://github.com/sebastianbergmann/phpunit/compare/8.5.21...8.5.22
[8.5.21]: https://github.com/sebastianbergmann/phpunit/compare/8.5.20...8.5.21

View File

@@ -2,6 +2,14 @@
All notable changes of the PHPUnit 9.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
## [9.5.18] - 2022-03-08
### Fixed
* [#4877](https://github.com/sebastianbergmann/phpunit/issues/4877): No stack trace shown when an error occurs during bootstrap
## [9.5.17] - 2022-03-05 - #StandWithUkraine
## [9.5.16] - 2022-02-23
### Changed
@@ -134,6 +142,8 @@ All notable changes of the PHPUnit 9.5 release series are documented in this fil
* [#4535](https://github.com/sebastianbergmann/phpunit/issues/4535): `getMockFromWsdl()` does not handle methods that do not have parameters correctly
[9.5.18]: https://github.com/sebastianbergmann/phpunit/compare/9.5.17...9.5.18
[9.5.17]: https://github.com/sebastianbergmann/phpunit/compare/9.5.16...9.5.17
[9.5.16]: https://github.com/sebastianbergmann/phpunit/compare/dc738383c519243b0a967f63943a848d3fd861aa...9.5.16
[9.5.15]: https://github.com/sebastianbergmann/phpunit/compare/9.5.14...dc738383c519243b0a967f63943a848d3fd861aa
[9.5.14]: https://github.com/sebastianbergmann/phpunit/compare/9.5.13...9.5.14

View File

@@ -41,7 +41,7 @@ final class Version
}
if (self::$version === '') {
self::$version = (new VersionId('9.5.16', dirname(__DIR__, 2)))->getVersion();
self::$version = (new VersionId('9.5.18', dirname(__DIR__, 2)))->getVersion();
}
return self::$version;
@@ -60,6 +60,6 @@ final class Version
public static function getVersionString(): string
{
return 'PHPUnit ' . self::id() . ' by Sebastian Bergmann and contributors.';
return 'PHPUnit ' . self::id() . ' #StandWithUkraine';
}
}

View File

@@ -567,10 +567,12 @@ class Command
$this->exitWithErrorMessage(
sprintf(
'Error in bootstrap script: %s:%s%s',
'Error in bootstrap script: %s:%s%s%s%s',
get_class($t),
PHP_EOL,
$t->getMessage()
$t->getMessage(),
PHP_EOL,
$t->getTraceAsString()
)
);
}

View File

@@ -54,6 +54,7 @@ use PHPUnit\TextUI\XmlConfiguration\CodeCoverage\FilterMapper;
use PHPUnit\TextUI\XmlConfiguration\Configuration;
use PHPUnit\TextUI\XmlConfiguration\Loader;
use PHPUnit\TextUI\XmlConfiguration\PhpHandler;
use PHPUnit\Util\Color;
use PHPUnit\Util\Filesystem;
use PHPUnit\Util\Log\JUnit;
use PHPUnit\Util\Log\TeamCity;
@@ -325,9 +326,18 @@ final class TestRunner extends BaseTestRunner
$this->printer->setShowProgressAnimation(!$arguments['noInteraction']);
}
$this->printer->write(
Version::getVersionString() . "\n"
);
if ($arguments['colors'] !== DefaultResultPrinter::COLOR_NEVER) {
$this->write(
'PHPUnit ' .
Version::id() .
' ' .
Color::colorize('bg-blue', '#StandWith') .
Color::colorize('bg-yellow', 'Ukraine') .
"\n"
);
} else {
$this->write(Version::getVersionString() . "\n");
}
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
@@ -614,7 +624,7 @@ final class TestRunner extends BaseTestRunner
exit(self::SUCCESS_EXIT);
}
$this->printer->write("\n");
$this->write("\n");
if (isset($codeCoverage)) {
$result->setCodeCoverage($codeCoverage);
@@ -1239,7 +1249,7 @@ final class TestRunner extends BaseTestRunner
private function codeCoverageGenerationStart(string $format): void
{
$this->printer->write(
$this->write(
sprintf(
"\nGenerating code coverage report in %s format ... ",
$format
@@ -1251,7 +1261,7 @@ final class TestRunner extends BaseTestRunner
private function codeCoverageGenerationSucceeded(): void
{
$this->printer->write(
$this->write(
sprintf(
"done [%s]\n",
$this->timer->stop()->asString()
@@ -1261,7 +1271,7 @@ final class TestRunner extends BaseTestRunner
private function codeCoverageGenerationFailed(\Exception $e): void
{
$this->printer->write(
$this->write(
sprintf(
"failed [%s]\n%s\n",
$this->timer->stop()->asString(),