Composer data update

This commit is contained in:
Clemens Schwaighofer
2022-01-06 10:01:52 +09:00
parent 4bac10bb42
commit 5452bffdb4
57 changed files with 1409 additions and 680 deletions

View File

@@ -2,6 +2,26 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [9.2.10] - 2021-12-05
### Fixed
* [#887](https://github.com/sebastianbergmann/php-code-coverage/issues/887): Document return type of `CodeUnitFindingVisitor::enterNode()` so that Symfony's DebugClassLoader does not trigger a deprecation warning
## [9.2.9] - 2021-11-19
### Fixed
* [#882](https://github.com/sebastianbergmann/php-code-coverage/issues/882): PHPUnit 9.2.8 has wrong version number
## [9.2.8] - 2021-10-30
### Fixed
* [#866](https://github.com/sebastianbergmann/php-code-coverage/issues/866): `CodeUnitFindingVisitor` does not handle `enum` type introduced in PHP 8.1
* [#868](https://github.com/sebastianbergmann/php-code-coverage/pull/868): Uncovered files should be ignored unless requested
* [#876](https://github.com/sebastianbergmann/php-code-coverage/issues/876): PCOV driver causes 2x slowdown after upgrade to PHPUnit 9.5
## [9.2.7] - 2021-09-17
### Fixed
@@ -329,6 +349,9 @@ 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.10]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.9...9.2.10
[9.2.9]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.8...9.2.9
[9.2.8]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.7...9.2.8
[9.2.7]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.6...9.2.7
[9.2.6]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.5...9.2.6
[9.2.5]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.4...9.2.5

View File

@@ -32,7 +32,7 @@
"ext-dom": "*",
"ext-libxml": "*",
"ext-xmlwriter": "*",
"nikic/php-parser": "^4.12.0",
"nikic/php-parser": "^4.13.0",
"phpunit/php-file-iterator": "^3.0.3",
"phpunit/php-text-template": "^2.0.2",
"sebastian/code-unit-reverse-lookup": "^2.0.2",

View File

@@ -167,6 +167,8 @@ final class CodeCoverage
$this->processUncoveredFilesFromFilter();
} elseif ($this->includeUncoveredFiles) {
$this->addUncoveredFilesFromFilter();
} else {
$this->data->removeFilesWithNoCoverage();
}
}

View File

@@ -9,7 +9,14 @@
*/
namespace SebastianBergmann\CodeCoverage\Driver;
use const pcov\inclusive;
use function array_intersect;
use function extension_loaded;
use function pcov\clear;
use function pcov\collect;
use function pcov\start;
use function pcov\stop;
use function pcov\waiting;
use function phpversion;
use SebastianBergmann\CodeCoverage\Filter;
use SebastianBergmann\CodeCoverage\RawCodeCoverageData;
@@ -38,21 +45,27 @@ final class PcovDriver extends Driver
public function start(): void
{
\pcov\start();
start();
}
public function stop(): RawCodeCoverageData
{
\pcov\stop();
stop();
$collect = \pcov\collect(
\pcov\inclusive,
!$this->filter->isEmpty() ? $this->filter->files() : \pcov\waiting()
);
$filesToCollectCoverageFor = waiting();
$collected = [];
\pcov\clear();
if ($filesToCollectCoverageFor) {
if (!$this->filter->isEmpty()) {
$filesToCollectCoverageFor = array_intersect($filesToCollectCoverageFor, $this->filter->files());
}
return RawCodeCoverageData::fromXdebugWithoutPathCoverage($collect);
$collected = collect(inclusive, $filesToCollectCoverageFor);
clear();
}
return RawCodeCoverageData::fromXdebugWithoutPathCoverage($collected);
}
public function nameAndVersion(): string

View File

@@ -132,6 +132,18 @@ final class ProcessedCodeCoverageData
unset($this->lineCoverage[$oldFile], $this->functionCoverage[$oldFile]);
}
public function removeFilesWithNoCoverage(): void
{
foreach ($this->lineCoverage as $file => $lines) {
foreach ($lines as $line) {
if (is_array($line) && !empty($line)) {
continue 2;
}
}
unset($file);
}
}
public function merge(self $newData): void
{
foreach ($newData->lineCoverage as $file => $lines) {

View File

@@ -13,11 +13,14 @@ use function implode;
use function rtrim;
use function trim;
use PhpParser\Node;
use PhpParser\Node\ComplexType;
use PhpParser\Node\Identifier;
use PhpParser\Node\IntersectionType;
use PhpParser\Node\Name;
use PhpParser\Node\NullableType;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Enum_;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\Interface_;
use PhpParser\Node\Stmt\Trait_;
@@ -32,21 +35,21 @@ use SebastianBergmann\Complexity\CyclomaticComplexityCalculatingVisitor;
final class CodeUnitFindingVisitor extends NodeVisitorAbstract
{
/**
* @var array
* @psalm-var array<string,array{name: string, namespacedName: string, namespace: string, startLine: int, endLine: int, methods: array<string,array{methodName: string, signature: string, visibility: string, startLine: int, endLine: int, ccn: int}>}>
*/
private $classes = [];
/**
* @var array
* @psalm-var array<string,array{name: string, namespacedName: string, namespace: string, startLine: int, endLine: int, methods: array<string,array{methodName: string, signature: string, visibility: string, startLine: int, endLine: int, ccn: int}>}>
*/
private $traits = [];
/**
* @var array
* @psalm-var array<string,array{name: string, namespacedName: string, namespace: string, signature: string, startLine: int, endLine: int, ccn: int}>
*/
private $functions = [];
public function enterNode(Node $node)
public function enterNode(Node $node): void
{
if ($node instanceof Class_) {
if ($node->isAnonymous()) {
@@ -61,7 +64,7 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract
}
if (!$node instanceof ClassMethod && !$node instanceof Function_) {
return null;
return;
}
if ($node instanceof ClassMethod) {
@@ -79,16 +82,25 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract
$this->processFunction($node);
}
/**
* @psalm-return array<string,array{name: string, namespacedName: string, namespace: string, startLine: int, endLine: int, methods: array<string,array{methodName: string, signature: string, visibility: string, startLine: int, endLine: int, ccn: int}>}>
*/
public function classes(): array
{
return $this->classes;
}
/**
* @psalm-return array<string,array{name: string, namespacedName: string, namespace: string, startLine: int, endLine: int, methods: array<string,array{methodName: string, signature: string, visibility: string, startLine: int, endLine: int, ccn: int}>}>
*/
public function traits(): array
{
return $this->traits;
}
/**
* @psalm-return array<string,array{name: string, namespacedName: string, namespace: string, signature: string, startLine: int, endLine: int, ccn: int}>
*/
public function functions(): array
{
return $this->functions;
@@ -157,24 +169,18 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract
}
/**
* @psalm-param Identifier|Name|NullableType|UnionType $type
* @psalm-param Identifier|Name|ComplexType $type
*/
private function type(Node $type): string
{
assert($type instanceof Identifier || $type instanceof Name || $type instanceof NullableType || $type instanceof UnionType);
assert($type instanceof Identifier || $type instanceof Name || $type instanceof ComplexType);
if ($type instanceof NullableType) {
return '?' . $type->type;
}
if ($type instanceof UnionType) {
$types = [];
foreach ($type->types as $_type) {
$types[] = $_type->toString();
}
return implode('|', $types);
if ($type instanceof UnionType || $type instanceof IntersectionType) {
return $this->unionOrIntersectionAsString($type);
}
return $type->toString();
@@ -200,7 +206,7 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract
$this->classes[$namespacedName] = [
'name' => $name,
'namespacedName' => $namespacedName,
'namespacedName' => (string) $namespacedName,
'namespace' => $this->namespace($namespacedName, $name),
'startLine' => $node->getStartLine(),
'endLine' => $node->getEndLine(),
@@ -215,7 +221,7 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract
$this->traits[$namespacedName] = [
'name' => $name,
'namespacedName' => $namespacedName,
'namespacedName' => (string) $namespacedName,
'namespace' => $this->namespace($namespacedName, $name),
'startLine' => $node->getStartLine(),
'endLine' => $node->getEndLine(),
@@ -231,7 +237,7 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract
return;
}
assert($parentNode instanceof Class_ || $parentNode instanceof Trait_);
assert($parentNode instanceof Class_ || $parentNode instanceof Trait_ || $parentNode instanceof Enum_);
assert(isset($parentNode->name));
assert(isset($parentNode->namespacedName));
assert($parentNode->namespacedName instanceof Name);
@@ -290,4 +296,28 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract
{
return trim(rtrim($namespacedName, $name), '\\');
}
/**
* @psalm-param UnionType|IntersectionType $type
*/
private function unionOrIntersectionAsString(ComplexType $type): string
{
if ($type instanceof UnionType) {
$separator = '|';
} else {
$separator = '&';
}
$types = [];
foreach ($type->types as $_type) {
if ($_type instanceof Name) {
$types[] = $_type->toCodeString();
} else {
$types[] = $_type->toString();
}
}
return implode($separator, $types);
}
}

View File

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

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.x-dev@">
<file src="src/Iterator.php">
<UndefinedInterfaceMethod occurrences="1">
<code>current</code>
</UndefinedInterfaceMethod>
</file>
</files>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<psalm
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
resolveFromConfigFile="false"
totallyTyped="false"
errorBaseline=".psalm/baseline.xml"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>

View File

@@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
## [3.0.6] - 2021-12-02
### Changed
* [#73](https://github.com/sebastianbergmann/php-file-iterator/pull/73): Micro performance improvements on parsing paths
## [3.0.5] - 2020-09-28
### Changed
@@ -38,6 +44,28 @@ All notable changes to this project will be documented in this file. This projec
* This component is no longer supported on PHP 7.1 and PHP 7.2
## [2.0.5] - 2021-12-02
### Changed
* [#73](https://github.com/sebastianbergmann/php-file-iterator/pull/73): Micro performance improvements on parsing paths
### Fixed
* [#74](https://github.com/sebastianbergmann/php-file-iterator/pull/74): Document return type of `SebastianBergmann\FileIterator\Iterator::accept()` so that Symfony's `DebugClassLoader` does not trigger a deprecation warning
## [2.0.4] - 2021-07-19
### Changed
* Added `ReturnTypeWillChange` attribute to `SebastianBergmann\FileIterator\Iterator::accept()` because the return type of `\FilterIterator::accept()` will change in PHP 8.1
## [2.0.3] - 2020-11-30
### Changed
* Changed PHP version constraint in `composer.json` from `^7.1` to `>=7.1`
## [2.0.2] - 2018-09-13
### Fixed
@@ -96,15 +124,19 @@ No changes
* [#23](https://github.com/sebastianbergmann/php-file-iterator/pull/23): Added support for wildcards (glob) in exclude
[3.0.6]: https://github.com/sebastianbergmann/php-file-iterator/compare/3.0.5...3.0.6
[3.0.5]: https://github.com/sebastianbergmann/php-file-iterator/compare/3.0.4...3.0.5
[3.0.4]: https://github.com/sebastianbergmann/php-file-iterator/compare/3.0.3...3.0.4
[3.0.3]: https://github.com/sebastianbergmann/php-file-iterator/compare/3.0.2...3.0.3
[3.0.2]: https://github.com/sebastianbergmann/php-file-iterator/compare/3.0.1...3.0.2
[3.0.1]: https://github.com/sebastianbergmann/php-file-iterator/compare/3.0.0...3.0.1
[3.0.0]: https://github.com/sebastianbergmann/php-file-iterator/compare/2.0.2...3.0.0
[3.0.0]: https://github.com/sebastianbergmann/php-file-iterator/compare/2.0.5...3.0.0
[2.0.5]: https://github.com/sebastianbergmann/php-file-iterator/compare/2.0.4...2.0.5
[2.0.4]: https://github.com/sebastianbergmann/php-file-iterator/compare/2.0.3...2.0.4
[2.0.3]: https://github.com/sebastianbergmann/php-file-iterator/compare/2.0.2...2.0.3
[2.0.2]: https://github.com/sebastianbergmann/php-file-iterator/compare/2.0.1...2.0.2
[2.0.1]: https://github.com/sebastianbergmann/php-file-iterator/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/sebastianbergmann/php-file-iterator/compare/1.4...2.0.0
[2.0.0]: https://github.com/sebastianbergmann/php-file-iterator/compare/1.4.5...2.0.0
[1.4.5]: https://github.com/sebastianbergmann/php-file-iterator/compare/1.4.4...1.4.5
[1.4.4]: https://github.com/sebastianbergmann/php-file-iterator/compare/1.4.3...1.4.4
[1.4.3]: https://github.com/sebastianbergmann/php-file-iterator/compare/1.4.2...1.4.3

View File

@@ -1,6 +1,6 @@
php-file-iterator
Copyright (c) 2009-2020, Sebastian Bergmann <sebastian@phpunit.de>.
Copyright (c) 2009-2021, Sebastian Bergmann <sebastian@phpunit.de>.
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -76,16 +76,16 @@ class Factory
protected function getPathsAfterResolvingWildcards(array $paths): array
{
$_paths = [];
$_paths = [[]];
foreach ($paths as $path) {
if ($locals = glob($path, GLOB_ONLYDIR)) {
$_paths = array_merge($_paths, array_map('\realpath', $locals));
$_paths[] = array_map('\realpath', $locals);
} else {
$_paths[] = realpath($path);
$_paths[] = [realpath($path)];
}
}
return array_filter($_paths);
return array_filter(array_merge(...$_paths));
}
}

View File

@@ -2,6 +2,18 @@
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.22] - 2021-12-25
### Changed
* [#4812](https://github.com/sebastianbergmann/phpunit/issues/4812): Do not enforce time limits when a debugging session through DBGp is active
* [#4835](https://github.com/sebastianbergmann/phpunit/issues/4835): Support for `$GLOBALS['_composer_autoload_path']` introduced in Composer 2.2
### Fixed
* [#4840](https://github.com/sebastianbergmann/phpunit/pull/4840): TestDox prettifying for class names does not correctly handle diacritics
* [#4846](https://github.com/sebastianbergmann/phpunit/pull/4846): Composer proxy script is not ignored
## [8.5.21] - 2021-09-25
### Changed
@@ -178,6 +190,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.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
[8.5.20]: https://github.com/sebastianbergmann/phpunit/compare/8.5.19...8.5.20
[8.5.19]: https://github.com/sebastianbergmann/phpunit/compare/8.5.18...8.5.19

View File

@@ -2,6 +2,18 @@
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.11] - 2021-12-25
### Changed
* [#4812](https://github.com/sebastianbergmann/phpunit/issues/4812): Do not enforce time limits when a debugging session through DBGp is active
* [#4835](https://github.com/sebastianbergmann/phpunit/issues/4835): Support for `$GLOBALS['_composer_autoload_path']` introduced in Composer 2.2
### Fixed
* [#4840](https://github.com/sebastianbergmann/phpunit/pull/4840): TestDox prettifying for class names does not correctly handle diacritics
* [#4846](https://github.com/sebastianbergmann/phpunit/pull/4846): Composer proxy script is not ignored
## [9.5.10] - 2021-09-25
### Changed
@@ -91,6 +103,7 @@ 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.11]: https://github.com/sebastianbergmann/phpunit/compare/9.5.10...9.5.11
[9.5.10]: https://github.com/sebastianbergmann/phpunit/compare/9.5.9...9.5.10
[9.5.9]: https://github.com/sebastianbergmann/phpunit/compare/9.5.8...9.5.9
[9.5.8]: https://github.com/sebastianbergmann/phpunit/compare/9.5.7...9.5.8

View File

@@ -58,15 +58,21 @@ if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}
foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
if (file_exists($file)) {
define('PHPUNIT_COMPOSER_INSTALL', $file);
if (isset($GLOBALS['_composer_autoload_path'])) {
define('PHPUNIT_COMPOSER_INSTALL', $GLOBALS['_composer_autoload_path']);
break;
unset($GLOBALS['_composer_autoload_path']);
} else {
foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
if (file_exists($file)) {
define('PHPUNIT_COMPOSER_INSTALL', $file);
break;
}
}
}
unset($file);
unset($file);
}
if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
fwrite(

View File

@@ -514,6 +514,24 @@ abstract class TestCase extends Assert implements Reorderable, SelfDescribing, T
{
}
/**
* Performs assertions shared by all tests of a test case.
*
* This method is called between setUp() and test.
*/
protected function assertPreConditions(): void
{
}
/**
* Performs assertions shared by all tests of a test case.
*
* This method is called between test and tearDown().
*/
protected function assertPostConditions(): void
{
}
/**
* This method is called after each test.
*/
@@ -1955,24 +1973,6 @@ abstract class TestCase extends Assert implements Reorderable, SelfDescribing, T
return new TestResult;
}
/**
* Performs assertions shared by all tests of a test case.
*
* This method is called between setUp() and test.
*/
protected function assertPreConditions(): void
{
}
/**
* Performs assertions shared by all tests of a test case.
*
* This method is called between test and tearDown().
*/
protected function assertPostConditions(): void
{
}
/**
* This method is called when a test method did not execute successfully.
*

View File

@@ -14,6 +14,10 @@ use function count;
use function function_exists;
use function get_class;
use function sprintf;
use function xdebug_get_monitored_functions;
use function xdebug_is_debugger_active;
use function xdebug_start_function_monitor;
use function xdebug_stop_function_monitor;
use AssertionError;
use Countable;
use Error;
@@ -452,7 +456,7 @@ final class TestResult implements Countable
$this->passed[$key] = [
'result' => $test->getResult(),
'size' => \PHPUnit\Util\Test::getSize(
'size' => TestUtil::getSize(
$class,
$test->getName(false)
),
@@ -636,12 +640,15 @@ final class TestResult implements Countable
{
Assert::resetCount();
$size = TestUtil::UNKNOWN;
if ($test instanceof TestCase) {
$test->setRegisterMockObjectsFromTestArgumentsRecursively(
$this->registerMockObjectsFromTestArgumentsRecursively
);
$isAnyCoverageRequired = TestUtil::requiresCodeCoverageDataCollection($test);
$size = $test->getSize();
}
$error = false;
@@ -676,7 +683,7 @@ final class TestResult implements Countable
$monitorFunctions = $this->beStrictAboutResourceUsageDuringSmallTests &&
!$test instanceof ErrorTestCase &&
!$test instanceof WarningTestCase &&
$test->getSize() === \PHPUnit\Util\Test::SMALL &&
$size === TestUtil::SMALL &&
function_exists('xdebug_start_function_monitor');
if ($monitorFunctions) {
@@ -692,29 +699,26 @@ final class TestResult implements Countable
if (!$test instanceof ErrorTestCase &&
!$test instanceof WarningTestCase &&
$this->enforceTimeLimit &&
($this->defaultTimeLimit || $test->getSize() != \PHPUnit\Util\Test::UNKNOWN) &&
$this->shouldTimeLimitBeEnforced($size) &&
$invoker->canInvokeWithTimeout()) {
switch ($test->getSize()) {
case \PHPUnit\Util\Test::SMALL:
switch ($size) {
case TestUtil::SMALL:
$_timeout = $this->timeoutForSmallTests;
break;
case \PHPUnit\Util\Test::MEDIUM:
case TestUtil::MEDIUM:
$_timeout = $this->timeoutForMediumTests;
break;
case \PHPUnit\Util\Test::LARGE:
case TestUtil::LARGE:
$_timeout = $this->timeoutForLargeTests;
break;
case \PHPUnit\Util\Test::UNKNOWN:
default:
$_timeout = $this->defaultTimeLimit;
break;
}
$invoker->invoke([$test, 'runBare'], [], $_timeout);
@@ -829,12 +833,12 @@ final class TestResult implements Countable
if ($append && $test instanceof TestCase) {
try {
$linesToBeCovered = \PHPUnit\Util\Test::getLinesToBeCovered(
$linesToBeCovered = TestUtil::getLinesToBeCovered(
get_class($test),
$test->getName(false)
);
$linesToBeUsed = \PHPUnit\Util\Test::getLinesToBeUsed(
$linesToBeUsed = TestUtil::getLinesToBeUsed(
get_class($test),
$test->getName(false)
);
@@ -1286,4 +1290,29 @@ final class TestResult implements Countable
{
$this->warnings[] = new TestFailure($test, $t);
}
private function shouldTimeLimitBeEnforced(int $size): bool
{
if (!$this->enforceTimeLimit) {
return false;
}
if (!(($this->defaultTimeLimit || $size !== TestUtil::UNKNOWN))) {
return false;
}
if (!extension_loaded('pcntl')) {
return false;
}
if (!class_exists(Invoker::class)) {
return false;
}
if (extension_loaded('xdebug') && xdebug_is_debugger_active()) {
return false;
}
return true;
}
}

View File

@@ -41,7 +41,7 @@ final class Version
}
if (self::$version === '') {
self::$version = (new VersionId('9.5.10', dirname(__DIR__, 2)))->getVersion();
self::$version = (new VersionId('9.5.11', dirname(__DIR__, 2)))->getVersion();
}
return self::$version;

View File

@@ -11,6 +11,7 @@ namespace PHPUnit\Util;
use function array_keys;
use function array_reverse;
use function array_shift;
use function defined;
use function get_defined_constants;
use function get_included_files;
@@ -23,6 +24,8 @@ use function preg_match;
use function serialize;
use function sprintf;
use function strpos;
use function strtr;
use function substr;
use function var_export;
use Closure;
@@ -68,7 +71,12 @@ final class GlobalState
}
// Do not process bootstrap script
unset($files[0]);
array_shift($files);
// If bootstrap script was a Composer bin proxy, skip the second entry as well
if (substr(strtr($files[0], '\\', '/'), -24) === '/phpunit/phpunit/phpunit') {
array_shift($files);
}
foreach (array_reverse($files) as $file) {
if (!empty($GLOBALS['__PHPUNIT_ISOLATION_EXCLUDE_LIST']) &&

View File

@@ -26,7 +26,6 @@ use function is_numeric;
use function is_object;
use function is_scalar;
use function is_string;
use function mb_strtolower;
use function ord;
use function preg_quote;
use function preg_replace;
@@ -109,24 +108,7 @@ final class NamePrettifier
$fullyQualifiedName = $className;
}
$result = '';
$wasLowerCase = false;
foreach (range(0, strlen($className) - 1) as $i) {
$isLowerCase = mb_strtolower($className[$i], 'UTF-8') === $className[$i];
if ($wasLowerCase && !$isLowerCase) {
$result .= ' ';
}
$result .= $className[$i];
if ($isLowerCase) {
$wasLowerCase = true;
} else {
$wasLowerCase = false;
}
}
$result = preg_replace('/(?<=[[:lower:]])(?=[[:upper:]])/u', ' ', $className);
if ($fullyQualifiedName !== $className) {
return $result . ' (' . $fullyQualifiedName . ')';