Composer update

This commit is contained in:
Clemens Schwaighofer
2023-01-05 10:55:01 +09:00
parent 90e418ba24
commit 3d23e5b066
88 changed files with 892 additions and 478 deletions

52
www/composer.lock generated
View File

@@ -9,30 +9,30 @@
"packages-dev": [
{
"name": "doctrine/instantiator",
"version": "1.4.1",
"version": "1.5.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc"
"reference": "0a0fa9780f5d4e507415a065172d26a98d02047b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc",
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b",
"reference": "0a0fa9780f5d4e507415a065172d26a98d02047b",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^9",
"doctrine/coding-standard": "^9 || ^11",
"ext-pdo": "*",
"ext-phar": "*",
"phpbench/phpbench": "^0.16 || ^1",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-phpunit": "^1",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"vimeo/psalm": "^4.22"
"vimeo/psalm": "^4.30 || ^5.4"
},
"type": "library",
"autoload": {
@@ -59,7 +59,7 @@
],
"support": {
"issues": "https://github.com/doctrine/instantiator/issues",
"source": "https://github.com/doctrine/instantiator/tree/1.4.1"
"source": "https://github.com/doctrine/instantiator/tree/1.5.0"
},
"funding": [
{
@@ -75,7 +75,7 @@
"type": "tidelift"
}
],
"time": "2022-03-03T08:28:38+00:00"
"time": "2022-12-30T00:15:36+00:00"
},
{
"name": "myclabs/deep-copy",
@@ -138,16 +138,16 @@
},
{
"name": "nikic/php-parser",
"version": "v4.15.1",
"version": "v4.15.2",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900"
"reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900",
"reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc",
"reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc",
"shasum": ""
},
"require": {
@@ -188,9 +188,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1"
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2"
},
"time": "2022-09-04T07:30:47+00:00"
"time": "2022-11-12T15:38:23+00:00"
},
{
"name": "phar-io/manifest",
@@ -305,16 +305,16 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.17",
"version": "9.2.23",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "aa94dc41e8661fe90c7316849907cba3007b10d8"
"reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8",
"reference": "aa94dc41e8661fe90c7316849907cba3007b10d8",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c",
"reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c",
"shasum": ""
},
"require": {
@@ -370,7 +370,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.23"
},
"funding": [
{
@@ -378,7 +378,7 @@
"type": "github"
}
],
"time": "2022-08-30T12:24:04+00:00"
"time": "2022-12-28T12:41:10+00:00"
},
{
"name": "phpunit/php-file-iterator",
@@ -623,16 +623,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.25",
"version": "9.5.27",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d"
"reference": "a2bc7ffdca99f92d959b3f2270529334030bba38"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d",
"reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38",
"reference": "a2bc7ffdca99f92d959b3f2270529334030bba38",
"shasum": ""
},
"require": {
@@ -705,7 +705,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.25"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27"
},
"funding": [
{
@@ -721,7 +721,7 @@
"type": "tidelift"
}
],
"time": "2022-09-25T03:44:45+00:00"
"time": "2022-12-09T07:31:23+00:00"
},
{
"name": "sebastian/cli-parser",

View File

@@ -158,6 +158,7 @@ return array(
'PHPUnit\\Framework\\MockObject\\CannotUseOnlyMethodsException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/CannotUseOnlyMethodsException.php',
'PHPUnit\\Framework\\MockObject\\ClassAlreadyExistsException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/ClassAlreadyExistsException.php',
'PHPUnit\\Framework\\MockObject\\ClassIsFinalException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/ClassIsFinalException.php',
'PHPUnit\\Framework\\MockObject\\ClassIsReadonlyException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/ClassIsReadonlyException.php',
'PHPUnit\\Framework\\MockObject\\ConfigurableMethod' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/ConfigurableMethod.php',
'PHPUnit\\Framework\\MockObject\\ConfigurableMethodsAlreadyInitializedException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/ConfigurableMethodsAlreadyInitializedException.php',
'PHPUnit\\Framework\\MockObject\\DuplicateMethodException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/DuplicateMethodException.php',
@@ -686,13 +687,8 @@ return array(
'SmartyException' => $baseDir . '/lib/Smarty/sysplugins/smartyexception.php',
'Smarty_Autoloader' => $baseDir . '/lib/Smarty/Autoloader.php',
'Smarty_CacheResource' => $baseDir . '/lib/Smarty/sysplugins/smarty_cacheresource.php',
'Smarty_CacheResource_Apc' => $baseDir . '/lib/smarty-4.1.0/demo/plugins/cacheresource.apc.php',
'Smarty_CacheResource_Custom' => $baseDir . '/lib/Smarty/sysplugins/smarty_cacheresource_custom.php',
'Smarty_CacheResource_KeyValueStore' => $baseDir . '/lib/Smarty/sysplugins/smarty_cacheresource_keyvaluestore.php',
'Smarty_CacheResource_Memcache' => $baseDir . '/lib/smarty-4.1.0/demo/plugins/cacheresource.memcache.php',
'Smarty_CacheResource_Mysql' => $baseDir . '/lib/smarty-4.1.0/demo/plugins/cacheresource.mysql.php',
'Smarty_CacheResource_Pdo' => $baseDir . '/lib/smarty-4.1.0/demo/plugins/cacheresource.pdo.php',
'Smarty_CacheResource_Pdo_Gzip' => $baseDir . '/lib/smarty-4.1.0/demo/plugins/cacheresource.pdo_gzip.php',
'Smarty_Data' => $baseDir . '/lib/Smarty/sysplugins/smarty_data.php',
'Smarty_Internal_Block' => $baseDir . '/lib/Smarty/sysplugins/smarty_internal_block.php',
'Smarty_Internal_CacheResource_File' => $baseDir . '/lib/Smarty/sysplugins/smarty_internal_cacheresource_file.php',
@@ -843,9 +839,6 @@ return array(
'Smarty_Internal_Undefined' => $baseDir . '/lib/Smarty/sysplugins/smarty_internal_undefined.php',
'Smarty_Resource' => $baseDir . '/lib/Smarty/sysplugins/smarty_resource.php',
'Smarty_Resource_Custom' => $baseDir . '/lib/Smarty/sysplugins/smarty_resource_custom.php',
'Smarty_Resource_Extendsall' => $baseDir . '/lib/smarty-4.1.0/demo/plugins/resource.extendsall.php',
'Smarty_Resource_Mysql' => $baseDir . '/lib/smarty-4.1.0/demo/plugins/resource.mysql.php',
'Smarty_Resource_Mysqls' => $baseDir . '/lib/smarty-4.1.0/demo/plugins/resource.mysqls.php',
'Smarty_Resource_Recompiled' => $baseDir . '/lib/Smarty/sysplugins/smarty_resource_recompiled.php',
'Smarty_Resource_Uncompiled' => $baseDir . '/lib/Smarty/sysplugins/smarty_resource_uncompiled.php',
'Smarty_Security' => $baseDir . '/lib/Smarty/sysplugins/smarty_security.php',

View File

@@ -6,6 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'ec07570ca5a812141189b1fa81503674' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
'6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'ec07570ca5a812141189b1fa81503674' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
);

View File

@@ -7,8 +7,8 @@ namespace Composer\Autoload;
class ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9
{
public static $files = array (
'ec07570ca5a812141189b1fa81503674' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
'6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'ec07570ca5a812141189b1fa81503674' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
);
public static $prefixLengthsPsr4 = array (
@@ -191,6 +191,7 @@ class ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9
'PHPUnit\\Framework\\MockObject\\CannotUseOnlyMethodsException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/CannotUseOnlyMethodsException.php',
'PHPUnit\\Framework\\MockObject\\ClassAlreadyExistsException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/ClassAlreadyExistsException.php',
'PHPUnit\\Framework\\MockObject\\ClassIsFinalException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/ClassIsFinalException.php',
'PHPUnit\\Framework\\MockObject\\ClassIsReadonlyException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/ClassIsReadonlyException.php',
'PHPUnit\\Framework\\MockObject\\ConfigurableMethod' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/ConfigurableMethod.php',
'PHPUnit\\Framework\\MockObject\\ConfigurableMethodsAlreadyInitializedException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/ConfigurableMethodsAlreadyInitializedException.php',
'PHPUnit\\Framework\\MockObject\\DuplicateMethodException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/DuplicateMethodException.php',
@@ -719,13 +720,8 @@ class ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9
'SmartyException' => __DIR__ . '/../..' . '/lib/Smarty/sysplugins/smartyexception.php',
'Smarty_Autoloader' => __DIR__ . '/../..' . '/lib/Smarty/Autoloader.php',
'Smarty_CacheResource' => __DIR__ . '/../..' . '/lib/Smarty/sysplugins/smarty_cacheresource.php',
'Smarty_CacheResource_Apc' => __DIR__ . '/../..' . '/lib/smarty-4.1.0/demo/plugins/cacheresource.apc.php',
'Smarty_CacheResource_Custom' => __DIR__ . '/../..' . '/lib/Smarty/sysplugins/smarty_cacheresource_custom.php',
'Smarty_CacheResource_KeyValueStore' => __DIR__ . '/../..' . '/lib/Smarty/sysplugins/smarty_cacheresource_keyvaluestore.php',
'Smarty_CacheResource_Memcache' => __DIR__ . '/../..' . '/lib/smarty-4.1.0/demo/plugins/cacheresource.memcache.php',
'Smarty_CacheResource_Mysql' => __DIR__ . '/../..' . '/lib/smarty-4.1.0/demo/plugins/cacheresource.mysql.php',
'Smarty_CacheResource_Pdo' => __DIR__ . '/../..' . '/lib/smarty-4.1.0/demo/plugins/cacheresource.pdo.php',
'Smarty_CacheResource_Pdo_Gzip' => __DIR__ . '/../..' . '/lib/smarty-4.1.0/demo/plugins/cacheresource.pdo_gzip.php',
'Smarty_Data' => __DIR__ . '/../..' . '/lib/Smarty/sysplugins/smarty_data.php',
'Smarty_Internal_Block' => __DIR__ . '/../..' . '/lib/Smarty/sysplugins/smarty_internal_block.php',
'Smarty_Internal_CacheResource_File' => __DIR__ . '/../..' . '/lib/Smarty/sysplugins/smarty_internal_cacheresource_file.php',
@@ -876,9 +872,6 @@ class ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9
'Smarty_Internal_Undefined' => __DIR__ . '/../..' . '/lib/Smarty/sysplugins/smarty_internal_undefined.php',
'Smarty_Resource' => __DIR__ . '/../..' . '/lib/Smarty/sysplugins/smarty_resource.php',
'Smarty_Resource_Custom' => __DIR__ . '/../..' . '/lib/Smarty/sysplugins/smarty_resource_custom.php',
'Smarty_Resource_Extendsall' => __DIR__ . '/../..' . '/lib/smarty-4.1.0/demo/plugins/resource.extendsall.php',
'Smarty_Resource_Mysql' => __DIR__ . '/../..' . '/lib/smarty-4.1.0/demo/plugins/resource.mysql.php',
'Smarty_Resource_Mysqls' => __DIR__ . '/../..' . '/lib/smarty-4.1.0/demo/plugins/resource.mysqls.php',
'Smarty_Resource_Recompiled' => __DIR__ . '/../..' . '/lib/Smarty/sysplugins/smarty_resource_recompiled.php',
'Smarty_Resource_Uncompiled' => __DIR__ . '/../..' . '/lib/Smarty/sysplugins/smarty_resource_uncompiled.php',
'Smarty_Security' => __DIR__ . '/../..' . '/lib/Smarty/sysplugins/smarty_security.php',

View File

@@ -2,33 +2,33 @@
"packages": [
{
"name": "doctrine/instantiator",
"version": "1.4.1",
"version_normalized": "1.4.1.0",
"version": "1.5.0",
"version_normalized": "1.5.0.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc"
"reference": "0a0fa9780f5d4e507415a065172d26a98d02047b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc",
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b",
"reference": "0a0fa9780f5d4e507415a065172d26a98d02047b",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^9",
"doctrine/coding-standard": "^9 || ^11",
"ext-pdo": "*",
"ext-phar": "*",
"phpbench/phpbench": "^0.16 || ^1",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-phpunit": "^1",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"vimeo/psalm": "^4.22"
"vimeo/psalm": "^4.30 || ^5.4"
},
"time": "2022-03-03T08:28:38+00:00",
"time": "2022-12-30T00:15:36+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -55,7 +55,7 @@
],
"support": {
"issues": "https://github.com/doctrine/instantiator/issues",
"source": "https://github.com/doctrine/instantiator/tree/1.4.1"
"source": "https://github.com/doctrine/instantiator/tree/1.5.0"
},
"funding": [
{
@@ -137,17 +137,17 @@
},
{
"name": "nikic/php-parser",
"version": "v4.15.1",
"version_normalized": "4.15.1.0",
"version": "v4.15.2",
"version_normalized": "4.15.2.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900"
"reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900",
"reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc",
"reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc",
"shasum": ""
},
"require": {
@@ -158,7 +158,7 @@
"ircmaxell/php-yacc": "^0.0.7",
"phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0"
},
"time": "2022-09-04T07:30:47+00:00",
"time": "2022-11-12T15:38:23+00:00",
"bin": [
"bin/php-parse"
],
@@ -190,7 +190,7 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1"
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2"
},
"install-path": "../nikic/php-parser"
},
@@ -313,17 +313,17 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.17",
"version_normalized": "9.2.17.0",
"version": "9.2.23",
"version_normalized": "9.2.23.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "aa94dc41e8661fe90c7316849907cba3007b10d8"
"reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8",
"reference": "aa94dc41e8661fe90c7316849907cba3007b10d8",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c",
"reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c",
"shasum": ""
},
"require": {
@@ -348,7 +348,7 @@
"ext-pcov": "*",
"ext-xdebug": "*"
},
"time": "2022-08-30T12:24:04+00:00",
"time": "2022-12-28T12:41:10+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -381,7 +381,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.23"
},
"funding": [
{
@@ -646,17 +646,17 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.25",
"version_normalized": "9.5.25.0",
"version": "9.5.27",
"version_normalized": "9.5.27.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d"
"reference": "a2bc7ffdca99f92d959b3f2270529334030bba38"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d",
"reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38",
"reference": "a2bc7ffdca99f92d959b3f2270529334030bba38",
"shasum": ""
},
"require": {
@@ -692,7 +692,7 @@
"ext-soap": "*",
"ext-xdebug": "*"
},
"time": "2022-09-25T03:44:45+00:00",
"time": "2022-12-09T07:31:23+00:00",
"bin": [
"phpunit"
],
@@ -731,7 +731,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.25"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27"
},
"funding": [
{

View File

@@ -11,12 +11,12 @@
),
'versions' => array(
'doctrine/instantiator' => array(
'pretty_version' => '1.4.1',
'version' => '1.4.1.0',
'pretty_version' => '1.5.0',
'version' => '1.5.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/instantiator',
'aliases' => array(),
'reference' => '10dcfce151b967d20fde1b34ae6640712c3891bc',
'reference' => '0a0fa9780f5d4e507415a065172d26a98d02047b',
'dev_requirement' => true,
),
'gullevek/corelibs-dev' => array(
@@ -38,12 +38,12 @@
'dev_requirement' => true,
),
'nikic/php-parser' => array(
'pretty_version' => 'v4.15.1',
'version' => '4.15.1.0',
'pretty_version' => 'v4.15.2',
'version' => '4.15.2.0',
'type' => 'library',
'install_path' => __DIR__ . '/../nikic/php-parser',
'aliases' => array(),
'reference' => '0ef6c55a3f47f89d7a374e6f835197a0b5fcf900',
'reference' => 'f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc',
'dev_requirement' => true,
),
'phar-io/manifest' => array(
@@ -65,12 +65,12 @@
'dev_requirement' => true,
),
'phpunit/php-code-coverage' => array(
'pretty_version' => '9.2.17',
'version' => '9.2.17.0',
'pretty_version' => '9.2.23',
'version' => '9.2.23.0',
'type' => 'library',
'install_path' => __DIR__ . '/../phpunit/php-code-coverage',
'aliases' => array(),
'reference' => 'aa94dc41e8661fe90c7316849907cba3007b10d8',
'reference' => '9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c',
'dev_requirement' => true,
),
'phpunit/php-file-iterator' => array(
@@ -110,12 +110,12 @@
'dev_requirement' => true,
),
'phpunit/phpunit' => array(
'pretty_version' => '9.5.25',
'version' => '9.5.25.0',
'pretty_version' => '9.5.27',
'version' => '9.5.27.0',
'type' => 'library',
'install_path' => __DIR__ . '/../phpunit/phpunit',
'aliases' => array(),
'reference' => '3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d',
'reference' => 'a2bc7ffdca99f92d959b3f2270529334030bba38',
'dev_requirement' => true,
),
'sebastian/cli-parser' => array(

View File

@@ -14,7 +14,7 @@ This library provides a way of avoiding usage of constructors when instantiating
The suggested installation method is via [composer](https://getcomposer.org/):
```sh
php composer.phar require "doctrine/instantiator:~1.0.3"
composer require doctrine/instantiator
```
## Usage

View File

@@ -21,12 +21,12 @@
"require-dev": {
"ext-phar": "*",
"ext-pdo": "*",
"doctrine/coding-standard": "^9",
"doctrine/coding-standard": "^9 || ^11",
"phpbench/phpbench": "^0.16 || ^1",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-phpunit": "^1",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"vimeo/psalm": "^4.22"
"vimeo/psalm": "^4.30 || ^5.4"
},
"autoload": {
"psr-4": {

View File

@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<psalm
errorLevel="7"
phpVersion="8.1"
phpVersion="8.2"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"

View File

@@ -28,8 +28,12 @@ final class Instantiator implements InstantiatorInterface
* Markers used internally by PHP to define whether {@see \unserialize} should invoke
* the method {@see \Serializable::unserialize()} when dealing with classes implementing
* the {@see \Serializable} interface.
*
* @deprecated This constant will be private in 2.0
*/
public const SERIALIZATION_FORMAT_USE_UNSERIALIZER = 'C';
public const SERIALIZATION_FORMAT_USE_UNSERIALIZER = 'C';
/** @deprecated This constant will be private in 2.0 */
public const SERIALIZATION_FORMAT_AVOID_UNSERIALIZER = 'O';
/**
@@ -60,9 +64,7 @@ final class Instantiator implements InstantiatorInterface
public function instantiate($className)
{
if (isset(self::$cachedCloneables[$className])) {
/**
* @phpstan-var T
*/
/** @phpstan-var T */
$cachedCloneable = self::$cachedCloneables[$className];
return clone $cachedCloneable;

View File

@@ -206,6 +206,11 @@ class TokenStream
|| $this->haveTokenInRange($startPos, $endPos, '}');
}
public function haveTagInRange(int $startPos, int $endPos): bool {
return $this->haveTokenInRange($startPos, $endPos, \T_OPEN_TAG)
|| $this->haveTokenInRange($startPos, $endPos, \T_CLOSE_TAG);
}
/**
* Get indentation before token position.
*

View File

@@ -47,13 +47,7 @@ class DNumber extends Scalar
public static function parse(string $str) : float {
$str = str_replace('_', '', $str);
// if string contains any of .eE just cast it to float
if (false !== strpbrk($str, '.eE')) {
return (float) $str;
}
// otherwise it's an integer notation that overflowed into a float
// if it starts with 0 it's one of the special integer notations
// Check whether this is one of the special integer notations.
if ('0' === $str[0]) {
// hex
if ('x' === $str[1] || 'X' === $str[1]) {
@@ -65,10 +59,12 @@ class DNumber extends Scalar
return bindec($str);
}
// oct
// substr($str, 0, strcspn($str, '89')) cuts the string at the first invalid digit (8 or 9)
// so that only the digits before that are used
return octdec(substr($str, 0, strcspn($str, '89')));
// oct, but only if the string does not contain any of '.eE'.
if (false === strpbrk($str, '.eE')) {
// substr($str, 0, strcspn($str, '89')) cuts the string at the first invalid digit
// (8 or 9) so that only the digits before that are used.
return octdec(substr($str, 0, strcspn($str, '89')));
}
}
// dec

View File

@@ -4,7 +4,7 @@ namespace PhpParser\Node;
class UnionType extends ComplexType
{
/** @var (Identifier|Name)[] Types */
/** @var (Identifier|Name|IntersectionType)[] Types */
public $types;
/**

View File

@@ -774,7 +774,8 @@ abstract class PrettyPrinterAbstract
}
if ($skipRemovedNode) {
if ($isStmtList && $this->origTokens->haveBracesInRange($pos, $itemStartPos)) {
if ($isStmtList && ($this->origTokens->haveBracesInRange($pos, $itemStartPos) ||
$this->origTokens->haveTagInRange($pos, $itemStartPos))) {
// We'd remove the brace of a code block.
// TODO: Preserve formatting.
$this->setIndentLevel($origIndentLevel);
@@ -877,7 +878,8 @@ abstract class PrettyPrinterAbstract
$pos, $itemStartPos, $indentAdjustment);
$skipRemovedNode = true;
} else {
if ($isStmtList && $this->origTokens->haveBracesInRange($pos, $itemStartPos)) {
if ($isStmtList && ($this->origTokens->haveBracesInRange($pos, $itemStartPos) ||
$this->origTokens->haveTagInRange($pos, $itemStartPos))) {
// We'd remove the brace of a code block.
// TODO: Preserve formatting.
return null;

View File

@@ -2,6 +2,49 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [9.2.23] - 2022-12-28
### Fixed
* [#971](https://github.com/sebastianbergmann/php-code-coverage/issues/971): PHP report does not handle serialized code coverage data larger than 2 GB
* [#974](https://github.com/sebastianbergmann/php-code-coverage/issues/974): Executable line analysis fails for declarations with enumerations and unions
## [9.2.22] - 2022-12-18
### Fixed
* [#969](https://github.com/sebastianbergmann/php-code-coverage/pull/969): Fixed identifying line with `throw` as executable
## [9.2.21] - 2022-12-14
### Changed
* [#964](https://github.com/sebastianbergmann/php-code-coverage/pull/964): Changed how executable lines are identified
## [9.2.20] - 2022-12-13
### Fixed
* [#960](https://github.com/sebastianbergmann/php-code-coverage/issues/960): New body font-size is way too big
## [9.2.19] - 2022-11-18
### Fixed
* [#949](https://github.com/sebastianbergmann/php-code-coverage/pull/949): Various issues related to identifying executable lines
### Changed
* Tweaked CSS for HTML report
* Updated bundled CSS/JavaScript components used for HTML report: Bootstrap 4.6.2 and jQuery 3.6.1
## [9.2.18] - 2022-10-27
### Fixed
* [#935](https://github.com/sebastianbergmann/php-code-coverage/pull/935): Cobertura package name attribute is always empty
* [#946](https://github.com/sebastianbergmann/php-code-coverage/issues/946): `return` with multiline constant expression must only contain the last line
## [9.2.17] - 2022-08-30
### Changed
@@ -415,6 +458,12 @@ 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.23]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.22...9.2.23
[9.2.22]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.21...9.2.22
[9.2.21]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.20...9.2.21
[9.2.20]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.19...9.2.20
[9.2.19]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.18...9.2.19
[9.2.18]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.17...9.2.18
[9.2.17]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.16...9.2.17
[9.2.16]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.15...9.2.16
[9.2.15]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.14...9.2.15

View File

@@ -20,7 +20,6 @@ use function count;
use function explode;
use function get_class;
use function is_array;
use function is_file;
use function sort;
use PHPUnit\Framework\TestCase;
use PHPUnit\Runner\PhptTestCase;
@@ -486,9 +485,16 @@ final class CodeCoverage
continue;
}
$linesToBranchMap = $this->analyser()->executableLinesIn($filename);
$data->keepLineCoverageDataOnlyForLines(
$filename,
$this->analyser()->executableLinesIn($filename)
array_keys($linesToBranchMap)
);
$data->markExecutableLineByBranch(
$filename,
$linesToBranchMap
);
}
}
@@ -518,7 +524,7 @@ final class CodeCoverage
);
foreach ($uncoveredFiles as $uncoveredFile) {
if (is_file($uncoveredFile)) {
if ($this->filter->isFile($uncoveredFile)) {
$this->append(
RawCodeCoverageData::fromUncoveredFile(
$uncoveredFile,
@@ -543,7 +549,7 @@ final class CodeCoverage
$this->driver->start();
foreach ($uncoveredFiles as $uncoveredFile) {
if (is_file($uncoveredFile)) {
if ($this->filter->isFile($uncoveredFile)) {
include_once $uncoveredFile;
}
}
@@ -644,7 +650,7 @@ final class CodeCoverage
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -74,8 +74,6 @@ final class Iterator implements RecursiveIterator
/**
* Returns the sub iterator for the current element.
*
* @return Iterator
*/
public function getChildren(): self
{

View File

@@ -15,8 +15,12 @@ use function array_flip;
use function array_intersect;
use function array_intersect_key;
use function count;
use function explode;
use function file_get_contents;
use function in_array;
use function is_file;
use function range;
use function trim;
use SebastianBergmann\CodeCoverage\Driver\Driver;
use SebastianBergmann\CodeCoverage\StaticAnalysis\FileAnalyser;
@@ -87,7 +91,7 @@ final class RawCodeCoverageData
{
$lineCoverage = [];
foreach ($analyser->executableLinesIn($filename) as $line) {
foreach ($analyser->executableLinesIn($filename) as $line => $branch) {
$lineCoverage[$line] = Driver::LINE_NOT_EXECUTED;
}
@@ -137,6 +141,42 @@ final class RawCodeCoverageData
);
}
/**
* @param int[] $linesToBranchMap
*/
public function markExecutableLineByBranch(string $filename, array $linesToBranchMap): void
{
if (!isset($this->lineCoverage[$filename])) {
return;
}
$linesByBranch = [];
foreach ($linesToBranchMap as $line => $branch) {
$linesByBranch[$branch][] = $line;
}
foreach ($this->lineCoverage[$filename] as $line => $lineStatus) {
if (!isset($linesToBranchMap[$line])) {
continue;
}
$branch = $linesToBranchMap[$line];
if (!isset($linesByBranch[$branch])) {
continue;
}
foreach ($linesByBranch[$branch] as $lineInBranch) {
$this->lineCoverage[$filename][$lineInBranch] = $lineStatus;
}
if (Driver::LINE_EXECUTED === $lineStatus) {
unset($linesByBranch[$branch]);
}
}
}
/**
* @param int[] $lines
*/

View File

@@ -9,10 +9,13 @@
*/
namespace SebastianBergmann\CodeCoverage\Report;
use function basename;
use function count;
use function dirname;
use function file_put_contents;
use function preg_match;
use function range;
use function str_replace;
use function time;
use DOMImplementation;
use SebastianBergmann\CodeCoverage\CodeCoverage;
@@ -25,7 +28,7 @@ final class Cobertura
/**
* @throws WriteOperationFailedException
*/
public function process(CodeCoverage $coverage, ?string $target = null, ?string $name = null): string
public function process(CodeCoverage $coverage, ?string $target = null): string
{
$time = (string) time();
@@ -84,9 +87,8 @@ final class Cobertura
$packageElement = $document->createElement('package');
$packageComplexity = 0;
$packageName = $name ?? '';
$packageElement->setAttribute('name', $packageName);
$packageElement->setAttribute('name', str_replace($report->pathAsString() . DIRECTORY_SEPARATOR, '', $item->pathAsString()));
$linesValid = $item->numberOfExecutableLines();
$linesCovered = $item->numberOfExecutedLines();

View File

@@ -117,7 +117,7 @@ final class Dashboard extends Renderer
private function coverageDistribution(array $classes): array
{
$result = [
'class' => [
'class' => [
'0%' => 0,
'0-10%' => 0,
'10-20%' => 0,

View File

@@ -80,6 +80,8 @@ use const T_WHILE;
use const T_YIELD;
use const T_YIELD_FROM;
use function array_key_exists;
use function array_keys;
use function array_merge;
use function array_pop;
use function array_unique;
use function constant;
@@ -89,6 +91,9 @@ use function explode;
use function file_get_contents;
use function htmlspecialchars;
use function is_string;
use function ksort;
use function range;
use function sort;
use function sprintf;
use function str_replace;
use function substr;
@@ -279,19 +284,19 @@ final class File extends Renderer
$buffer .= $this->renderItemTemplate(
$template,
[
'name' => $this->abbreviateClassName($name),
'numClasses' => $numClasses,
'numTestedClasses' => $numTestedClasses,
'numMethods' => $numMethods,
'numTestedMethods' => $numTestedMethods,
'linesExecutedPercent' => Percentage::fromFractionAndTotal(
'name' => $this->abbreviateClassName($name),
'numClasses' => $numClasses,
'numTestedClasses' => $numTestedClasses,
'numMethods' => $numMethods,
'numTestedMethods' => $numTestedMethods,
'linesExecutedPercent' => Percentage::fromFractionAndTotal(
$item['executedLines'],
$item['executableLines'],
)->asFloat(),
'linesExecutedPercentAsString' => $linesExecutedPercentAsString,
'numExecutedLines' => $item['executedLines'],
'numExecutableLines' => $item['executableLines'],
'branchesExecutedPercent' => Percentage::fromFractionAndTotal(
'linesExecutedPercentAsString' => $linesExecutedPercentAsString,
'numExecutedLines' => $item['executedLines'],
'numExecutableLines' => $item['executableLines'],
'branchesExecutedPercent' => Percentage::fromFractionAndTotal(
$item['executedBranches'],
$item['executableBranches'],
)->asFloat(),
@@ -302,14 +307,14 @@ final class File extends Renderer
$item['executedPaths'],
$item['executablePaths']
)->asFloat(),
'pathsExecutedPercentAsString' => $pathsExecutedPercentAsString,
'numExecutedPaths' => $item['executedPaths'],
'numExecutablePaths' => $item['executablePaths'],
'testedMethodsPercent' => $testedMethodsPercentage->asFloat(),
'testedMethodsPercentAsString' => $testedMethodsPercentage->asString(),
'testedClassesPercent' => $testedClassesPercentage->asFloat(),
'testedClassesPercentAsString' => $testedClassesPercentage->asString(),
'crap' => $item['crap'],
'pathsExecutedPercentAsString' => $pathsExecutedPercentAsString,
'numExecutedPaths' => $item['executedPaths'],
'numExecutablePaths' => $item['executablePaths'],
'testedMethodsPercent' => $testedMethodsPercentage->asFloat(),
'testedMethodsPercentAsString' => $testedMethodsPercentage->asString(),
'testedClassesPercent' => $testedClassesPercentage->asFloat(),
'testedClassesPercentAsString' => $testedClassesPercentage->asString(),
'crap' => $item['crap'],
]
);
@@ -379,7 +384,7 @@ final class File extends Renderer
return $this->renderItemTemplate(
$template,
[
'name' => sprintf(
'name' => sprintf(
'%s<a href="#%d"><abbr title="%s">%s</abbr></a>',
$indent,
$item['startLine'],
@@ -797,8 +802,15 @@ final class File extends Renderer
$singleLineTemplate = new Template($this->templatePath . 'line.html.dist', '{{', '}}');
$lines = '';
$first = true;
foreach ($path['path'] as $branchId) {
if ($first) {
$first = false;
} else {
$lines .= ' <tr><td colspan="2">&nbsp;</td></tr>' . "\n";
}
$branchLines = range($branches[$branchId]['line_start'], $branches[$branchId]['line_end']);
sort($branchLines); // sometimes end_line < start_line
@@ -834,6 +846,7 @@ final class File extends Renderer
$popoverContent .= $this->createPopoverContentForTest($test, $testData[$test]);
}
$trClass = $lineCss . ' popin';
}

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,9 @@
body {
font-family: sans-serif;
font-size: 1em;
font-kerning: normal;
font-variant-ligatures: common-ligatures;
text-rendering: optimizeLegibility;
padding-top: 10px;
}
@@ -8,6 +13,8 @@ body {
.octicon {
margin-right:.25em;
vertical-align: baseline;
width: 0.75em;
}
.table-bordered>thead>tr>td {
@@ -57,6 +64,7 @@ body {
}
td.big {
vertical-align: middle;
width: 117px;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -12,7 +12,6 @@ namespace SebastianBergmann\CodeCoverage\Report;
use function dirname;
use function file_put_contents;
use function serialize;
use function sprintf;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException;
use SebastianBergmann\CodeCoverage\Util\Filesystem;
@@ -21,14 +20,8 @@ final class PHP
{
public function process(CodeCoverage $coverage, ?string $target = null): string
{
$buffer = sprintf(
"<?php
return \unserialize(<<<'END_OF_COVERAGE_SERIALIZATION'%s%s%sEND_OF_COVERAGE_SERIALIZATION%s);",
PHP_EOL,
serialize($coverage),
PHP_EOL,
PHP_EOL
);
$buffer = "<?php
return \unserialize(<<<'END_OF_COVERAGE_SERIALIZATION'" . PHP_EOL . serialize($coverage) . PHP_EOL . 'END_OF_COVERAGE_SERIALIZATION' . PHP_EOL . ');';
if ($target !== null) {
Filesystem::createDirectory(dirname($target));

View File

@@ -37,7 +37,7 @@ final class Coverage
{
$this->contextNode = $context;
$this->writer = new XMLWriter();
$this->writer = new XMLWriter;
$this->writer->openMemory();
$this->writer->startElementNS(null, $context->nodeName, 'https://schema.phpunit.de/coverage/1.0');
$this->writer->writeAttribute('nr', $line);

View File

@@ -20,7 +20,7 @@ final class Report extends File
{
public function __construct(string $name)
{
$dom = new DOMDocument();
$dom = new DOMDocument;
$dom->loadXML('<?xml version="1.0" ?><phpunit xmlns="https://schema.phpunit.de/coverage/1.0"><file /></phpunit>');
$contextNode = $dom->getElementsByTagNameNS(

View File

@@ -31,7 +31,7 @@ final class Source
{
$context = $this->context;
$tokens = (new Tokenizer())->parse($source);
$tokens = (new Tokenizer)->parse($source);
$srcDom = (new XMLSerializer(new NamespaceUri($context->namespaceURI)))->toDom($tokens);
$context->parentNode->replaceChild(

View File

@@ -15,6 +15,7 @@ use function implode;
use function is_file;
use function md5;
use function serialize;
use function unserialize;
use SebastianBergmann\CodeCoverage\Util\Filesystem;
use SebastianBergmann\FileIterator\Facade as FileIteratorFacade;

View File

@@ -9,6 +9,7 @@
*/
namespace SebastianBergmann\CodeCoverage\StaticAnalysis;
use function assert;
use function implode;
use function rtrim;
use function trim;
@@ -314,6 +315,8 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract
if ($_type instanceof Name) {
$types[] = $_type->toCodeString();
} else {
assert($_type instanceof Identifier);
$types[] = $_type->toString();
}
}

View File

@@ -9,46 +9,19 @@
*/
namespace SebastianBergmann\CodeCoverage\StaticAnalysis;
use function array_diff_key;
use function assert;
use function count;
use function current;
use function end;
use function explode;
use function max;
use function preg_match;
use function preg_quote;
use function range;
use function reset;
use function sprintf;
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_;
use PhpParser\Node\Stmt\Else_;
use PhpParser\Node\Stmt\ElseIf_;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\Finally_;
use PhpParser\Node\Stmt\For_;
use PhpParser\Node\Stmt\Foreach_;
use PhpParser\Node\Stmt\Goto_;
use PhpParser\Node\Stmt\If_;
use PhpParser\Node\Stmt\Property;
use PhpParser\Node\Stmt\Return_;
use PhpParser\Node\Stmt\Switch_;
use PhpParser\Node\Stmt\Throw_;
use PhpParser\Node\Stmt\TryCatch;
use PhpParser\Node\Stmt\Unset_;
use PhpParser\Node\Stmt\While_;
use PhpParser\NodeVisitorAbstract;
/**
@@ -57,217 +30,336 @@ use PhpParser\NodeVisitorAbstract;
final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
{
/**
* @psalm-var array<int, int>
* @var int
*/
private $executableLines = [];
private $nextBranch = 0;
/**
* @psalm-var array<int, int>
* @var string
*/
private $propertyLines = [];
private $source;
/**
* @psalm-var array<int, Return_>
* @var array<int, int>
*/
private $returns = [];
private $executableLinesGroupedByBranch = [];
/**
* @var array<int, bool>
*/
private $unsets = [];
/**
* @var array<int, string>
*/
private $commentsToCheckForUnset = [];
public function __construct(string $source)
{
$this->source = $source;
}
public function enterNode(Node $node): void
{
$this->savePropertyLines($node);
foreach ($node->getComments() as $comment) {
$commentLine = $comment->getStartLine();
if (!isset($this->executableLinesGroupedByBranch[$commentLine])) {
continue;
}
foreach (explode("\n", $comment->getText()) as $text) {
$this->commentsToCheckForUnset[$commentLine] = $text;
$commentLine++;
}
}
if ($node instanceof Node\Scalar\String_ ||
$node instanceof Node\Scalar\EncapsedStringPart) {
$startLine = $node->getStartLine() + 1;
$endLine = $node->getEndLine() - 1;
if ($startLine <= $endLine) {
foreach (range($startLine, $endLine) as $line) {
unset($this->executableLinesGroupedByBranch[$line]);
}
}
if (!$this->isExecutable($node)) {
return;
}
foreach ($this->getLines($node) as $line) {
if (isset($this->propertyLines[$line])) {
if ($node instanceof Node\Stmt\Declare_ ||
$node instanceof Node\Stmt\DeclareDeclare ||
$node instanceof Node\Stmt\Else_ ||
$node instanceof Node\Stmt\EnumCase ||
$node instanceof Node\Stmt\Finally_ ||
$node instanceof Node\Stmt\Interface_ ||
$node instanceof Node\Stmt\Label ||
$node instanceof Node\Stmt\Namespace_ ||
$node instanceof Node\Stmt\Nop ||
$node instanceof Node\Stmt\Switch_ ||
$node instanceof Node\Stmt\TryCatch ||
$node instanceof Node\Stmt\Use_ ||
$node instanceof Node\Stmt\UseUse ||
$node instanceof Node\Expr\Match_ ||
$node instanceof Node\Expr\Variable ||
$node instanceof Node\ComplexType ||
$node instanceof Node\Const_ ||
$node instanceof Node\Identifier ||
$node instanceof Node\Name ||
$node instanceof Node\Param ||
$node instanceof Node\Scalar) {
return;
}
if ($node instanceof Node\Stmt\Throw_) {
$this->setLineBranch($node->expr->getEndLine(), $node->expr->getEndLine(), ++$this->nextBranch);
return;
}
if ($node instanceof Node\Stmt\Enum_ ||
$node instanceof Node\Stmt\Function_ ||
$node instanceof Node\Stmt\Class_ ||
$node instanceof Node\Stmt\ClassMethod ||
$node instanceof Node\Expr\Closure ||
$node instanceof Node\Stmt\Trait_) {
$isConcreteClassLike = $node instanceof Node\Stmt\Enum_ || $node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\Trait_;
if (null !== $node->stmts) {
foreach ($node->stmts as $stmt) {
if ($stmt instanceof Node\Stmt\Nop) {
continue;
}
foreach (range($stmt->getStartLine(), $stmt->getEndLine()) as $line) {
unset($this->executableLinesGroupedByBranch[$line]);
if (
$isConcreteClassLike &&
!$stmt instanceof Node\Stmt\ClassMethod
) {
$this->unsets[$line] = true;
}
}
}
}
if ($isConcreteClassLike) {
return;
}
$this->executableLines[$line] = $line;
}
}
$hasEmptyBody = [] === $node->stmts ||
null === $node->stmts ||
(
1 === count($node->stmts) &&
$node->stmts[0] instanceof Node\Stmt\Nop
);
/**
* @psalm-return array<int, int>
*/
public function executableLines(): array
{
$this->computeReturns();
if ($hasEmptyBody) {
if ($node->getEndLine() === $node->getStartLine()) {
return;
}
sort($this->executableLines);
$this->setLineBranch($node->getEndLine(), $node->getEndLine(), ++$this->nextBranch);
return $this->executableLines;
}
return;
}
private function savePropertyLines(Node $node): void
{
if (!$node instanceof Property && !$node instanceof Node\Stmt\ClassConst) {
return;
}
foreach (range($node->getStartLine(), $node->getEndLine()) as $index) {
$this->propertyLines[$index] = $index;
}
}
if ($node instanceof Node\Expr\ArrowFunction) {
$startLine = max(
$node->getStartLine() + 1,
$node->expr->getStartLine()
);
private function computeReturns(): void
{
foreach ($this->returns as $return) {
foreach (range($return->getStartLine(), $return->getEndLine()) as $loc) {
if (isset($this->executableLines[$loc])) {
continue 2;
$endLine = $node->expr->getEndLine();
if ($endLine < $startLine) {
return;
}
$this->setLineBranch($startLine, $endLine, ++$this->nextBranch);
return;
}
if ($node instanceof Node\Expr\Ternary) {
if (null !== $node->if &&
$node->getStartLine() !== $node->if->getEndLine()) {
$this->setLineBranch($node->if->getStartLine(), $node->if->getEndLine(), ++$this->nextBranch);
}
if ($node->getStartLine() !== $node->else->getEndLine()) {
$this->setLineBranch($node->else->getStartLine(), $node->else->getEndLine(), ++$this->nextBranch);
}
return;
}
if ($node instanceof Node\Expr\BinaryOp\Coalesce) {
if ($node->getStartLine() !== $node->getEndLine()) {
$this->setLineBranch($node->getEndLine(), $node->getEndLine(), ++$this->nextBranch);
}
return;
}
if ($node instanceof Node\Stmt\If_ ||
$node instanceof Node\Stmt\ElseIf_ ||
$node instanceof Node\Stmt\Case_) {
if (null === $node->cond) {
return;
}
$this->setLineBranch(
$node->cond->getStartLine(),
$node->cond->getStartLine(),
++$this->nextBranch
);
return;
}
if ($node instanceof Node\Stmt\For_) {
$startLine = null;
$endLine = null;
if ([] !== $node->init) {
$startLine = $node->init[0]->getStartLine();
end($node->init);
$endLine = current($node->init)->getEndLine();
reset($node->init);
}
if ([] !== $node->cond) {
if (null === $startLine) {
$startLine = $node->cond[0]->getStartLine();
}
end($node->cond);
$endLine = current($node->cond)->getEndLine();
reset($node->cond);
}
$line = $return->getEndLine();
if ($return->expr !== null) {
$line = $return->expr->getStartLine();
}
$this->executableLines[$line] = $line;
}
}
/**
* @return int[]
*/
private function getLines(Node $node): array
{
if ($node instanceof Cast ||
$node instanceof PropertyFetch ||
$node instanceof NullsafePropertyFetch ||
$node instanceof StaticPropertyFetch) {
return [$node->getEndLine()];
}
if ($node instanceof ArrayDimFetch) {
if (null === $node->dim) {
return [];
}
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 ([] !== $node->loop) {
if (null === $startLine) {
$startLine = $node->loop[0]->getStartLine();
}
end($node->loop);
$endLine = current($node->loop)->getEndLine();
reset($node->loop);
}
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());
if (null === $startLine || null === $endLine) {
return;
}
return [];
$this->setLineBranch(
$startLine,
$endLine,
++$this->nextBranch
);
return;
}
if ($node instanceof MethodCall) {
return [$node->name->getStartLine()];
if ($node instanceof Node\Stmt\Foreach_) {
$this->setLineBranch(
$node->expr->getStartLine(),
$node->valueVar->getEndLine(),
++$this->nextBranch
);
return;
}
if ($node instanceof Ternary) {
$lines = [$node->cond->getStartLine()];
if ($node instanceof Node\Stmt\While_ ||
$node instanceof Node\Stmt\Do_) {
$this->setLineBranch(
$node->cond->getStartLine(),
$node->cond->getEndLine(),
++$this->nextBranch
);
if (null !== $node->if) {
$lines[] = $node->if->getStartLine();
return;
}
if ($node instanceof Node\Stmt\Catch_) {
assert([] !== $node->types);
$startLine = $node->types[0]->getStartLine();
end($node->types);
$endLine = current($node->types)->getEndLine();
$this->setLineBranch(
$startLine,
$endLine,
++$this->nextBranch
);
return;
}
if ($node instanceof Node\Expr\CallLike) {
if (isset($this->executableLinesGroupedByBranch[$node->getStartLine()])) {
$branch = $this->executableLinesGroupedByBranch[$node->getStartLine()];
} else {
$branch = ++$this->nextBranch;
}
$lines[] = $node->else->getStartLine();
$this->setLineBranch($node->getStartLine(), $node->getEndLine(), $branch);
return $lines;
return;
}
if ($node instanceof Match_) {
return [$node->cond->getStartLine()];
if (isset($this->executableLinesGroupedByBranch[$node->getStartLine()])) {
return;
}
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()];
$this->setLineBranch($node->getStartLine(), $node->getEndLine(), ++$this->nextBranch);
}
private function isExecutable(Node $node): bool
public function afterTraverse(array $nodes): void
{
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_ ||
$node instanceof Echo_ ||
$node instanceof ElseIf_ ||
$node instanceof Else_ ||
$node instanceof Encapsed ||
$node instanceof Expression ||
$node instanceof Finally_ ||
$node instanceof For_ ||
$node instanceof Foreach_ ||
$node instanceof Goto_ ||
$node instanceof If_ ||
$node instanceof Match_ ||
$node instanceof MatchArm ||
$node instanceof MethodCall ||
$node instanceof NullsafePropertyFetch ||
$node instanceof PropertyFetch ||
$node instanceof Return_ ||
$node instanceof StaticPropertyFetch ||
$node instanceof Switch_ ||
$node instanceof Ternary ||
$node instanceof Throw_ ||
$node instanceof TryCatch ||
$node instanceof Unset_ ||
$node instanceof While_;
$lines = explode("\n", $this->source);
foreach ($lines as $lineNumber => $line) {
$lineNumber++;
if (1 === preg_match('/^\s*$/', $line) ||
(
isset($this->commentsToCheckForUnset[$lineNumber]) &&
1 === preg_match(sprintf('/^\s*%s\s*$/', preg_quote($this->commentsToCheckForUnset[$lineNumber], '/')), $line)
)) {
unset($this->executableLinesGroupedByBranch[$lineNumber]);
}
}
$this->executableLinesGroupedByBranch = array_diff_key(
$this->executableLinesGroupedByBranch,
$this->unsets
);
}
public function executableLinesGroupedByBranch(): array
{
return $this->executableLinesGroupedByBranch;
}
private function setLineBranch(int $start, int $end, int $branch): void
{
foreach (range($start, $end) as $line) {
$this->executableLinesGroupedByBranch[$line] = $branch;
}
}
}

View File

@@ -10,9 +10,11 @@
namespace SebastianBergmann\CodeCoverage\StaticAnalysis;
use function array_merge;
use function assert;
use function range;
use function strpos;
use PhpParser\Node;
use PhpParser\Node\Attribute;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
@@ -52,7 +54,8 @@ final class IgnoredLinesFindingVisitor extends NodeVisitorAbstract
!$node instanceof Trait_ &&
!$node instanceof Interface_ &&
!$node instanceof ClassMethod &&
!$node instanceof Function_) {
!$node instanceof Function_ &&
!$node instanceof Attribute) {
return;
}
@@ -60,11 +63,16 @@ final class IgnoredLinesFindingVisitor extends NodeVisitorAbstract
return;
}
// Workaround for https://bugs.xdebug.org/view.php?id=1798
if ($node instanceof Class_ ||
$node instanceof Trait_ ||
$node instanceof Interface_) {
$node instanceof Interface_ ||
$node instanceof Attribute) {
$this->ignoredLines[] = $node->getStartLine();
assert($node->name !== null);
// Workaround for https://github.com/nikic/PHP-Parser/issues/886
$this->ignoredLines[] = $node->name->getStartLine();
}
if (!$this->useAnnotationsForIgnoringCode) {
@@ -75,6 +83,19 @@ final class IgnoredLinesFindingVisitor extends NodeVisitorAbstract
return;
}
$this->processDocComment($node);
}
/**
* @psalm-return list<int>
*/
public function ignoredLines(): array
{
return $this->ignoredLines;
}
private function processDocComment(Node $node): void
{
$docComment = $node->getDocComment();
if ($docComment === null) {
@@ -95,12 +116,4 @@ final class IgnoredLinesFindingVisitor extends NodeVisitorAbstract
);
}
}
/**
* @psalm-return list<int>
*/
public function ignoredLines(): array
{
return $this->ignoredLines;
}
}

View File

@@ -9,11 +9,14 @@
*/
namespace SebastianBergmann\CodeCoverage\StaticAnalysis;
use function array_merge;
use function array_unique;
use function assert;
use function file_get_contents;
use function is_array;
use function max;
use function range;
use function sort;
use function sprintf;
use function substr_count;
use function token_get_all;
@@ -153,7 +156,7 @@ final class ParsingFileAnalyser implements FileAnalyser
$codeUnitFindingVisitor = new CodeUnitFindingVisitor;
$lineCountingVisitor = new LineCountingVisitor($linesOfCode);
$ignoredLinesFindingVisitor = new IgnoredLinesFindingVisitor($this->useAnnotationsForIgnoringCode, $this->ignoreDeprecatedCode);
$executableLinesFindingVisitor = new ExecutableLinesFindingVisitor;
$executableLinesFindingVisitor = new ExecutableLinesFindingVisitor($source);
$traverser->addVisitor(new NameResolver);
$traverser->addVisitor(new ParentConnectingVisitor);
@@ -172,7 +175,7 @@ final class ParsingFileAnalyser implements FileAnalyser
$filename,
$error->getMessage()
),
(int) $error->getCode(),
$error->getCode(),
$error
);
}
@@ -181,7 +184,7 @@ final class ParsingFileAnalyser implements FileAnalyser
$this->classes[$filename] = $codeUnitFindingVisitor->classes();
$this->traits[$filename] = $codeUnitFindingVisitor->traits();
$this->functions[$filename] = $codeUnitFindingVisitor->functions();
$this->executableLines[$filename] = $executableLinesFindingVisitor->executableLines();
$this->executableLines[$filename] = $executableLinesFindingVisitor->executableLinesGroupedByBranch();
$this->ignoredLines[$filename] = [];
$this->findLinesIgnoredByLineBasedAnnotations($filename, $source, $this->useAnnotationsForIgnoringCode);
@@ -206,45 +209,44 @@ final class ParsingFileAnalyser implements FileAnalyser
private function findLinesIgnoredByLineBasedAnnotations(string $filename, string $source, bool $useAnnotationsForIgnoringCode): void
{
$ignore = false;
$stop = false;
if (!$useAnnotationsForIgnoringCode) {
return;
}
$start = false;
foreach (token_get_all($source) as $token) {
if (!is_array($token)) {
if (!is_array($token) ||
!(T_COMMENT === $token[0] || T_DOC_COMMENT === $token[0])) {
continue;
}
switch ($token[0]) {
case T_COMMENT:
case T_DOC_COMMENT:
if (!$useAnnotationsForIgnoringCode) {
break;
}
$comment = trim($token[1]);
$comment = trim($token[1]);
if ($comment === '// @codeCoverageIgnore' ||
$comment === '//@codeCoverageIgnore') {
$ignore = true;
$stop = true;
} elseif ($comment === '// @codeCoverageIgnoreStart' ||
$comment === '//@codeCoverageIgnoreStart') {
$ignore = true;
} elseif ($comment === '// @codeCoverageIgnoreEnd' ||
$comment === '//@codeCoverageIgnoreEnd') {
$stop = true;
}
break;
}
if ($ignore) {
if ($comment === '// @codeCoverageIgnore' ||
$comment === '//@codeCoverageIgnore') {
$this->ignoredLines[$filename][] = $token[2];
if ($stop) {
$ignore = false;
$stop = false;
continue;
}
if ($comment === '// @codeCoverageIgnoreStart' ||
$comment === '//@codeCoverageIgnoreStart') {
$start = $token[2];
continue;
}
if ($comment === '// @codeCoverageIgnoreEnd' ||
$comment === '//@codeCoverageIgnoreEnd') {
if (false === $start) {
$start = $token[2];
}
$this->ignoredLines[$filename] = array_merge(
$this->ignoredLines[$filename],
range($start, $token[2])
);
}
}
}

View File

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

View File

@@ -2,6 +2,12 @@
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.31] - 2022-10-28
### Fixed
* [#5076](https://github.com/sebastianbergmann/phpunit/issues/5076): Test Runner does not warn about conflicting options
## [8.5.30] - 2022-09-25
### Changed
@@ -250,6 +256,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.31]: https://github.com/sebastianbergmann/phpunit/compare/8.5.30...8.5.31
[8.5.30]: https://github.com/sebastianbergmann/phpunit/compare/8.5.29...8.5.30
[8.5.29]: https://github.com/sebastianbergmann/phpunit/compare/8.5.28...8.5.29
[8.5.28]: https://github.com/sebastianbergmann/phpunit/compare/8.5.27...8.5.28

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.27] - 2022-12-09
### Fixed
* [#5113](https://github.com/sebastianbergmann/phpunit/pull/5113): PHP error instead of PHPUnit error when trying to create test double for `readonly` class
## [9.5.26] - 2022-10-28
### Fixed
* [#5076](https://github.com/sebastianbergmann/phpunit/issues/5076): Test Runner does not warn about conflicting options
## [9.5.25] - 2022-09-25
### Added
@@ -200,6 +212,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.27]: https://github.com/sebastianbergmann/phpunit/compare/9.5.26...9.5.27
[9.5.26]: https://github.com/sebastianbergmann/phpunit/compare/9.5.25...9.5.26
[9.5.25]: https://github.com/sebastianbergmann/phpunit/compare/9.5.24...9.5.25
[9.5.24]: https://github.com/sebastianbergmann/phpunit/compare/9.5.23...9.5.24
[9.5.23]: https://github.com/sebastianbergmann/phpunit/compare/9.5.22...9.5.23

View File

@@ -1,3 +1,5 @@
<h1 align="center">🇺🇦 <a href="https://phpunit.de/stand-with-ukraine.html">UKRAINE NEEDS YOUR HELP NOW!</a></h1>
# PHPUnit
PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks.

View File

@@ -56,7 +56,7 @@ class ClassHasAttribute extends Constraint
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -48,7 +48,7 @@ final class ClassHasStaticAttribute extends ClassHasAttribute
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -0,0 +1,28 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (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 PHPUnit\Framework\MockObject;
use function sprintf;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class ClassIsReadonlyException extends \PHPUnit\Framework\Exception implements Exception
{
public function __construct(string $className)
{
parent::__construct(
sprintf(
'Class "%s" is declared "readonly" and cannot be doubled',
$className
)
);
}
}

View File

@@ -27,6 +27,7 @@ use function interface_exists;
use function is_array;
use function is_object;
use function md5;
use function method_exists;
use function mt_rand;
use function preg_match;
use function preg_match_all;
@@ -146,6 +147,7 @@ EOT;
* @throws \PHPUnit\Framework\InvalidArgumentException
* @throws ClassAlreadyExistsException
* @throws ClassIsFinalException
* @throws ClassIsReadonlyException
* @throws DuplicateMethodException
* @throws InvalidMethodNameException
* @throws OriginalConstructorInvocationRequiredException
@@ -186,7 +188,7 @@ EOT;
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -299,6 +301,7 @@ EOT;
* @throws \PHPUnit\Framework\InvalidArgumentException
* @throws ClassAlreadyExistsException
* @throws ClassIsFinalException
* @throws ClassIsReadonlyException
* @throws DuplicateMethodException
* @throws InvalidMethodNameException
* @throws OriginalConstructorInvocationRequiredException
@@ -317,7 +320,7 @@ EOT;
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -360,6 +363,7 @@ EOT;
* @throws \PHPUnit\Framework\InvalidArgumentException
* @throws ClassAlreadyExistsException
* @throws ClassIsFinalException
* @throws ClassIsReadonlyException
* @throws DuplicateMethodException
* @throws InvalidMethodNameException
* @throws OriginalConstructorInvocationRequiredException
@@ -442,6 +446,7 @@ EOT;
/**
* @throws ClassIsFinalException
* @throws ClassIsReadonlyException
* @throws ReflectionException
* @throws RuntimeException
*/
@@ -501,7 +506,7 @@ EOT;
} catch (SoapFault $e) {
throw new RuntimeException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -588,7 +593,7 @@ EOT;
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -618,7 +623,7 @@ EOT;
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -648,7 +653,7 @@ EOT;
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -678,7 +683,7 @@ EOT;
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -715,7 +720,7 @@ EOT;
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -742,7 +747,7 @@ EOT;
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -764,6 +769,7 @@ EOT;
/**
* @throws ClassIsFinalException
* @throws ClassIsReadonlyException
* @throws ReflectionException
* @throws RuntimeException
*/
@@ -809,7 +815,7 @@ EOT;
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -819,6 +825,10 @@ EOT;
throw new ClassIsFinalException($_mockClassName['fullClassName']);
}
if (method_exists($class, 'isReadOnly') && $class->isReadOnly()) {
throw new ClassIsReadonlyException($_mockClassName['fullClassName']);
}
// @see https://github.com/sebastianbergmann/phpunit/issues/2995
if ($isInterface && $class->implementsInterface(Throwable::class)) {
$actualClassName = Exception::class;
@@ -831,7 +841,7 @@ EOT;
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -847,7 +857,7 @@ EOT;
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -888,7 +898,7 @@ EOT;
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -927,7 +937,7 @@ EOT;
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -1088,7 +1098,7 @@ EOT;
} catch (TemplateException $e) {
throw new RuntimeException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -114,6 +114,7 @@ final class MockBuilder
* @throws \PHPUnit\Framework\InvalidArgumentException
* @throws ClassAlreadyExistsException
* @throws ClassIsFinalException
* @throws ClassIsReadonlyException
* @throws DuplicateMethodException
* @throws InvalidMethodNameException
* @throws OriginalConstructorInvocationRequiredException
@@ -241,7 +242,7 @@ final class MockBuilder
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -283,7 +284,7 @@ final class MockBuilder
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -254,7 +254,7 @@ final class MockMethod
} catch (TemplateException $e) {
throw new RuntimeException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -371,7 +371,7 @@ final class MockMethod
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -554,7 +554,7 @@ abstract class TestCase extends Assert implements Reorderable, SelfDescribing, T
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -776,7 +776,7 @@ abstract class TestCase extends Assert implements Reorderable, SelfDescribing, T
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -1765,7 +1765,7 @@ abstract class TestCase extends Assert implements Reorderable, SelfDescribing, T
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -1970,6 +1970,8 @@ abstract class TestCase extends Assert implements Reorderable, SelfDescribing, T
* @throws \Prophecy\Exception\Doubler\InterfaceNotFoundException
*
* @psalm-param class-string|null $classOrInterface
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4141
*/
protected function prophesize(?string $classOrInterface = null): ObjectProphecy
{
@@ -2531,7 +2533,7 @@ abstract class TestCase extends Assert implements Reorderable, SelfDescribing, T
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -902,7 +902,7 @@ final class TestResult implements Countable
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -917,7 +917,7 @@ final class TestResult implements Countable
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -47,6 +47,8 @@ use ReflectionMethod;
use Throwable;
/**
* @template-implements IteratorAggregate<int, Test>
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
@@ -181,7 +183,7 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -264,7 +266,7 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -319,7 +321,7 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -340,7 +342,7 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -422,7 +424,7 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -444,7 +446,7 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -464,7 +466,7 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -14,6 +14,8 @@ use function count;
use RecursiveIterator;
/**
* @template-implements RecursiveIterator<int, Test>
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class TestSuiteIterator implements RecursiveIterator

View File

@@ -76,7 +76,7 @@ final class ExtensionHandler
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -75,7 +75,7 @@ final class StandardTestSuiteLoader implements TestSuiteLoader
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -92,7 +92,7 @@ final class StandardTestSuiteLoader implements TestSuiteLoader
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

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

View File

@@ -135,7 +135,7 @@ final class Builder
} catch (CliParserException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -452,7 +452,7 @@ class Command
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -522,7 +522,7 @@ class Command
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
// @codeCoverageIgnoreEnd
@@ -641,6 +641,16 @@ class Command
{
$this->printVersionString();
$this->warnAboutConflictingOptions(
'listGroups',
[
'filter',
'groups',
'excludeGroups',
'testsuite',
]
);
print 'Available test group(s):' . PHP_EOL;
$groups = $suite->getGroups();
@@ -672,6 +682,16 @@ class Command
{
$this->printVersionString();
$this->warnAboutConflictingOptions(
'listSuites',
[
'filter',
'groups',
'excludeGroups',
'testsuite',
]
);
print 'Available test suite(s):' . PHP_EOL;
foreach ($this->arguments['configurationObject']->testSuite() as $testSuite) {
@@ -695,6 +715,16 @@ class Command
{
$this->printVersionString();
$this->warnAboutConflictingOptions(
'listTests',
[
'filter',
'groups',
'excludeGroups',
'testsuite',
]
);
$renderer = new TextTestListRenderer;
print $renderer->render($suite);
@@ -713,6 +743,16 @@ class Command
{
$this->printVersionString();
$this->warnAboutConflictingOptions(
'listTestsXml',
[
'filter',
'groups',
'excludeGroups',
'testsuite',
]
);
$renderer = new XmlTestListRenderer;
file_put_contents($target, $renderer->render($suite));
@@ -905,4 +945,62 @@ class Command
return null;
}
/**
* @psalm-param "listGroups"|"listSuites"|"listTests"|"listTestsXml"|"filter"|"groups"|"excludeGroups"|"testsuite" $key
* @psalm-param list<"listGroups"|"listSuites"|"listTests"|"listTestsXml"|"filter"|"groups"|"excludeGroups"|"testsuite"> $keys
*/
private function warnAboutConflictingOptions(string $key, array $keys): void
{
$warningPrinted = false;
foreach ($keys as $_key) {
if (!empty($this->arguments[$_key])) {
printf(
'The %s and %s options cannot be combined, %s is ignored' . PHP_EOL,
$this->mapKeyToOptionForWarning($_key),
$this->mapKeyToOptionForWarning($key),
$this->mapKeyToOptionForWarning($_key)
);
$warningPrinted = true;
}
}
if ($warningPrinted) {
print PHP_EOL;
}
}
/**
* @psalm-param "listGroups"|"listSuites"|"listTests"|"listTestsXml"|"filter"|"groups"|"excludeGroups"|"testsuite" $key
*/
private function mapKeyToOptionForWarning(string $key): string
{
switch ($key) {
case 'listGroups':
return '--list-groups';
case 'listSuites':
return '--list-suites';
case 'listTests':
return '--list-tests';
case 'listTestsXml':
return '--list-tests-xml';
case 'filter':
return '--filter';
case 'groups':
return '--group';
case 'excludeGroups':
return '--exclude-group';
case 'testsuite':
return '--testsuite';
}
}
}

View File

@@ -54,7 +54,6 @@ 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;
@@ -308,7 +307,7 @@ final class TestRunner extends BaseTestRunner
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -326,18 +325,7 @@ final class TestRunner extends BaseTestRunner
$this->printer->setShowProgressAnimation(!$arguments['noInteraction']);
}
if ($arguments['colors'] !== DefaultResultPrinter::COLOR_NEVER) {
$this->write(
'PHPUnit ' .
Version::id() .
' ' .
Color::colorize('bg-blue,fg-white', '#StandWith') .
Color::colorize('bg-yellow,fg-black', 'Ukraine') .
"\n"
);
} else {
$this->write(Version::getVersionString() . "\n");
}
$this->write(Version::getVersionString() . "\n");
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);

View File

@@ -95,7 +95,7 @@ final class TestSuiteMapper
} catch (FrameworkException $e) {
throw new RuntimeException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -17,6 +17,8 @@ use IteratorAggregate;
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @psalm-immutable
*
* @template-implements IteratorAggregate<int, Directory>
*/
final class DirectoryCollection implements Countable, IteratorAggregate
{

View File

@@ -16,6 +16,8 @@ use Iterator;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @template-implements Iterator<int, Directory>
*/
final class DirectoryCollectionIterator implements Countable, Iterator
{

View File

@@ -17,6 +17,8 @@ use IteratorAggregate;
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @psalm-immutable
*
* @template-implements IteratorAggregate<int, Directory>
*/
final class DirectoryCollection implements Countable, IteratorAggregate
{

View File

@@ -16,6 +16,8 @@ use Iterator;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @template-implements Iterator<int, Directory>
*/
final class DirectoryCollectionIterator implements Countable, Iterator
{

View File

@@ -17,6 +17,8 @@ use IteratorAggregate;
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @psalm-immutable
*
* @template-implements IteratorAggregate<int, File>
*/
final class FileCollection implements Countable, IteratorAggregate
{

View File

@@ -16,6 +16,8 @@ use Iterator;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @template-implements Iterator<int, File>
*/
final class FileCollectionIterator implements Countable, Iterator
{

View File

@@ -15,6 +15,8 @@ use IteratorAggregate;
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @psalm-immutable
*
* @template-implements IteratorAggregate<int, Group>
*/
final class GroupCollection implements IteratorAggregate
{

View File

@@ -16,6 +16,8 @@ use Iterator;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @template-implements Iterator<int, Group>
*/
final class GroupCollectionIterator implements Countable, Iterator
{

View File

@@ -72,7 +72,7 @@ final class Loader
} catch (XmlException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -84,7 +84,7 @@ final class Loader
} catch (XmlException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -9,6 +9,7 @@
*/
namespace PHPUnit\TextUI\XmlConfiguration;
use function assert;
use DOMDocument;
use DOMElement;
use PHPUnit\Util\Xml\SnapshotNodeList;
@@ -27,6 +28,8 @@ final class RemoveLogTypes implements Migration
}
foreach (SnapshotNodeList::fromNodeList($logging->getElementsByTagName('log')) as $logNode) {
assert($logNode instanceof DOMElement);
switch ($logNode->getAttribute('type')) {
case 'json':
case 'tap':

View File

@@ -17,6 +17,8 @@ use IteratorAggregate;
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @psalm-immutable
*
* @template-implements IteratorAggregate<int, Constant>
*/
final class ConstantCollection implements Countable, IteratorAggregate
{

View File

@@ -16,6 +16,8 @@ use Iterator;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @template-implements Iterator<int, Constant>
*/
final class ConstantCollectionIterator implements Countable, Iterator
{

View File

@@ -17,6 +17,8 @@ use IteratorAggregate;
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @psalm-immutable
*
* @template-implements IteratorAggregate<int, IniSetting>
*/
final class IniSettingCollection implements Countable, IteratorAggregate
{

View File

@@ -16,6 +16,8 @@ use Iterator;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @template-implements Iterator<int, IniSetting>
*/
final class IniSettingCollectionIterator implements Countable, Iterator
{

View File

@@ -17,6 +17,8 @@ use IteratorAggregate;
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @psalm-immutable
*
* @template-implements IteratorAggregate<int, Variable>
*/
final class VariableCollection implements Countable, IteratorAggregate
{

View File

@@ -16,6 +16,8 @@ use Iterator;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @template-implements Iterator<int, Variable>
*/
final class VariableCollectionIterator implements Countable, Iterator
{

View File

@@ -15,6 +15,8 @@ use IteratorAggregate;
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @psalm-immutable
*
* @template-implements IteratorAggregate<int, Extension>
*/
final class ExtensionCollection implements IteratorAggregate
{

View File

@@ -16,6 +16,8 @@ use Iterator;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @template-implements Iterator<int, Extension>
*/
final class ExtensionCollectionIterator implements Countable, Iterator
{

View File

@@ -17,6 +17,8 @@ use IteratorAggregate;
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @psalm-immutable
*
* @template-implements IteratorAggregate<int, TestDirectory>
*/
final class TestDirectoryCollection implements Countable, IteratorAggregate
{

View File

@@ -16,6 +16,8 @@ use Iterator;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @template-implements Iterator<int, TestDirectory>
*/
final class TestDirectoryCollectionIterator implements Countable, Iterator
{

View File

@@ -17,6 +17,8 @@ use IteratorAggregate;
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @psalm-immutable
*
* @template-implements IteratorAggregate<int, TestFile>
*/
final class TestFileCollection implements Countable, IteratorAggregate
{

View File

@@ -16,6 +16,8 @@ use Iterator;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @template-implements Iterator<int, TestFile>
*/
final class TestFileCollectionIterator implements Countable, Iterator
{

View File

@@ -17,6 +17,8 @@ use IteratorAggregate;
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @psalm-immutable
*
* @template-implements IteratorAggregate<int, TestSuite>
*/
final class TestSuiteCollection implements Countable, IteratorAggregate
{

View File

@@ -16,6 +16,8 @@ use Iterator;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @template-implements Iterator<int, TestSuite>
*/
final class TestSuiteCollectionIterator implements Countable, Iterator
{

View File

@@ -410,7 +410,7 @@ final class DocBlock
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
// @codeCoverageIgnoreEnd

View File

@@ -58,7 +58,7 @@ final class Registry
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -84,7 +84,7 @@ final class Registry
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -292,7 +292,7 @@ final class JUnit extends Printer implements TestListener
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -307,7 +307,7 @@ final class JUnit extends Printer implements TestListener
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -366,7 +366,7 @@ final class TeamCity extends DefaultResultPrinter
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -659,7 +659,7 @@ final class Test
$mode,
$element
),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -242,7 +242,7 @@ final class NamePrettifier
} catch (ReflectionException $e) {
throw new UtilException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -262,7 +262,7 @@ final class NamePrettifier
} catch (ReflectionException $e) {
throw new UtilException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -239,7 +239,7 @@ final class XmlResultPrinter extends Printer implements TestListener
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -126,7 +126,7 @@ final class Xml
} catch (ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}

View File

@@ -18,6 +18,8 @@ use IteratorAggregate;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @template-implements IteratorAggregate<int, DOMNode>
*/
final class SnapshotNodeList implements Countable, IteratorAggregate
{