www folder composer updates

This commit is contained in:
Clemens Schwaighofer
2023-08-22 13:04:01 +09:00
parent f29e915068
commit 53192da571
189 changed files with 2850 additions and 2364 deletions

49
www/composer.lock generated
View File

@@ -273,16 +273,16 @@
},
{
"name": "nikic/php-parser",
"version": "v4.15.5",
"version": "v4.17.1",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e"
"reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/11e2663a5bc9db5d714eedb4277ee300403b4a9e",
"reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d",
"reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d",
"shasum": ""
},
"require": {
@@ -323,9 +323,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5"
"source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1"
},
"time": "2023-05-19T20:20:00+00:00"
"time": "2023-08-13T19:53:39+00:00"
},
{
"name": "phar-io/manifest",
@@ -440,16 +440,16 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.26",
"version": "9.2.27",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1"
"reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/443bc6912c9bd5b409254a40f4b0f4ced7c80ea1",
"reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b0a88255cb70d52653d80c890bd7f38740ea50d1",
"reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1",
"shasum": ""
},
"require": {
@@ -505,7 +505,8 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26"
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.27"
},
"funding": [
{
@@ -513,7 +514,7 @@
"type": "github"
}
],
"time": "2023-03-06T12:58:08+00:00"
"time": "2023-07-26T13:44:30+00:00"
},
{
"name": "phpunit/php-file-iterator",
@@ -758,16 +759,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.6.8",
"version": "9.6.11",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e"
"reference": "810500e92855eba8a7a5319ae913be2da6f957b0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/17d621b3aff84d0c8b62539e269e87d8d5baa76e",
"reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/810500e92855eba8a7a5319ae913be2da6f957b0",
"reference": "810500e92855eba8a7a5319ae913be2da6f957b0",
"shasum": ""
},
"require": {
@@ -841,7 +842,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.8"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.11"
},
"funding": [
{
@@ -857,7 +858,7 @@
"type": "tidelift"
}
],
"time": "2023-05-11T05:14:45+00:00"
"time": "2023-08-19T07:10:56+00:00"
},
{
"name": "sebastian/cli-parser",
@@ -1365,16 +1366,16 @@
},
{
"name": "sebastian/global-state",
"version": "5.0.5",
"version": "5.0.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2"
"reference": "bde739e7565280bda77be70044ac1047bc007e34"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2",
"reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34",
"reference": "bde739e7565280bda77be70044ac1047bc007e34",
"shasum": ""
},
"require": {
@@ -1417,7 +1418,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues",
"source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5"
"source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6"
},
"funding": [
{
@@ -1425,7 +1426,7 @@
"type": "github"
}
],
"time": "2022-02-14T08:28:10+00:00"
"time": "2023-08-02T09:26:13+00:00"
},
{
"name": "sebastian/lines-of-code",

View File

@@ -139,6 +139,7 @@ return array(
'PHPUnit\\Framework\\Constraint\\LogicalXor' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Operator/LogicalXor.php',
'PHPUnit\\Framework\\Constraint\\ObjectEquals' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Object/ObjectEquals.php',
'PHPUnit\\Framework\\Constraint\\ObjectHasAttribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Object/ObjectHasAttribute.php',
'PHPUnit\\Framework\\Constraint\\ObjectHasProperty' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Object/ObjectHasProperty.php',
'PHPUnit\\Framework\\Constraint\\Operator' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Operator/Operator.php',
'PHPUnit\\Framework\\Constraint\\RegularExpression' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/String/RegularExpression.php',
'PHPUnit\\Framework\\Constraint\\SameSize' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Cardinality/SameSize.php',
@@ -369,8 +370,8 @@ return array(
'PHPUnit\\TextUI\\XmlConfiguration\\Migrator' => $vendorDir . '/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrator.php',
'PHPUnit\\TextUI\\XmlConfiguration\\MoveAttributesFromFilterWhitelistToCoverage' => $vendorDir . '/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromFilterWhitelistToCoverage.php',
'PHPUnit\\TextUI\\XmlConfiguration\\MoveAttributesFromRootToCoverage' => $vendorDir . '/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromRootToCoverage.php',
'PHPUnit\\TextUI\\XmlConfiguration\\MoveWhitelistDirectoriesToCoverage' => $vendorDir . '/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistDirectoriesToCoverage.php',
'PHPUnit\\TextUI\\XmlConfiguration\\MoveWhitelistExcludesToCoverage' => $vendorDir . '/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistExcludesToCoverage.php',
'PHPUnit\\TextUI\\XmlConfiguration\\MoveWhitelistIncludesToCoverage' => $vendorDir . '/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistIncludesToCoverage.php',
'PHPUnit\\TextUI\\XmlConfiguration\\PHPUnit' => $vendorDir . '/phpunit/phpunit/src/TextUI/XmlConfiguration/PHPUnit/PHPUnit.php',
'PHPUnit\\TextUI\\XmlConfiguration\\Php' => $vendorDir . '/phpunit/phpunit/src/TextUI/XmlConfiguration/PHP/Php.php',
'PHPUnit\\TextUI\\XmlConfiguration\\PhpHandler' => $vendorDir . '/phpunit/phpunit/src/TextUI/XmlConfiguration/PHP/PhpHandler.php',
@@ -876,8 +877,8 @@ return array(
'Smarty_Variable' => $vendorDir . '/egrajp/smarty-extended/src/sysplugins/smarty_variable.php',
'TPC_yyStackEntry' => $vendorDir . '/egrajp/smarty-extended/src/sysplugins/smarty_internal_configfileparser.php',
'TP_yyStackEntry' => $vendorDir . '/egrajp/smarty-extended/src/sysplugins/smarty_internal_templateparser.php',
'Test\\DB\\TestDB' => $baseDir . '/lib/Test/DB/TestDB.php',
'Test\\Test' => $baseDir . '/lib/Test/Test.php',
'TestCalls\\DB\\TestDB' => $baseDir . '/lib/Test/DB/TestDB.php',
'TestCalls\\Test' => $baseDir . '/lib/Test/Test.php',
'TheSeer\\Tokenizer\\Exception' => $vendorDir . '/theseer/tokenizer/src/Exception.php',
'TheSeer\\Tokenizer\\NamespaceUri' => $vendorDir . '/theseer/tokenizer/src/NamespaceUri.php',
'TheSeer\\Tokenizer\\NamespaceUriException' => $vendorDir . '/theseer/tokenizer/src/NamespaceUriException.php',

View File

@@ -190,6 +190,7 @@ class ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9
'PHPUnit\\Framework\\Constraint\\LogicalXor' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Operator/LogicalXor.php',
'PHPUnit\\Framework\\Constraint\\ObjectEquals' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Object/ObjectEquals.php',
'PHPUnit\\Framework\\Constraint\\ObjectHasAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Object/ObjectHasAttribute.php',
'PHPUnit\\Framework\\Constraint\\ObjectHasProperty' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Object/ObjectHasProperty.php',
'PHPUnit\\Framework\\Constraint\\Operator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Operator/Operator.php',
'PHPUnit\\Framework\\Constraint\\RegularExpression' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/String/RegularExpression.php',
'PHPUnit\\Framework\\Constraint\\SameSize' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Cardinality/SameSize.php',
@@ -420,8 +421,8 @@ class ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9
'PHPUnit\\TextUI\\XmlConfiguration\\Migrator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrator.php',
'PHPUnit\\TextUI\\XmlConfiguration\\MoveAttributesFromFilterWhitelistToCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromFilterWhitelistToCoverage.php',
'PHPUnit\\TextUI\\XmlConfiguration\\MoveAttributesFromRootToCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromRootToCoverage.php',
'PHPUnit\\TextUI\\XmlConfiguration\\MoveWhitelistDirectoriesToCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistDirectoriesToCoverage.php',
'PHPUnit\\TextUI\\XmlConfiguration\\MoveWhitelistExcludesToCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistExcludesToCoverage.php',
'PHPUnit\\TextUI\\XmlConfiguration\\MoveWhitelistIncludesToCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistIncludesToCoverage.php',
'PHPUnit\\TextUI\\XmlConfiguration\\PHPUnit' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/XmlConfiguration/PHPUnit/PHPUnit.php',
'PHPUnit\\TextUI\\XmlConfiguration\\Php' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/XmlConfiguration/PHP/Php.php',
'PHPUnit\\TextUI\\XmlConfiguration\\PhpHandler' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/XmlConfiguration/PHP/PhpHandler.php',
@@ -927,8 +928,8 @@ class ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9
'Smarty_Variable' => __DIR__ . '/..' . '/egrajp/smarty-extended/src/sysplugins/smarty_variable.php',
'TPC_yyStackEntry' => __DIR__ . '/..' . '/egrajp/smarty-extended/src/sysplugins/smarty_internal_configfileparser.php',
'TP_yyStackEntry' => __DIR__ . '/..' . '/egrajp/smarty-extended/src/sysplugins/smarty_internal_templateparser.php',
'Test\\DB\\TestDB' => __DIR__ . '/../..' . '/lib/Test/DB/TestDB.php',
'Test\\Test' => __DIR__ . '/../..' . '/lib/Test/Test.php',
'TestCalls\\DB\\TestDB' => __DIR__ . '/../..' . '/lib/Test/DB/TestDB.php',
'TestCalls\\Test' => __DIR__ . '/../..' . '/lib/Test/Test.php',
'TheSeer\\Tokenizer\\Exception' => __DIR__ . '/..' . '/theseer/tokenizer/src/Exception.php',
'TheSeer\\Tokenizer\\NamespaceUri' => __DIR__ . '/..' . '/theseer/tokenizer/src/NamespaceUri.php',
'TheSeer\\Tokenizer\\NamespaceUriException' => __DIR__ . '/..' . '/theseer/tokenizer/src/NamespaceUriException.php',

View File

@@ -227,17 +227,17 @@
},
{
"name": "nikic/php-parser",
"version": "v4.15.5",
"version_normalized": "4.15.5.0",
"version": "v4.17.1",
"version_normalized": "4.17.1.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e"
"reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/11e2663a5bc9db5d714eedb4277ee300403b4a9e",
"reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d",
"reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d",
"shasum": ""
},
"require": {
@@ -248,7 +248,7 @@
"ircmaxell/php-yacc": "^0.0.7",
"phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0"
},
"time": "2023-05-19T20:20:00+00:00",
"time": "2023-08-13T19:53:39+00:00",
"bin": [
"bin/php-parse"
],
@@ -280,7 +280,7 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5"
"source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1"
},
"install-path": "../nikic/php-parser"
},
@@ -403,17 +403,17 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.26",
"version_normalized": "9.2.26.0",
"version": "9.2.27",
"version_normalized": "9.2.27.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1"
"reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/443bc6912c9bd5b409254a40f4b0f4ced7c80ea1",
"reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b0a88255cb70d52653d80c890bd7f38740ea50d1",
"reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1",
"shasum": ""
},
"require": {
@@ -438,7 +438,7 @@
"ext-pcov": "PHP extension that provides line coverage",
"ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage"
},
"time": "2023-03-06T12:58:08+00:00",
"time": "2023-07-26T13:44:30+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -471,7 +471,8 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26"
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.27"
},
"funding": [
{
@@ -736,17 +737,17 @@
},
{
"name": "phpunit/phpunit",
"version": "9.6.8",
"version_normalized": "9.6.8.0",
"version": "9.6.11",
"version_normalized": "9.6.11.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e"
"reference": "810500e92855eba8a7a5319ae913be2da6f957b0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/17d621b3aff84d0c8b62539e269e87d8d5baa76e",
"reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/810500e92855eba8a7a5319ae913be2da6f957b0",
"reference": "810500e92855eba8a7a5319ae913be2da6f957b0",
"shasum": ""
},
"require": {
@@ -782,7 +783,7 @@
"ext-soap": "To be able to generate mocks based on WSDL files",
"ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage"
},
"time": "2023-05-11T05:14:45+00:00",
"time": "2023-08-19T07:10:56+00:00",
"bin": [
"phpunit"
],
@@ -822,7 +823,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.8"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.11"
},
"funding": [
{
@@ -1423,17 +1424,17 @@
},
{
"name": "sebastian/global-state",
"version": "5.0.5",
"version_normalized": "5.0.5.0",
"version": "5.0.6",
"version_normalized": "5.0.6.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2"
"reference": "bde739e7565280bda77be70044ac1047bc007e34"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2",
"reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34",
"reference": "bde739e7565280bda77be70044ac1047bc007e34",
"shasum": ""
},
"require": {
@@ -1448,7 +1449,7 @@
"suggest": {
"ext-uopz": "*"
},
"time": "2022-02-14T08:28:10+00:00",
"time": "2023-08-02T09:26:13+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -1478,7 +1479,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues",
"source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5"
"source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6"
},
"funding": [
{

View File

@@ -56,9 +56,9 @@
'dev_requirement' => true,
),
'nikic/php-parser' => array(
'pretty_version' => 'v4.15.5',
'version' => '4.15.5.0',
'reference' => '11e2663a5bc9db5d714eedb4277ee300403b4a9e',
'pretty_version' => 'v4.17.1',
'version' => '4.17.1.0',
'reference' => 'a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d',
'type' => 'library',
'install_path' => __DIR__ . '/../nikic/php-parser',
'aliases' => array(),
@@ -83,9 +83,9 @@
'dev_requirement' => true,
),
'phpunit/php-code-coverage' => array(
'pretty_version' => '9.2.26',
'version' => '9.2.26.0',
'reference' => '443bc6912c9bd5b409254a40f4b0f4ced7c80ea1',
'pretty_version' => '9.2.27',
'version' => '9.2.27.0',
'reference' => 'b0a88255cb70d52653d80c890bd7f38740ea50d1',
'type' => 'library',
'install_path' => __DIR__ . '/../phpunit/php-code-coverage',
'aliases' => array(),
@@ -128,9 +128,9 @@
'dev_requirement' => true,
),
'phpunit/phpunit' => array(
'pretty_version' => '9.6.8',
'version' => '9.6.8.0',
'reference' => '17d621b3aff84d0c8b62539e269e87d8d5baa76e',
'pretty_version' => '9.6.11',
'version' => '9.6.11.0',
'reference' => '810500e92855eba8a7a5319ae913be2da6f957b0',
'type' => 'library',
'install_path' => __DIR__ . '/../phpunit/phpunit',
'aliases' => array(),
@@ -218,9 +218,9 @@
'dev_requirement' => true,
),
'sebastian/global-state' => array(
'pretty_version' => '5.0.5',
'version' => '5.0.5.0',
'reference' => '0ca8db5a5fc9c8646244e629625ac486fa286bf2',
'pretty_version' => '5.0.6',
'version' => '5.0.6.0',
'reference' => 'bde739e7565280bda77be70044ac1047bc007e34',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/global-state',
'aliases' => array(),

View File

@@ -1008,7 +1008,7 @@ array_pair:
| expr { $$ = Expr\ArrayItem[$1, null, false]; }
| expr T_DOUBLE_ARROW ampersand variable { $$ = Expr\ArrayItem[$4, $1, true]; }
| ampersand variable { $$ = Expr\ArrayItem[$2, null, true]; }
| T_ELLIPSIS expr { $$ = Expr\ArrayItem[$2, null, false, attributes(), true]; }
| T_ELLIPSIS expr { $$ = new Expr\ArrayItem($2, null, false, attributes(), true); }
;
encaps_list:

View File

@@ -221,7 +221,10 @@ non_empty_class_const_list:
;
class_const:
identifier_maybe_reserved '=' expr { $$ = Node\Const_[$1, $3]; }
T_STRING '=' expr
{ $$ = Node\Const_[new Node\Identifier($1, stackAttributes(#1)), $3]; }
| semi_reserved '=' expr
{ $$ = Node\Const_[new Node\Identifier($1, stackAttributes(#1)), $3]; }
;
inner_statement_list_ex:
@@ -722,6 +725,9 @@ class_statement:
| optional_attributes method_modifiers T_CONST class_const_list semi
{ $$ = new Stmt\ClassConst($4, $2, attributes(), $1);
$this->checkClassConst($$, #2); }
| optional_attributes method_modifiers T_CONST type_expr class_const_list semi
{ $$ = new Stmt\ClassConst($5, $2, attributes(), $1, $4);
$this->checkClassConst($$, #2); }
| optional_attributes method_modifiers T_FUNCTION optional_ref identifier_maybe_reserved '(' parameter_list ')'
optional_return_type method_body
{ $$ = Stmt\ClassMethod[$5, ['type' => $2, 'byRef' => $4, 'params' => $7, 'returnType' => $9, 'stmts' => $10, 'attrGroups' => $1]];
@@ -943,8 +949,8 @@ expr:
;
anonymous_class:
optional_attributes T_CLASS ctor_arguments extends_from implements_list '{' class_statement_list '}'
{ $$ = array(Stmt\Class_[null, ['type' => 0, 'extends' => $4, 'implements' => $5, 'stmts' => $7, 'attrGroups' => $1]], $3);
optional_attributes class_entry_type ctor_arguments extends_from implements_list '{' class_statement_list '}'
{ $$ = array(Stmt\Class_[null, ['type' => $2, 'extends' => $4, 'implements' => $5, 'stmts' => $7, 'attrGroups' => $1]], $3);
$this->checkClass($$[0], -1); }
;
@@ -1040,6 +1046,8 @@ constant:
class_constant:
class_name_or_var T_PAAMAYIM_NEKUDOTAYIM identifier_maybe_reserved
{ $$ = Expr\ClassConstFetch[$1, $3]; }
| class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '{' expr '}'
{ $$ = Expr\ClassConstFetch[$1, $4]; }
/* We interpret an isolated FOO:: as an unfinished class constant fetch. It could also be
an unfinished static property fetch or unfinished scoped call. */
| class_name_or_var T_PAAMAYIM_NEKUDOTAYIM error
@@ -1194,7 +1202,7 @@ array_pair:
| expr T_DOUBLE_ARROW expr { $$ = Expr\ArrayItem[$3, $1, false]; }
| expr T_DOUBLE_ARROW ampersand variable { $$ = Expr\ArrayItem[$4, $1, true]; }
| expr T_DOUBLE_ARROW list_expr { $$ = Expr\ArrayItem[$3, $1, false]; }
| T_ELLIPSIS expr { $$ = Expr\ArrayItem[$2, null, false, attributes(), true]; }
| T_ELLIPSIS expr { $$ = new Expr\ArrayItem($2, null, false, attributes(), true); }
| /* empty */ { $$ = null; }
;

View File

@@ -19,6 +19,8 @@ class ClassConst implements PhpParser\Builder
/** @var Node\AttributeGroup[] */
protected $attributeGroups = [];
/** @var Identifier|Node\Name|Node\ComplexType */
protected $type;
/**
* Creates a class constant builder
@@ -116,6 +118,19 @@ class ClassConst implements PhpParser\Builder
return $this;
}
/**
* Sets the constant type.
*
* @param string|Node\Name|Identifier|Node\ComplexType $type
*
* @return $this
*/
public function setType($type) {
$this->type = BuilderHelpers::normalizeType($type);
return $this;
}
/**
* Returns the built class node.
*
@@ -126,7 +141,8 @@ class ClassConst implements PhpParser\Builder
$this->constants,
$this->flags,
$this->attributes,
$this->attributeGroups
$this->attributeGroups,
$this->type
);
}
}

View File

@@ -349,15 +349,15 @@ class BuilderFactory
/**
* Creates a class constant fetch node.
*
* @param string|Name|Expr $class Class name
* @param string|Identifier $name Constant name
* @param string|Name|Expr $class Class name
* @param string|Identifier|Expr $name Constant name
*
* @return Expr\ClassConstFetch
*/
public function classConstFetch($class, $name): Expr\ClassConstFetch {
return new Expr\ClassConstFetch(
BuilderHelpers::normalizeNameOrExpr($class),
BuilderHelpers::normalizeIdentifier($name)
BuilderHelpers::normalizeIdentifierOrExpr($name)
);
}

View File

@@ -19,6 +19,8 @@ class PrintableNewAnonClassNode extends Expr
{
/** @var Node\AttributeGroup[] PHP attribute groups */
public $attrGroups;
/** @var int Modifiers */
public $flags;
/** @var Node\Arg[] Arguments */
public $args;
/** @var null|Node\Name Name of extended class */
@@ -29,11 +31,12 @@ class PrintableNewAnonClassNode extends Expr
public $stmts;
public function __construct(
array $attrGroups, array $args, Node\Name $extends = null, array $implements,
array $attrGroups, int $flags, array $args, Node\Name $extends = null, array $implements,
array $stmts, array $attributes
) {
parent::__construct($attributes);
$this->attrGroups = $attrGroups;
$this->flags = $flags;
$this->args = $args;
$this->extends = $extends;
$this->implements = $implements;
@@ -46,7 +49,7 @@ class PrintableNewAnonClassNode extends Expr
// We don't assert that $class->name is null here, to allow consumers to assign unique names
// to anonymous classes for their own purposes. We simplify ignore the name here.
return new self(
$class->attrGroups, $newNode->args, $class->extends, $class->implements,
$class->attrGroups, $class->flags, $newNode->args, $class->extends, $class->implements,
$class->stmts, $newNode->getAttributes()
);
}
@@ -56,6 +59,6 @@ class PrintableNewAnonClassNode extends Expr
}
public function getSubNodeNames() : array {
return ['attrGroups', 'args', 'extends', 'implements', 'stmts'];
return ['attrGroups', 'flags', 'args', 'extends', 'implements', 'stmts'];
}
}

View File

@@ -10,15 +10,15 @@ class ClassConstFetch extends Expr
{
/** @var Name|Expr Class name */
public $class;
/** @var Identifier|Error Constant name */
/** @var Identifier|Expr|Error Constant name */
public $name;
/**
* Constructs a class const fetch node.
*
* @param Name|Expr $class Class name
* @param string|Identifier|Error $name Constant name
* @param array $attributes Additional attributes
* @param Name|Expr $class Class name
* @param string|Identifier|Expr|Error $name Constant name
* @param array $attributes Additional attributes
*/
public function __construct($class, $name, array $attributes = []) {
$this->attributes = $attributes;
@@ -29,7 +29,7 @@ class ClassConstFetch extends Expr
public function getSubNodeNames() : array {
return ['class', 'name'];
}
public function getType() : string {
return 'Expr_ClassConstFetch';
}

View File

@@ -6,7 +6,10 @@ use PhpParser\NodeAbstract;
class Name extends NodeAbstract
{
/** @var string[] Parts of the name */
/**
* @var string[] Parts of the name
* @deprecated Use getParts() instead
*/
public $parts;
private static $specialClassNames = [
@@ -30,6 +33,15 @@ class Name extends NodeAbstract
return ['parts'];
}
/**
* Get parts of name (split by the namespace separator).
*
* @return string[] Parts of name
*/
public function getParts(): array {
return $this->parts;
}
/**
* Gets the first part of the name, i.e. everything before the first namespace separator.
*

View File

@@ -10,31 +10,36 @@ class ClassConst extends Node\Stmt
public $flags;
/** @var Node\Const_[] Constant declarations */
public $consts;
/** @var Node\AttributeGroup[] */
/** @var Node\AttributeGroup[] PHP attribute groups */
public $attrGroups;
/** @var Node\Identifier|Node\Name|Node\ComplexType|null Type declaration */
public $type;
/**
* Constructs a class const list node.
*
* @param Node\Const_[] $consts Constant declarations
* @param int $flags Modifiers
* @param array $attributes Additional attributes
* @param Node\AttributeGroup[] $attrGroups PHP attribute groups
* @param Node\Const_[] $consts Constant declarations
* @param int $flags Modifiers
* @param array $attributes Additional attributes
* @param Node\AttributeGroup[] $attrGroups PHP attribute groups
* @param null|string|Node\Identifier|Node\Name|Node\ComplexType $type Type declaration
*/
public function __construct(
array $consts,
int $flags = 0,
array $attributes = [],
array $attrGroups = []
array $attrGroups = [],
$type = null
) {
$this->attributes = $attributes;
$this->flags = $flags;
$this->consts = $consts;
$this->attrGroups = $attrGroups;
$this->type = \is_string($type) ? new Node\Identifier($type) : $type;
}
public function getSubNodeNames() : array {
return ['attrGroups', 'flags', 'consts'];
return ['attrGroups', 'flags', 'type', 'consts'];
}
/**

View File

@@ -2627,7 +2627,7 @@ class Php5 extends \PhpParser\ParserAbstract
$this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes);
},
552 => function ($stackPos) {
$this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes);
$this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, true);
},
553 => function ($stackPos) {
$this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)];

File diff suppressed because it is too large Load Diff

View File

@@ -529,7 +529,7 @@ class Standard extends PrettyPrinterAbstract
}
protected function pExpr_StaticCall(Expr\StaticCall $node) {
return $this->pDereferenceLhs($node->class) . '::'
return $this->pStaticDereferenceLhs($node->class) . '::'
. ($node->name instanceof Expr
? ($node->name instanceof Expr\Variable
? $this->p($node->name)
@@ -606,7 +606,7 @@ class Standard extends PrettyPrinterAbstract
}
protected function pExpr_ClassConstFetch(Expr\ClassConstFetch $node) {
return $this->pDereferenceLhs($node->class) . '::' . $this->p($node->name);
return $this->pStaticDereferenceLhs($node->class) . '::' . $this->pObjectProperty($node->name);
}
protected function pExpr_PropertyFetch(Expr\PropertyFetch $node) {
@@ -618,7 +618,7 @@ class Standard extends PrettyPrinterAbstract
}
protected function pExpr_StaticPropertyFetch(Expr\StaticPropertyFetch $node) {
return $this->pDereferenceLhs($node->class) . '::$' . $this->pObjectProperty($node->name);
return $this->pStaticDereferenceLhs($node->class) . '::$' . $this->pObjectProperty($node->name);
}
protected function pExpr_ShellExec(Expr\ShellExec $node) {
@@ -814,7 +814,9 @@ class Standard extends PrettyPrinterAbstract
protected function pStmt_ClassConst(Stmt\ClassConst $node) {
return $this->pAttrGroups($node->attrGroups)
. $this->pModifiers($node->flags)
. 'const ' . $this->pCommaSeparated($node->consts) . ';';
. 'const '
. (null !== $node->type ? $this->p($node->type) . ' ' : '')
. $this->pCommaSeparated($node->consts) . ';';
}
protected function pStmt_Function(Stmt\Function_ $node) {
@@ -1067,6 +1069,14 @@ class Standard extends PrettyPrinterAbstract
}
}
protected function pStaticDereferenceLhs(Node $node) {
if (!$this->staticDereferenceLhsRequiresParens($node)) {
return $this->p($node);
} else {
return '(' . $this->p($node) . ')';
}
}
protected function pCallLhs(Node $node) {
if (!$this->callLhsRequiresParens($node)) {
return $this->p($node);
@@ -1075,9 +1085,12 @@ class Standard extends PrettyPrinterAbstract
}
}
protected function pNewVariable(Node $node) {
// TODO: This is not fully accurate.
return $this->pDereferenceLhs($node);
protected function pNewVariable(Node $node): string {
if (!$this->newOperandRequiresParens($node)) {
return $this->p($node);
} else {
return '(' . $this->p($node) . ')';
}
}
/**

View File

@@ -21,6 +21,8 @@ abstract class PrettyPrinterAbstract
const FIXUP_BRACED_NAME = 4; // Name operand that may require bracing
const FIXUP_VAR_BRACED_NAME = 5; // Name operand that may require ${} bracing
const FIXUP_ENCAPSED = 6; // Encapsed string part
const FIXUP_NEW = 7; // New/instanceof operand
const FIXUP_STATIC_DEREF_LHS = 8; // LHS of static dereferencing operation
protected $precedenceMap = [
// [precedence, associativity]
@@ -977,6 +979,19 @@ abstract class PrettyPrinterAbstract
return '(' . $this->p($subNode) . ')';
}
break;
case self::FIXUP_STATIC_DEREF_LHS:
if ($this->staticDereferenceLhsRequiresParens($subNode)
&& !$this->origTokens->haveParens($subStartPos, $subEndPos)
) {
return '(' . $this->p($subNode) . ')';
}
break;
case self::FIXUP_NEW:
if ($this->newOperandRequiresParens($subNode)
&& !$this->origTokens->haveParens($subStartPos, $subEndPos)) {
return '(' . $this->p($subNode) . ')';
}
break;
case self::FIXUP_BRACED_NAME:
case self::FIXUP_VAR_BRACED_NAME:
if ($subNode instanceof Expr
@@ -1047,13 +1062,26 @@ abstract class PrettyPrinterAbstract
}
/**
* Determines whether the LHS of a dereferencing operation must be wrapped in parenthesis.
* Determines whether the LHS of an array/object operation must be wrapped in parentheses.
*
* @param Node $node LHS of dereferencing operation
*
* @return bool Whether parentheses are required
*/
protected function dereferenceLhsRequiresParens(Node $node) : bool {
// A constant can occur on the LHS of an array/object deref, but not a static deref.
return $this->staticDereferenceLhsRequiresParens($node)
&& !$node instanceof Expr\ConstFetch;
}
/**
* Determines whether the LHS of a static operation must be wrapped in parentheses.
*
* @param Node $node LHS of dereferencing operation
*
* @return bool Whether parentheses are required
*/
protected function staticDereferenceLhsRequiresParens(Node $node): bool {
return !($node instanceof Expr\Variable
|| $node instanceof Node\Name
|| $node instanceof Expr\ArrayDimFetch
@@ -1066,10 +1094,31 @@ abstract class PrettyPrinterAbstract
|| $node instanceof Expr\StaticCall
|| $node instanceof Expr\Array_
|| $node instanceof Scalar\String_
|| $node instanceof Expr\ConstFetch
|| $node instanceof Expr\ClassConstFetch);
}
/**
* Determines whether an expression used in "new" or "instanceof" requires parentheses.
*
* @param Node $node New or instanceof operand
*
* @return bool Whether parentheses are required
*/
protected function newOperandRequiresParens(Node $node): bool {
if ($node instanceof Node\Name || $node instanceof Expr\Variable) {
return false;
}
if ($node instanceof Expr\ArrayDimFetch || $node instanceof Expr\PropertyFetch ||
$node instanceof Expr\NullsafePropertyFetch
) {
return $this->newOperandRequiresParens($node->var);
}
if ($node instanceof Expr\StaticPropertyFetch) {
return $this->newOperandRequiresParens($node->class);
}
return true;
}
/**
* Print modifiers, including trailing whitespace.
*
@@ -1171,7 +1220,7 @@ abstract class PrettyPrinterAbstract
Expr\PostDec::class => ['var' => self::FIXUP_PREC_LEFT],
Expr\Instanceof_::class => [
'expr' => self::FIXUP_PREC_LEFT,
'class' => self::FIXUP_PREC_RIGHT, // TODO: FIXUP_NEW_VARIABLE
'class' => self::FIXUP_NEW,
],
Expr\Ternary::class => [
'cond' => self::FIXUP_PREC_LEFT,
@@ -1179,10 +1228,13 @@ abstract class PrettyPrinterAbstract
],
Expr\FuncCall::class => ['name' => self::FIXUP_CALL_LHS],
Expr\StaticCall::class => ['class' => self::FIXUP_DEREF_LHS],
Expr\StaticCall::class => ['class' => self::FIXUP_STATIC_DEREF_LHS],
Expr\ArrayDimFetch::class => ['var' => self::FIXUP_DEREF_LHS],
Expr\ClassConstFetch::class => ['var' => self::FIXUP_DEREF_LHS],
Expr\New_::class => ['class' => self::FIXUP_DEREF_LHS], // TODO: FIXUP_NEW_VARIABLE
Expr\ClassConstFetch::class => [
'class' => self::FIXUP_STATIC_DEREF_LHS,
'name' => self::FIXUP_BRACED_NAME,
],
Expr\New_::class => ['class' => self::FIXUP_NEW],
Expr\MethodCall::class => [
'var' => self::FIXUP_DEREF_LHS,
'name' => self::FIXUP_BRACED_NAME,
@@ -1192,7 +1244,7 @@ abstract class PrettyPrinterAbstract
'name' => self::FIXUP_BRACED_NAME,
],
Expr\StaticPropertyFetch::class => [
'class' => self::FIXUP_DEREF_LHS,
'class' => self::FIXUP_STATIC_DEREF_LHS,
'name' => self::FIXUP_VAR_BRACED_NAME,
],
Expr\PropertyFetch::class => [
@@ -1278,6 +1330,7 @@ abstract class PrettyPrinterAbstract
'Param->default' => $stripEquals,
'Stmt_Break->num' => $stripBoth,
'Stmt_Catch->var' => $stripLeft,
'Stmt_ClassConst->type' => $stripRight,
'Stmt_ClassMethod->returnType' => $stripColon,
'Stmt_Class->extends' => ['left' => \T_EXTENDS],
'Stmt_Enum->scalarType' => $stripColon,
@@ -1319,6 +1372,7 @@ abstract class PrettyPrinterAbstract
'Stmt_Break->num' => [\T_BREAK, false, ' ', null],
'Stmt_Catch->var' => [null, false, ' ', null],
'Stmt_ClassMethod->returnType' => [')', false, ' : ', null],
'Stmt_ClassConst->type' => [\T_CONST, false, ' ', null],
'Stmt_Class->extends' => [null, false, ' extends ', null],
'Stmt_Enum->scalarType' => [null, false, ' : ', null],
'Stmt_EnumCase->expr' => [null, false, ' = ', null],
@@ -1508,6 +1562,7 @@ abstract class PrettyPrinterAbstract
'Stmt_ClassMethod->flags' => \T_FUNCTION,
'Stmt_Class->flags' => \T_CLASS,
'Stmt_Property->flags' => \T_VARIABLE,
'Expr_PrintableNewAnonClass->flags' => \T_CLASS,
'Param->flags' => \T_VARIABLE,
//'Stmt_TraitUseAdaptation_Alias->newModifier' => 0, // TODO
];

View File

@@ -2,6 +2,17 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [9.2.27] - 2023-07-26
### Changed
* The result of `CodeCoverage::getReport()` is now cached
### Fixed
* Static analysis cache keys do not include configuration settings that affect source code parsing
* The Clover, Cobertura, Crap4j, and PHP report writers no longer create a `php:` directory when they should write to `php://stdout`, for instance
## [9.2.26] - 2023-03-06
### Changed
@@ -476,6 +487,7 @@ 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.27]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.26...9.2.27
[9.2.26]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.25...9.2.26
[9.2.25]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.24...9.2.25
[9.2.24]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.23...9.2.24

View File

@@ -17,7 +17,8 @@
}
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues"
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy"
},
"config": {
"platform": {

View File

@@ -114,6 +114,11 @@ final class CodeCoverage
*/
private $cacheDirectory;
/**
* @var ?Directory
*/
private $cachedReport;
public function __construct(Driver $driver, Filter $filter)
{
$this->driver = $driver;
@@ -127,7 +132,11 @@ final class CodeCoverage
*/
public function getReport(): Directory
{
return (new Builder($this->analyser()))->build($this);
if ($this->cachedReport === null) {
$this->cachedReport = (new Builder($this->analyser()))->build($this);
}
return $this->cachedReport;
}
/**
@@ -135,9 +144,10 @@ final class CodeCoverage
*/
public function clear(): void
{
$this->currentId = null;
$this->data = new ProcessedCodeCoverageData;
$this->tests = [];
$this->currentId = null;
$this->data = new ProcessedCodeCoverageData;
$this->tests = [];
$this->cachedReport = null;
}
/**
@@ -202,6 +212,8 @@ final class CodeCoverage
$this->currentId = $id;
$this->driver->start();
$this->cachedReport = null;
}
/**
@@ -220,7 +232,8 @@ final class CodeCoverage
$data = $this->driver->stop();
$this->append($data, null, $append, $linesToBeCovered, $linesToBeUsed);
$this->currentId = null;
$this->currentId = null;
$this->cachedReport = null;
return $data;
}
@@ -245,6 +258,8 @@ final class CodeCoverage
throw new TestIdMissingException;
}
$this->cachedReport = null;
$this->applyFilter($rawData);
$this->applyExecutableLinesFilter($rawData);
@@ -312,6 +327,8 @@ final class CodeCoverage
$this->data->merge($that->data);
$this->tests = array_merge($this->tests, $that->getTests());
$this->cachedReport = null;
}
public function enableCheckForUnintentionallyCoveredCode(): void
@@ -673,7 +690,9 @@ final class CodeCoverage
if ($this->cachesStaticAnalysis()) {
$this->analyser = new CachingFileAnalyser(
$this->cacheDirectory,
$this->analyser
$this->analyser,
$this->useAnnotationsForIgnoringCode,
$this->ignoreDeprecatedCode
);
}

View File

@@ -16,6 +16,7 @@ use function is_string;
use function ksort;
use function max;
use function range;
use function strpos;
use function time;
use DOMDocument;
use SebastianBergmann\CodeCoverage\CodeCoverage;
@@ -243,7 +244,9 @@ final class Clover
$buffer = $xmlDocument->saveXML();
if ($target !== null) {
Filesystem::createDirectory(dirname($target));
if (!strpos($target, '://') !== false) {
Filesystem::createDirectory(dirname($target));
}
if (@file_put_contents($target, $buffer) === false) {
throw new WriteOperationFailedException($target);

View File

@@ -16,6 +16,7 @@ use function file_put_contents;
use function preg_match;
use function range;
use function str_replace;
use function strpos;
use function time;
use DOMImplementation;
use SebastianBergmann\CodeCoverage\CodeCoverage;
@@ -294,7 +295,9 @@ final class Cobertura
$buffer = $document->saveXML();
if ($target !== null) {
Filesystem::createDirectory(dirname($target));
if (!strpos($target, '://') !== false) {
Filesystem::createDirectory(dirname($target));
}
if (@file_put_contents($target, $buffer) === false) {
throw new WriteOperationFailedException($target);

View File

@@ -15,6 +15,7 @@ use function file_put_contents;
use function htmlspecialchars;
use function is_string;
use function round;
use function strpos;
use DOMDocument;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException;
@@ -124,7 +125,9 @@ final class Crap4j
$buffer = $document->saveXML();
if ($target !== null) {
Filesystem::createDirectory(dirname($target));
if (!strpos($target, '://') !== false) {
Filesystem::createDirectory(dirname($target));
}
if (@file_put_contents($target, $buffer) === false) {
throw new WriteOperationFailedException($target);

View File

@@ -12,6 +12,7 @@ namespace SebastianBergmann\CodeCoverage\Report;
use function dirname;
use function file_put_contents;
use function serialize;
use function strpos;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException;
use SebastianBergmann\CodeCoverage\Util\Filesystem;
@@ -24,7 +25,9 @@ final class 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));
if (!strpos($target, '://') !== false) {
Filesystem::createDirectory(dirname($target));
}
if (@file_put_contents($target, $buffer) === false) {
throw new WriteOperationFailedException($target);

View File

@@ -17,7 +17,6 @@ use DOMElement;
final class Tests
{
private $contextNode;
private $codeMap = [
-1 => 'UNKNOWN', // PHPUnit_Runner_BaseTestRunner::STATUS_UNKNOWN
0 => 'PASSED', // PHPUnit_Runner_BaseTestRunner::STATUS_PASSED

View File

@@ -20,7 +20,9 @@ final class CacheWarmer
new ParsingFileAnalyser(
$useAnnotationsForIgnoringCode,
$ignoreDeprecatedCode
)
),
$useAnnotationsForIgnoringCode,
$ignoreDeprecatedCode,
);
foreach ($filter->files() as $file) {

View File

@@ -29,27 +29,39 @@ final class CachingFileAnalyser implements FileAnalyser
*/
private static $cacheVersion;
/**
* @var string
*/
private $directory;
/**
* @var FileAnalyser
*/
private $analyser;
/**
* @var bool
*/
private $useAnnotationsForIgnoringCode;
/**
* @var bool
*/
private $ignoreDeprecatedCode;
/**
* @var array
*/
private $cache = [];
/**
* @var string
*/
private $directory;
public function __construct(string $directory, FileAnalyser $analyser)
public function __construct(string $directory, FileAnalyser $analyser, bool $useAnnotationsForIgnoringCode, bool $ignoreDeprecatedCode)
{
Filesystem::createDirectory($directory);
$this->analyser = $analyser;
$this->directory = $directory;
$this->analyser = $analyser;
$this->directory = $directory;
$this->useAnnotationsForIgnoringCode = $useAnnotationsForIgnoringCode;
$this->ignoreDeprecatedCode = $ignoreDeprecatedCode;
}
public function classesIn(string $filename): array
@@ -161,7 +173,20 @@ final class CachingFileAnalyser implements FileAnalyser
private function cacheFile(string $filename): string
{
return $this->directory . DIRECTORY_SEPARATOR . md5($filename . "\0" . file_get_contents($filename) . "\0" . self::cacheVersion());
$cacheKey = md5(
implode(
"\0",
[
$filename,
file_get_contents($filename),
self::cacheVersion(),
$this->useAnnotationsForIgnoringCode,
$this->ignoreDeprecatedCode,
]
)
);
return $this->directory . DIRECTORY_SEPARATOR . $cacheKey;
}
private static function cacheVersion(): string

View File

@@ -101,6 +101,7 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
$node instanceof Node\Stmt\Else_ ||
$node instanceof Node\Stmt\EnumCase ||
$node instanceof Node\Stmt\Finally_ ||
$node instanceof Node\Stmt\GroupUse ||
$node instanceof Node\Stmt\Label ||
$node instanceof Node\Stmt\Namespace_ ||
$node instanceof Node\Stmt\Nop ||

View File

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

View File

@@ -2,6 +2,25 @@
All notable changes of the PHPUnit 9.6 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
## [9.6.11] - 2023-08-19
### Added
* [#5478](https://github.com/sebastianbergmann/phpunit/pull/5478): `assertObjectHasProperty()` and `assertObjectNotHasProperty()`
## [9.6.10] - 2023-07-10
### Changed
* [#5419](https://github.com/sebastianbergmann/phpunit/pull/5419): Allow empty `<extensions>` element in XML configuration
## [9.6.9] - 2023-06-11
### Fixed
* [#5405](https://github.com/sebastianbergmann/phpunit/issues/5405): XML configuration migration does not migrate `whitelist/file` elements
* Always use `X.Y.Z` version number (and not just `X.Y`) of PHPUnit's version when checking whether a PHAR-distributed extension is compatible
## [9.6.8] - 2023-05-11
### Fixed
@@ -64,6 +83,9 @@ All notable changes of the PHPUnit 9.6 release series are documented in this fil
* [#5064](https://github.com/sebastianbergmann/phpunit/issues/5064): Deprecate `PHPUnit\Framework\TestCase::getMockClass()`
* [#5132](https://github.com/sebastianbergmann/phpunit/issues/5132): Deprecate `Test` suffix for abstract test case classes
[9.6.11]: https://github.com/sebastianbergmann/phpunit/compare/9.6.10...9.6.11
[9.6.10]: https://github.com/sebastianbergmann/phpunit/compare/9.6.9...9.6.10
[9.6.9]: https://github.com/sebastianbergmann/phpunit/compare/9.6.8...9.6.9
[9.6.8]: https://github.com/sebastianbergmann/phpunit/compare/9.6.7...9.6.8
[9.6.7]: https://github.com/sebastianbergmann/phpunit/compare/9.6.6...9.6.7
[9.6.6]: https://github.com/sebastianbergmann/phpunit/compare/9.6.5...9.6.6

View File

@@ -0,0 +1,79 @@
# Deprecations
## Soft Deprecations
This functionality is currently [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation):
### Writing Tests
#### Test Double API
* [#3687](https://github.com/sebastianbergmann/phpunit/issues/3687): `MockBuilder::setMethods()` (since PHPUnit 8.3.0)
* [#3687](https://github.com/sebastianbergmann/phpunit/issues/3687): `MockBuilder::setMethodsExcept()` (since PHPUnit 9.6.0)
## Hard Deprecations
This functionality is currently [hard-deprecated](https://phpunit.de/backward-compatibility.html#hard-deprecation):
### Writing Tests
#### Assertions, Constraints, and Expectations
* [#4062](https://github.com/sebastianbergmann/phpunit/issues/4062): `TestCase::assertNotIsReadable()` (since PHPUnit 9.1.0)
* [#4065](https://github.com/sebastianbergmann/phpunit/issues/4065): `TestCase::assertNotIsWritable()` (since PHPUnit 9.1.0)
* [#4068](https://github.com/sebastianbergmann/phpunit/issues/4068): `TestCase::assertDirectoryNotExists()` (since PHPUnit 9.1.0)
* [#4071](https://github.com/sebastianbergmann/phpunit/issues/4071): `TestCase::assertDirectoryNotIsReadable()` (since PHPUnit 9.1.0)
* [#4074](https://github.com/sebastianbergmann/phpunit/issues/4074): `TestCase::assertDirectoryNotIsWritable()` (since PHPUnit 9.1.0)
* [#4077](https://github.com/sebastianbergmann/phpunit/issues/4077): `TestCase::assertFileNotExists()` (since PHPUnit 9.1.0)
* [#4080](https://github.com/sebastianbergmann/phpunit/issues/4080): `TestCase::assertFileNotIsReadable()` (since PHPUnit 9.1.0)
* [#4083](https://github.com/sebastianbergmann/phpunit/issues/4083): `TestCase::assertFileNotIsWritable()` (since PHPUnit 9.1.0)
* [#4086](https://github.com/sebastianbergmann/phpunit/issues/4086): `TestCase::assertRegExp()` (since PHPUnit 9.1.0)
* [#4089](https://github.com/sebastianbergmann/phpunit/issues/4089): `TestCase::assertNotRegExp()` (since PHPUnit 9.1.0)
* [#4091](https://github.com/sebastianbergmann/phpunit/issues/4091): `TestCase::assertEqualXMLStructure()` (since PHPUnit 9.1.0)
* [#4601](https://github.com/sebastianbergmann/phpunit/issues/4601): `TestCase::assertClassHasAttribute()` (since PHPUnit 9.6.1)
* [#4601](https://github.com/sebastianbergmann/phpunit/issues/4601): `TestCase::assertClassNotHasAttribute()` (since PHPUnit 9.6.1)
* [#4601](https://github.com/sebastianbergmann/phpunit/issues/4601): `TestCase::assertClassHasStaticAttribute()` (since PHPUnit 9.6.1)
* [#4601](https://github.com/sebastianbergmann/phpunit/issues/4601): `TestCase::assertClassNotHasStaticAttribute()` (since PHPUnit 9.6.1)
* [#4601](https://github.com/sebastianbergmann/phpunit/issues/4601): `TestCase::assertObjectHasAttribute()` (since PHPUnit 9.6.1)
* [#4601](https://github.com/sebastianbergmann/phpunit/issues/4601): `TestCase::assertObjectNotHasAttribute()` (since PHPUnit 9.6.1)
* [#4601](https://github.com/sebastianbergmann/phpunit/issues/4601): `TestCase::classHasAttribute()` (since PHPUnit 9.6.1)
* [#4601](https://github.com/sebastianbergmann/phpunit/issues/4601): `TestCase::classHasStaticAttribute()` (since PHPUnit 9.6.1)
* [#4601](https://github.com/sebastianbergmann/phpunit/issues/4601): `TestCase::objectHasAttribute()` (since PHPUnit 9.6.1)
* [#4601](https://github.com/sebastianbergmann/phpunit/issues/4601): `ClassHasAttribute` (since PHPUnit 9.6.1)
* [#4601](https://github.com/sebastianbergmann/phpunit/issues/4601): `ClassHasStaticAttribute` (since PHPUnit 9.6.1)
* [#4601](https://github.com/sebastianbergmann/phpunit/issues/4601): `ObjectHasAttribute` (since PHPUnit 9.6.1)
* [#5062](https://github.com/sebastianbergmann/phpunit/issues/5062): `TestCase::expectDeprecation()` (since PHPUnit 9.6.0)
* [#5062](https://github.com/sebastianbergmann/phpunit/issues/5062): `TestCase::expectDeprecationMessage()` (since PHPUnit 9.6.0)
* [#5062](https://github.com/sebastianbergmann/phpunit/issues/5062): `TestCase::expectDeprecationMessageMatches()` (since PHPUnit 9.6.0)
* [#5062](https://github.com/sebastianbergmann/phpunit/issues/5062): `TestCase::expectError()` (since PHPUnit 9.6.0)
* [#5062](https://github.com/sebastianbergmann/phpunit/issues/5062): `TestCase::expectErrorMessage()` (since PHPUnit 9.6.0)
* [#5062](https://github.com/sebastianbergmann/phpunit/issues/5062): `TestCase::expectErrorMessageMatches()` (since PHPUnit 9.6.0)
* [#5062](https://github.com/sebastianbergmann/phpunit/issues/5062): `TestCase::expectNotice()` (since PHPUnit 9.6.0)
* [#5062](https://github.com/sebastianbergmann/phpunit/issues/5062): `TestCase::expectNoticeMessage()` (since PHPUnit 9.6.0)
* [#5062](https://github.com/sebastianbergmann/phpunit/issues/5062): `TestCase::expectNoticeMessageMatches()` (since PHPUnit 9.6.0)
* [#5062](https://github.com/sebastianbergmann/phpunit/issues/5062): `TestCase::expectWarning()` (since PHPUnit 9.6.0)
* [#5062](https://github.com/sebastianbergmann/phpunit/issues/5062): `TestCase::expectWarningMessage()` (since PHPUnit 9.6.0)
* [#5062](https://github.com/sebastianbergmann/phpunit/issues/5062): `TestCase::expectWarningMessageMatches()` (since PHPUnit 9.6.0)
#### Test Double API
* [#4141](https://github.com/sebastianbergmann/phpunit/issues/4141): `TestCase::prophesize()` (since PHPUnit 9.1.0)
* [#4297](https://github.com/sebastianbergmann/phpunit/issues/4297): `TestCase::at()` (since PHPUnit 9.3.0)
* [#4297](https://github.com/sebastianbergmann/phpunit/issues/4297): `InvokedAtIndex` (since PHPUnit 9.3.0)
* [#5063](https://github.com/sebastianbergmann/phpunit/issues/5063): `InvocationMocker::withConsecutive()` (since PHPUnit 9.6.0)
* [#5063](https://github.com/sebastianbergmann/phpunit/issues/5063): `ConsecutiveParameters` (since PHPUnit 9.6.0)
* [#5064](https://github.com/sebastianbergmann/phpunit/issues/5064): `TestCase::getMockClass()` (since PHPUnit 9.6.0)
#### Miscellaneous
* [#5132](https://github.com/sebastianbergmann/phpunit/issues/5132): `Test` suffix for abstract test case classes
* `TestCase::$backupGlobalsBlacklist` (since PHPUnit 9.3.0)
* `TestCase::$backupStaticAttributesBlacklist` (since PHPUnit 9.3.0)
### Extending PHPUnit
* [#4039](https://github.com/sebastianbergmann/phpunit/issues/4039): `Command::handleLoader()` (since PHPUnit 9.1.0)
* [#4039](https://github.com/sebastianbergmann/phpunit/issues/4039): `TestSuiteLoader` (since PHPUnit 9.1.0)
* [#4039](https://github.com/sebastianbergmann/phpunit/issues/4039): `StandardTestSuiteLoader` (since PHPUnit 9.1.0)
* [#4676](https://github.com/sebastianbergmann/phpunit/issues/4676): `TestListener` (since PHPUnit 8.0.0)
* [#4676](https://github.com/sebastianbergmann/phpunit/issues/4676): `TestListenerDefaultImplementation` (since PHPUnit 8.2.4)

View File

@@ -25,7 +25,7 @@ Alternatively, you may use [Composer](https://getcomposer.org/) to download and
## Contribute
Please refer to [CONTRIBUTING.md](https://github.com/sebastianbergmann/phpunit/blob/master/.github/CONTRIBUTING.md) for information on how to contribute to PHPUnit and its related projects.
Please refer to [CONTRIBUTING.md](https://github.com/sebastianbergmann/phpunit/blob/main/.github/CONTRIBUTING.md) for information on how to contribute to PHPUnit and its related projects.
## List of Contributors

View File

@@ -57,7 +57,7 @@
</xs:complexType>
<xs:complexType name="extensionsType">
<xs:sequence>
<xs:element name="extension" type="objectType" maxOccurs="unbounded"/>
<xs:element name="extension" type="objectType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="listenersType">

View File

@@ -73,6 +73,7 @@ use PHPUnit\Framework\Constraint\LogicalOr;
use PHPUnit\Framework\Constraint\LogicalXor;
use PHPUnit\Framework\Constraint\ObjectEquals;
use PHPUnit\Framework\Constraint\ObjectHasAttribute;
use PHPUnit\Framework\Constraint\ObjectHasProperty;
use PHPUnit\Framework\Constraint\RegularExpression;
use PHPUnit\Framework\Constraint\SameSize;
use PHPUnit\Framework\Constraint\StringContains;
@@ -111,14 +112,14 @@ abstract class Assert
if (!(is_int($key) || is_string($key))) {
throw InvalidArgumentException::create(
1,
'integer or string'
'integer or string',
);
}
if (!(is_array($array) || $array instanceof ArrayAccess)) {
throw InvalidArgumentException::create(
2,
'array or ArrayAccess'
'array or ArrayAccess',
);
}
@@ -142,19 +143,19 @@ abstract class Assert
if (!(is_int($key) || is_string($key))) {
throw InvalidArgumentException::create(
1,
'integer or string'
'integer or string',
);
}
if (!(is_array($array) || $array instanceof ArrayAccess)) {
throw InvalidArgumentException::create(
2,
'array or ArrayAccess'
'array or ArrayAccess',
);
}
$constraint = new LogicalNot(
new ArrayHasKey($key)
new ArrayHasKey($key),
);
static::assertThat($array, $constraint, $message);
@@ -191,7 +192,7 @@ abstract class Assert
public static function assertNotContains($needle, iterable $haystack, string $message = ''): void
{
$constraint = new LogicalNot(
new TraversableContainsIdentical($needle)
new TraversableContainsIdentical($needle),
);
static::assertThat($haystack, $constraint, $message);
@@ -220,9 +221,9 @@ abstract class Assert
$haystack,
new TraversableContainsOnly(
$type,
$isNativeType
$isNativeType,
),
$message
$message,
);
}
@@ -238,9 +239,9 @@ abstract class Assert
$haystack,
new TraversableContainsOnly(
$className,
false
false,
),
$message
$message,
);
}
@@ -261,10 +262,10 @@ abstract class Assert
new LogicalNot(
new TraversableContainsOnly(
$type,
$isNativeType
)
$isNativeType,
),
),
$message
$message,
);
}
@@ -290,7 +291,7 @@ abstract class Assert
static::assertThat(
$haystack,
new Count($expectedCount),
$message
$message,
);
}
@@ -314,7 +315,7 @@ abstract class Assert
}
$constraint = new LogicalNot(
new Count($expectedCount)
new Count($expectedCount),
);
static::assertThat($haystack, $constraint, $message);
@@ -369,7 +370,7 @@ abstract class Assert
{
$constraint = new IsEqualWithDelta(
$expected,
$delta
$delta,
);
static::assertThat($actual, $constraint, $message);
@@ -384,7 +385,7 @@ abstract class Assert
public static function assertNotEquals($expected, $actual, string $message = ''): void
{
$constraint = new LogicalNot(
new IsEqual($expected)
new IsEqual($expected),
);
static::assertThat($actual, $constraint, $message);
@@ -399,7 +400,7 @@ abstract class Assert
public static function assertNotEqualsCanonicalizing($expected, $actual, string $message = ''): void
{
$constraint = new LogicalNot(
new IsEqualCanonicalizing($expected)
new IsEqualCanonicalizing($expected),
);
static::assertThat($actual, $constraint, $message);
@@ -414,7 +415,7 @@ abstract class Assert
public static function assertNotEqualsIgnoringCase($expected, $actual, string $message = ''): void
{
$constraint = new LogicalNot(
new IsEqualIgnoringCase($expected)
new IsEqualIgnoringCase($expected),
);
static::assertThat($actual, $constraint, $message);
@@ -431,8 +432,8 @@ abstract class Assert
$constraint = new LogicalNot(
new IsEqualWithDelta(
$expected,
$delta
)
$delta,
),
);
static::assertThat($actual, $constraint, $message);
@@ -446,7 +447,7 @@ abstract class Assert
static::assertThat(
$actual,
static::objectEquals($expected, $method),
$message
$message,
);
}
@@ -506,7 +507,7 @@ abstract class Assert
static::assertThat(
$actual,
static::greaterThanOrEqual($expected),
$message
$message,
);
}
@@ -562,7 +563,7 @@ abstract class Assert
static::assertFileExists($actual, $message);
$constraint = new IsEqualCanonicalizing(
file_get_contents($expected)
file_get_contents($expected),
);
static::assertThat(file_get_contents($actual), $constraint, $message);
@@ -598,7 +599,7 @@ abstract class Assert
static::assertFileExists($actual, $message);
$constraint = new LogicalNot(
new IsEqual(file_get_contents($expected))
new IsEqual(file_get_contents($expected)),
);
static::assertThat(file_get_contents($actual), $constraint, $message);
@@ -617,7 +618,7 @@ abstract class Assert
static::assertFileExists($actual, $message);
$constraint = new LogicalNot(
new IsEqualCanonicalizing(file_get_contents($expected))
new IsEqualCanonicalizing(file_get_contents($expected)),
);
static::assertThat(file_get_contents($actual), $constraint, $message);
@@ -636,7 +637,7 @@ abstract class Assert
static::assertFileExists($actual, $message);
$constraint = new LogicalNot(
new IsEqualIgnoringCase(file_get_contents($expected))
new IsEqualIgnoringCase(file_get_contents($expected)),
);
static::assertThat(file_get_contents($actual), $constraint, $message);
@@ -702,7 +703,7 @@ abstract class Assert
static::assertFileExists($expectedFile, $message);
$constraint = new LogicalNot(
new IsEqual(file_get_contents($expectedFile))
new IsEqual(file_get_contents($expectedFile)),
);
static::assertThat($actualString, $constraint, $message);
@@ -720,7 +721,7 @@ abstract class Assert
static::assertFileExists($expectedFile, $message);
$constraint = new LogicalNot(
new IsEqualCanonicalizing(file_get_contents($expectedFile))
new IsEqualCanonicalizing(file_get_contents($expectedFile)),
);
static::assertThat($actualString, $constraint, $message);
@@ -738,7 +739,7 @@ abstract class Assert
static::assertFileExists($expectedFile, $message);
$constraint = new LogicalNot(
new IsEqualIgnoringCase(file_get_contents($expectedFile))
new IsEqualIgnoringCase(file_get_contents($expectedFile)),
);
static::assertThat($actualString, $constraint, $message);
@@ -1227,9 +1228,9 @@ abstract class Assert
static::assertThat(
$className,
new LogicalNot(
new ClassHasAttribute($attributeName)
new ClassHasAttribute($attributeName),
),
$message
$message,
);
}
@@ -1257,7 +1258,7 @@ abstract class Assert
static::assertThat(
$className,
new ClassHasStaticAttribute($attributeName),
$message
$message,
);
}
@@ -1285,9 +1286,9 @@ abstract class Assert
static::assertThat(
$className,
new LogicalNot(
new ClassHasStaticAttribute($attributeName)
new ClassHasStaticAttribute($attributeName),
),
$message
$message,
);
}
@@ -1304,7 +1305,7 @@ abstract class Assert
*/
public static function assertObjectHasAttribute(string $attributeName, $object, string $message = ''): void
{
self::createWarning('assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() (PHPUnit 10.1.0+) instead.');
self::createWarning('assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() instead.');
if (!self::isValidObjectAttributeName($attributeName)) {
throw InvalidArgumentException::create(1, 'valid attribute name');
@@ -1317,7 +1318,7 @@ abstract class Assert
static::assertThat(
$object,
new ObjectHasAttribute($attributeName),
$message
$message,
);
}
@@ -1334,7 +1335,7 @@ abstract class Assert
*/
public static function assertObjectNotHasAttribute(string $attributeName, $object, string $message = ''): void
{
self::createWarning('assertObjectNotHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectNotHasProperty() (PHPUnit 10.1.0+) instead.');
self::createWarning('assertObjectNotHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectNotHasProperty() instead.');
if (!self::isValidObjectAttributeName($attributeName)) {
throw InvalidArgumentException::create(1, 'valid attribute name');
@@ -1347,9 +1348,39 @@ abstract class Assert
static::assertThat(
$object,
new LogicalNot(
new ObjectHasAttribute($attributeName)
new ObjectHasAttribute($attributeName),
),
$message
$message,
);
}
/**
* Asserts that an object has a specified property.
*
* @throws ExpectationFailedException
*/
final public static function assertObjectHasProperty(string $propertyName, object $object, string $message = ''): void
{
static::assertThat(
$object,
new ObjectHasProperty($propertyName),
$message,
);
}
/**
* Asserts that an object does not have a specified property.
*
* @throws ExpectationFailedException
*/
final public static function assertObjectNotHasProperty(string $propertyName, object $object, string $message = ''): void
{
static::assertThat(
$object,
new LogicalNot(
new ObjectHasProperty($propertyName),
),
$message,
);
}
@@ -1372,7 +1403,7 @@ abstract class Assert
static::assertThat(
$actual,
new IsIdentical($expected),
$message
$message,
);
}
@@ -1393,9 +1424,9 @@ abstract class Assert
static::assertThat(
$actual,
new LogicalNot(
new IsIdentical($expected)
new IsIdentical($expected),
),
$message
$message,
);
}
@@ -1421,7 +1452,7 @@ abstract class Assert
static::assertThat(
$actual,
new IsInstanceOf($expected),
$message
$message,
);
}
@@ -1447,9 +1478,9 @@ abstract class Assert
static::assertThat(
$actual,
new LogicalNot(
new IsInstanceOf($expected)
new IsInstanceOf($expected),
),
$message
$message,
);
}
@@ -1466,7 +1497,7 @@ abstract class Assert
static::assertThat(
$actual,
new IsType(IsType::TYPE_ARRAY),
$message
$message,
);
}
@@ -1483,7 +1514,7 @@ abstract class Assert
static::assertThat(
$actual,
new IsType(IsType::TYPE_BOOL),
$message
$message,
);
}
@@ -1500,7 +1531,7 @@ abstract class Assert
static::assertThat(
$actual,
new IsType(IsType::TYPE_FLOAT),
$message
$message,
);
}
@@ -1517,7 +1548,7 @@ abstract class Assert
static::assertThat(
$actual,
new IsType(IsType::TYPE_INT),
$message
$message,
);
}
@@ -1534,7 +1565,7 @@ abstract class Assert
static::assertThat(
$actual,
new IsType(IsType::TYPE_NUMERIC),
$message
$message,
);
}
@@ -1551,7 +1582,7 @@ abstract class Assert
static::assertThat(
$actual,
new IsType(IsType::TYPE_OBJECT),
$message
$message,
);
}
@@ -1568,7 +1599,7 @@ abstract class Assert
static::assertThat(
$actual,
new IsType(IsType::TYPE_RESOURCE),
$message
$message,
);
}
@@ -1585,7 +1616,7 @@ abstract class Assert
static::assertThat(
$actual,
new IsType(IsType::TYPE_CLOSED_RESOURCE),
$message
$message,
);
}
@@ -1602,7 +1633,7 @@ abstract class Assert
static::assertThat(
$actual,
new IsType(IsType::TYPE_STRING),
$message
$message,
);
}
@@ -1619,7 +1650,7 @@ abstract class Assert
static::assertThat(
$actual,
new IsType(IsType::TYPE_SCALAR),
$message
$message,
);
}
@@ -1636,7 +1667,7 @@ abstract class Assert
static::assertThat(
$actual,
new IsType(IsType::TYPE_CALLABLE),
$message
$message,
);
}
@@ -1653,7 +1684,7 @@ abstract class Assert
static::assertThat(
$actual,
new IsType(IsType::TYPE_ITERABLE),
$message
$message,
);
}
@@ -1670,7 +1701,7 @@ abstract class Assert
static::assertThat(
$actual,
new LogicalNot(new IsType(IsType::TYPE_ARRAY)),
$message
$message,
);
}
@@ -1687,7 +1718,7 @@ abstract class Assert
static::assertThat(
$actual,
new LogicalNot(new IsType(IsType::TYPE_BOOL)),
$message
$message,
);
}
@@ -1704,7 +1735,7 @@ abstract class Assert
static::assertThat(
$actual,
new LogicalNot(new IsType(IsType::TYPE_FLOAT)),
$message
$message,
);
}
@@ -1721,7 +1752,7 @@ abstract class Assert
static::assertThat(
$actual,
new LogicalNot(new IsType(IsType::TYPE_INT)),
$message
$message,
);
}
@@ -1738,7 +1769,7 @@ abstract class Assert
static::assertThat(
$actual,
new LogicalNot(new IsType(IsType::TYPE_NUMERIC)),
$message
$message,
);
}
@@ -1755,7 +1786,7 @@ abstract class Assert
static::assertThat(
$actual,
new LogicalNot(new IsType(IsType::TYPE_OBJECT)),
$message
$message,
);
}
@@ -1772,7 +1803,7 @@ abstract class Assert
static::assertThat(
$actual,
new LogicalNot(new IsType(IsType::TYPE_RESOURCE)),
$message
$message,
);
}
@@ -1789,7 +1820,7 @@ abstract class Assert
static::assertThat(
$actual,
new LogicalNot(new IsType(IsType::TYPE_CLOSED_RESOURCE)),
$message
$message,
);
}
@@ -1806,7 +1837,7 @@ abstract class Assert
static::assertThat(
$actual,
new LogicalNot(new IsType(IsType::TYPE_STRING)),
$message
$message,
);
}
@@ -1823,7 +1854,7 @@ abstract class Assert
static::assertThat(
$actual,
new LogicalNot(new IsType(IsType::TYPE_SCALAR)),
$message
$message,
);
}
@@ -1840,7 +1871,7 @@ abstract class Assert
static::assertThat(
$actual,
new LogicalNot(new IsType(IsType::TYPE_CALLABLE)),
$message
$message,
);
}
@@ -1857,7 +1888,7 @@ abstract class Assert
static::assertThat(
$actual,
new LogicalNot(new IsType(IsType::TYPE_ITERABLE)),
$message
$message,
);
}
@@ -1900,9 +1931,9 @@ abstract class Assert
static::assertThat(
$string,
new LogicalNot(
new RegularExpression($pattern)
new RegularExpression($pattern),
),
$message
$message,
);
}
@@ -1923,9 +1954,9 @@ abstract class Assert
static::assertThat(
$string,
new LogicalNot(
new RegularExpression($pattern)
new RegularExpression($pattern),
),
$message
$message,
);
}
@@ -1961,7 +1992,7 @@ abstract class Assert
static::assertThat(
$actual,
new SameSize($expected),
$message
$message,
);
}
@@ -1997,9 +2028,9 @@ abstract class Assert
static::assertThat(
$actual,
new LogicalNot(
new SameSize($expected)
new SameSize($expected),
),
$message
$message,
);
}
@@ -2025,9 +2056,9 @@ abstract class Assert
static::assertThat(
$string,
new LogicalNot(
new StringMatchesFormatDescription($format)
new StringMatchesFormatDescription($format),
),
$message
$message,
);
}
@@ -2044,9 +2075,9 @@ abstract class Assert
static::assertThat(
$string,
new StringMatchesFormatDescription(
file_get_contents($formatFile)
file_get_contents($formatFile),
),
$message
$message,
);
}
@@ -2064,10 +2095,10 @@ abstract class Assert
$string,
new LogicalNot(
new StringMatchesFormatDescription(
file_get_contents($formatFile)
)
file_get_contents($formatFile),
),
),
$message
$message,
);
}
@@ -2096,9 +2127,9 @@ abstract class Assert
static::assertThat(
$string,
new LogicalNot(
new StringStartsWith($prefix)
new StringStartsWith($prefix),
),
$message
$message,
);
}
@@ -2168,9 +2199,9 @@ abstract class Assert
static::assertThat(
$string,
new LogicalNot(
new StringEndsWith($suffix)
new StringEndsWith($suffix),
),
$message
$message,
);
}
@@ -2335,7 +2366,7 @@ abstract class Assert
static::assertSame(
$expectedElement->tagName,
$actualElement->tagName,
$message
$message,
);
if ($checkAttributes) {
@@ -2346,8 +2377,8 @@ abstract class Assert
'%s%sNumber of attributes on node "%s" does not match',
$message,
!empty($message) ? "\n" : '',
$expectedElement->tagName
)
$expectedElement->tagName,
),
);
for ($i = 0; $i < $expectedElement->attributes->length; $i++) {
@@ -2363,8 +2394,8 @@ abstract class Assert
$message,
!empty($message) ? "\n" : '',
$expectedAttribute->name,
$expectedElement->tagName
)
$expectedElement->tagName,
),
);
}
}
@@ -2380,8 +2411,8 @@ abstract class Assert
'%s%sNumber of child nodes of "%s" differs',
$message,
!empty($message) ? "\n" : '',
$expectedElement->tagName
)
$expectedElement->tagName,
),
);
for ($i = 0; $i < $expectedElement->childNodes->length; $i++) {
@@ -2389,7 +2420,7 @@ abstract class Assert
$expectedElement->childNodes->item($i),
$actualElement->childNodes->item($i),
$checkAttributes,
$message
$message,
);
}
}
@@ -2449,9 +2480,9 @@ abstract class Assert
static::assertThat(
$actualJson,
new LogicalNot(
new JsonMatches($expectedJson)
new JsonMatches($expectedJson),
),
$message
$message,
);
}
@@ -2489,9 +2520,9 @@ abstract class Assert
static::assertThat(
$actualJson,
new LogicalNot(
new JsonMatches($expectedJson)
new JsonMatches($expectedJson),
),
$message
$message,
);
}
@@ -2513,7 +2544,7 @@ abstract class Assert
static::assertJson($actualJson, $message);
$constraintExpected = new JsonMatches(
$expectedJson
$expectedJson,
);
$constraintActual = new JsonMatches($actualJson);
@@ -2540,7 +2571,7 @@ abstract class Assert
static::assertJson($actualJson, $message);
$constraintExpected = new JsonMatches(
$expectedJson
$expectedJson,
);
$constraintActual = new JsonMatches($actualJson);
@@ -2721,7 +2752,7 @@ abstract class Assert
{
return static::logicalOr(
new IsEqual($value),
new GreaterThan($value)
new GreaterThan($value),
);
}
@@ -2779,7 +2810,7 @@ abstract class Assert
{
return static::logicalOr(
new IsEqual($value),
new LessThan($value)
new LessThan($value),
);
}

View File

@@ -1444,6 +1444,42 @@ if (!function_exists('PHPUnit\Framework\assertObjectNotHasAttribute')) {
}
}
if (!function_exists('PHPUnit\Framework\assertObjectHasProperty')) {
/**
* Asserts that an object has a specified property.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
* @throws Exception
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see Assert::assertObjectHasProperty
*/
function assertObjectHasProperty(string $attributeName, object $object, string $message = ''): void
{
Assert::assertObjectHasProperty(...func_get_args());
}
}
if (!function_exists('PHPUnit\Framework\assertObjectNotHasProperty')) {
/**
* Asserts that an object does not have a specified property.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
* @throws Exception
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see Assert::assertObjectNotHasProperty
*/
function assertObjectNotHasProperty(string $attributeName, object $object, string $message = ''): void
{
Assert::assertObjectNotHasProperty(...func_get_args());
}
}
if (!function_exists('PHPUnit\Framework\assertSame')) {
/**
* Asserts that two variables have the same type and value.
@@ -2927,7 +2963,7 @@ if (!function_exists('PHPUnit\Framework\atLeast')) {
function atLeast(int $requiredInvocations): InvokedAtLeastCountMatcher
{
return new InvokedAtLeastCountMatcher(
$requiredInvocations
$requiredInvocations,
);
}
}

View File

@@ -40,7 +40,7 @@ class Count extends Constraint
{
return sprintf(
'count matches %d',
$this->expectedCount
$this->expectedCount,
);
}
@@ -76,7 +76,7 @@ class Count extends Constraint
throw new Exception(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
}
@@ -136,7 +136,7 @@ class Count extends Constraint
return sprintf(
'actual size %d matches expected size %d',
(int) $this->getCountOf($other),
$this->expectedCount
$this->expectedCount,
);
}
}

View File

@@ -64,7 +64,7 @@ final class IsEmpty extends Constraint
'%s %s %s',
strpos($type, 'a') === 0 || strpos($type, 'o') === 0 ? 'an' : 'a',
$type,
$this->toString()
$this->toString(),
);
}
}

View File

@@ -106,7 +106,7 @@ abstract class Constraint implements Countable, SelfDescribing
{
$failureDescription = sprintf(
'Failed asserting that %s.',
$this->failureDescription($other)
$this->failureDescription($other),
);
$additionalFailureDescription = $this->additionalFailureDescription($other);
@@ -121,7 +121,7 @@ abstract class Constraint implements Countable, SelfDescribing
throw new ExpectationFailedException(
$failureDescription,
$comparisonFailure
$comparisonFailure,
);
}

View File

@@ -78,7 +78,7 @@ final class IsEqual extends Constraint
try {
$comparator = $comparatorFactory->getComparatorFor(
$this->value,
$other
$other,
);
$comparator->assertEquals(
@@ -86,7 +86,7 @@ final class IsEqual extends Constraint
$other,
$this->delta,
$this->canonicalize,
$this->ignoreCase
$this->ignoreCase,
);
} catch (ComparisonFailure $f) {
if ($returnResult) {
@@ -95,7 +95,7 @@ final class IsEqual extends Constraint
throw new ExpectationFailedException(
trim($description . "\n" . $f->getMessage()),
$f
$f,
);
}
@@ -118,21 +118,21 @@ final class IsEqual extends Constraint
return sprintf(
"is equal to '%s'",
$this->value
$this->value,
);
}
if ($this->delta != 0) {
$delta = sprintf(
' with delta <%F>',
$this->delta
$this->delta,
);
}
return sprintf(
'is equal to %s%s',
$this->exporter()->export($this->value),
$delta
$delta,
);
}
}

View File

@@ -58,7 +58,7 @@ final class IsEqualCanonicalizing extends Constraint
try {
$comparator = $comparatorFactory->getComparatorFor(
$this->value,
$other
$other,
);
$comparator->assertEquals(
@@ -66,7 +66,7 @@ final class IsEqualCanonicalizing extends Constraint
$other,
0.0,
true,
false
false,
);
} catch (ComparisonFailure $f) {
if ($returnResult) {
@@ -75,7 +75,7 @@ final class IsEqualCanonicalizing extends Constraint
throw new ExpectationFailedException(
trim($description . "\n" . $f->getMessage()),
$f
$f,
);
}
@@ -96,13 +96,13 @@ final class IsEqualCanonicalizing extends Constraint
return sprintf(
"is equal to '%s'",
$this->value
$this->value,
);
}
return sprintf(
'is equal to %s',
$this->exporter()->export($this->value)
$this->exporter()->export($this->value),
);
}
}

View File

@@ -58,7 +58,7 @@ final class IsEqualIgnoringCase extends Constraint
try {
$comparator = $comparatorFactory->getComparatorFor(
$this->value,
$other
$other,
);
$comparator->assertEquals(
@@ -66,7 +66,7 @@ final class IsEqualIgnoringCase extends Constraint
$other,
0.0,
false,
true
true,
);
} catch (ComparisonFailure $f) {
if ($returnResult) {
@@ -75,7 +75,7 @@ final class IsEqualIgnoringCase extends Constraint
throw new ExpectationFailedException(
trim($description . "\n" . $f->getMessage()),
$f
$f,
);
}
@@ -96,13 +96,13 @@ final class IsEqualIgnoringCase extends Constraint
return sprintf(
"is equal to '%s'",
$this->value
$this->value,
);
}
return sprintf(
'is equal to %s',
$this->exporter()->export($this->value)
$this->exporter()->export($this->value),
);
}
}

View File

@@ -62,13 +62,13 @@ final class IsEqualWithDelta extends Constraint
try {
$comparator = $comparatorFactory->getComparatorFor(
$this->value,
$other
$other,
);
$comparator->assertEquals(
$this->value,
$other,
$this->delta
$this->delta,
);
} catch (ComparisonFailure $f) {
if ($returnResult) {
@@ -77,7 +77,7 @@ final class IsEqualWithDelta extends Constraint
throw new ExpectationFailedException(
trim($description . "\n" . $f->getMessage()),
$f
$f,
);
}
@@ -94,7 +94,7 @@ final class IsEqualWithDelta extends Constraint
return sprintf(
'is equal to %s with delta <%F>',
$this->exporter()->export($this->value),
$this->delta
$this->delta,
);
}
}

View File

@@ -36,7 +36,7 @@ final class Exception extends Constraint
{
return sprintf(
'exception of type "%s"',
$this->className
$this->className,
);
}
@@ -73,13 +73,13 @@ final class Exception extends Constraint
'exception of type "%s" matches expected exception "%s"%s',
get_class($other),
$this->className,
$message
$message,
);
}
return sprintf(
'exception of type "%s" is thrown',
$this->className
$this->className,
);
}
}

View File

@@ -61,7 +61,7 @@ final class ExceptionCode extends Constraint
return sprintf(
'%s is equal to expected exception code %s',
$this->exporter()->export($other->getCode()),
$this->exporter()->export($this->expectedCode)
$this->exporter()->export($this->expectedCode),
);
}
}

View File

@@ -65,14 +65,14 @@ final class ExceptionMessage extends Constraint
if ($this->expectedMessage === '') {
return sprintf(
"exception message is empty but is '%s'",
$other->getMessage()
$other->getMessage(),
);
}
return sprintf(
"exception message '%s' contains '%s'",
$other->getMessage(),
$this->expectedMessage
$this->expectedMessage,
);
}
}

View File

@@ -48,7 +48,7 @@ final class ExceptionMessageRegularExpression extends Constraint
if ($match === false) {
throw new \PHPUnit\Framework\Exception(
"Invalid expected exception message regex given: '{$this->expectedMessageRegExp}'"
"Invalid expected exception message regex given: '{$this->expectedMessageRegExp}'",
);
}
@@ -68,7 +68,7 @@ final class ExceptionMessageRegularExpression extends Constraint
return sprintf(
"exception message '%s' matches '%s'",
$other->getMessage(),
$this->expectedMessageRegExp
$this->expectedMessageRegExp,
);
}
}

View File

@@ -48,7 +48,7 @@ final class DirectoryExists extends Constraint
{
return sprintf(
'directory "%s" exists',
$other
$other,
);
}
}

View File

@@ -48,7 +48,7 @@ final class FileExists extends Constraint
{
return sprintf(
'file "%s" exists',
$other
$other,
);
}
}

View File

@@ -48,7 +48,7 @@ final class IsReadable extends Constraint
{
return sprintf(
'"%s" is readable',
$other
$other,
);
}
}

View File

@@ -48,7 +48,7 @@ final class IsWritable extends Constraint
{
return sprintf(
'"%s" is writable',
$other
$other,
);
}
}

View File

@@ -62,7 +62,7 @@ final class IsIdentical extends Constraint
$this->value,
$other,
sprintf("'%s'", $this->value),
sprintf("'%s'", $other)
sprintf("'%s'", $other),
);
}
@@ -72,7 +72,7 @@ final class IsIdentical extends Constraint
$this->value,
$other,
$this->exporter()->export($this->value),
$this->exporter()->export($other)
$this->exporter()->export($other),
);
}

View File

@@ -37,7 +37,7 @@ final class JsonMatches extends Constraint
{
return sprintf(
'matches JSON string "%s"',
$this->value
$this->value,
);
}
@@ -100,7 +100,7 @@ final class JsonMatches extends Constraint
Json::prettify($recodedValue),
Json::prettify($recodedOther),
false,
'Failed asserting that two json values are equal.'
'Failed asserting that two json values are equal.',
);
}

View File

@@ -40,7 +40,7 @@ class ClassHasAttribute extends Constraint
{
return sprintf(
'has attribute "%s"',
$this->attributeName
$this->attributeName,
);
}
@@ -59,7 +59,7 @@ class ClassHasAttribute extends Constraint
throw new Exception(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
// @codeCoverageIgnoreEnd
@@ -79,7 +79,7 @@ class ClassHasAttribute extends Constraint
'%sclass "%s" %s',
is_object($other) ? 'object of ' : '',
is_object($other) ? get_class($other) : $other,
$this->toString()
$this->toString(),
);
}

View File

@@ -28,7 +28,7 @@ final class ClassHasStaticAttribute extends ClassHasAttribute
{
return sprintf(
'has static attribute "%s"',
$this->attributeName()
$this->attributeName(),
);
}
@@ -51,7 +51,7 @@ final class ClassHasStaticAttribute extends ClassHasAttribute
throw new Exception(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
// @codeCoverageIgnoreEnd

View File

@@ -65,7 +65,7 @@ final class ObjectEquals extends Constraint
if (!$object->hasMethod($this->method)) {
throw new ComparisonMethodDoesNotExistException(
get_class($other),
$this->method
$this->method,
);
}
@@ -75,7 +75,7 @@ final class ObjectEquals extends Constraint
if (!$method->hasReturnType()) {
throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(
get_class($other),
$this->method
$this->method,
);
}
@@ -84,28 +84,28 @@ final class ObjectEquals extends Constraint
if (!$returnType instanceof ReflectionNamedType) {
throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(
get_class($other),
$this->method
$this->method,
);
}
if ($returnType->allowsNull()) {
throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(
get_class($other),
$this->method
$this->method,
);
}
if ($returnType->getName() !== 'bool') {
throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(
get_class($other),
$this->method
$this->method,
);
}
if ($method->getNumberOfParameters() !== 1 || $method->getNumberOfRequiredParameters() !== 1) {
throw new ComparisonMethodDoesNotDeclareExactlyOneParameterException(
get_class($other),
$this->method
$this->method,
);
}
@@ -114,7 +114,7 @@ final class ObjectEquals extends Constraint
if (!$parameter->hasType()) {
throw new ComparisonMethodDoesNotDeclareParameterTypeException(
get_class($other),
$this->method
$this->method,
);
}
@@ -123,7 +123,7 @@ final class ObjectEquals extends Constraint
if (!$type instanceof ReflectionNamedType) {
throw new ComparisonMethodDoesNotDeclareParameterTypeException(
get_class($other),
$this->method
$this->method,
);
}
@@ -137,7 +137,7 @@ final class ObjectEquals extends Constraint
throw new ComparisonMethodDoesNotAcceptParameterTypeException(
get_class($other),
$this->method,
get_class($this->expected)
get_class($this->expected),
);
}

View File

@@ -0,0 +1,84 @@
<?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\Constraint;
use function get_class;
use function gettype;
use function is_object;
use function sprintf;
use ReflectionObject;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
final class ObjectHasProperty extends Constraint
{
/**
* @var string
*/
private $propertyName;
public function __construct(string $propertyName)
{
$this->propertyName = $propertyName;
}
/**
* Returns a string representation of the constraint.
*/
public function toString(): string
{
return sprintf(
'has property "%s"',
$this->propertyName,
);
}
/**
* Evaluates the constraint for parameter $other. Returns true if the
* constraint is met, false otherwise.
*
* @param mixed $other value or object to evaluate
*/
protected function matches($other): bool
{
if (!is_object($other)) {
return false;
}
return (new ReflectionObject($other))->hasProperty($this->propertyName);
}
/**
* Returns the description of the failure.
*
* The beginning of failure messages is "Failed asserting that" in most
* cases. This method should return the second part of that sentence.
*
* @param mixed $other evaluated value or object
*/
protected function failureDescription($other): string
{
if (is_object($other)) {
return sprintf(
'object of class "%s" %s',
get_class($other),
$this->toString(),
);
}
return sprintf(
'"%s" (%s) %s',
$other,
gettype($other),
$this->toString(),
);
}
}

View File

@@ -63,15 +63,15 @@ final class LogicalNot extends UnaryOperator
preg_replace(
$positives,
$negatives,
$nonInput
$nonInput,
),
$string
$string,
);
} else {
$negatedString = preg_replace(
$positives,
$negatives,
$string
$string,
);
}

View File

@@ -57,7 +57,7 @@ final class LogicalXor extends BinaryOperator
{
return $matches xor $constraint->evaluate($other, '', true);
},
$initial->evaluate($other, '', true)
$initial->evaluate($other, '', true),
);
}
}

View File

@@ -65,13 +65,13 @@ final class IsJson extends Constraint
json_decode($other);
$error = (string) JsonMatchesErrorMessageProvider::determineJsonError(
(string) json_last_error()
(string) json_last_error(),
);
return sprintf(
'%s is valid JSON (%s)',
$this->exporter()->shortenedExport($other),
$error
$error,
);
}
}

View File

@@ -34,7 +34,7 @@ class RegularExpression extends Constraint
{
return sprintf(
'matches PCRE pattern "%s"',
$this->pattern
$this->pattern,
);
}

View File

@@ -48,7 +48,7 @@ final class StringContains extends Constraint
return sprintf(
'contains "%s"',
$string
$string,
);
}

View File

@@ -33,8 +33,8 @@ final class StringMatchesFormatDescription extends RegularExpression
{
parent::__construct(
$this->createPatternFromFormat(
$this->convertNewlines($string)
)
$this->convertNewlines($string),
),
);
$this->string = $string;
@@ -49,7 +49,7 @@ final class StringMatchesFormatDescription extends RegularExpression
protected function matches($other): bool
{
return parent::matches(
$this->convertNewlines($other)
$this->convertNewlines($other),
);
}
@@ -96,7 +96,7 @@ final class StringMatchesFormatDescription extends RegularExpression
'%x' => '[0-9a-fA-F]+',
'%f' => '[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?',
'%c' => '.',
]
],
);
return '/^' . $string . '$/s';

View File

@@ -9,7 +9,6 @@
*/
namespace PHPUnit\Framework\Constraint;
use function strlen;
use function strpos;
use PHPUnit\Framework\InvalidArgumentException;
@@ -25,7 +24,7 @@ final class StringStartsWith extends Constraint
public function __construct(string $prefix)
{
if (strlen($prefix) === 0) {
if ($prefix === '') {
throw InvalidArgumentException::create(1, 'non-empty string');
}

View File

@@ -52,7 +52,7 @@ abstract class TraversableContains extends Constraint
return sprintf(
'%s %s',
is_array($other) ? 'an array' : 'a traversable',
$this->toString()
$this->toString(),
);
}

View File

@@ -36,7 +36,7 @@ final class TraversableContainsOnly extends Constraint
$this->constraint = new IsType($type);
} else {
$this->constraint = new IsInstanceOf(
$type
$type,
);
}

View File

@@ -36,7 +36,7 @@ final class IsInstanceOf extends Constraint
return sprintf(
'is instance of %s "%s"',
$this->getType(),
$this->className
$this->className,
);
}
@@ -67,7 +67,7 @@ final class IsInstanceOf extends Constraint
'%s is an instance of %s "%s"',
$this->exporter()->shortenedExport($other),
$this->getType(),
$this->className
$this->className,
);
}

View File

@@ -130,8 +130,8 @@ final class IsType extends Constraint
sprintf(
'Type specified for PHPUnit\Framework\Constraint\IsType <%s> ' .
'is not a valid type.',
$type
)
$type,
),
);
}
@@ -145,7 +145,7 @@ final class IsType extends Constraint
{
return sprintf(
'is of type "%s"',
$this->type
$this->type,
);
}

View File

@@ -15,17 +15,17 @@ namespace PHPUnit\Framework;
final class ErrorTestCase extends TestCase
{
/**
* @var bool
* @var ?bool
*/
protected $backupGlobals = false;
/**
* @var bool
* @var ?bool
*/
protected $backupStaticAttributes = false;
/**
* @var bool
* @var ?bool
*/
protected $runTestInSeparateProcess = false;

View File

@@ -21,7 +21,7 @@ final class ActualValueIsNotAnObjectException extends Exception
parent::__construct(
'Actual value is not an object',
0,
null
null,
);
}

View File

@@ -24,10 +24,10 @@ final class ComparisonMethodDoesNotAcceptParameterTypeException extends Exceptio
'%s is not an accepted argument type for comparison method %s::%s().',
$type,
$className,
$methodName
$methodName,
),
0,
null
null,
);
}

View File

@@ -23,10 +23,10 @@ final class ComparisonMethodDoesNotDeclareBoolReturnTypeException extends Except
sprintf(
'Comparison method %s::%s() does not declare bool return type.',
$className,
$methodName
$methodName,
),
0,
null
null,
);
}

View File

@@ -23,10 +23,10 @@ final class ComparisonMethodDoesNotDeclareExactlyOneParameterException extends E
sprintf(
'Comparison method %s::%s() does not declare exactly one parameter.',
$className,
$methodName
$methodName,
),
0,
null
null,
);
}

View File

@@ -23,10 +23,10 @@ final class ComparisonMethodDoesNotDeclareParameterTypeException extends Excepti
sprintf(
'Parameter of comparison method %s::%s() does not have a declared type.',
$className,
$methodName
$methodName,
),
0,
null
null,
);
}

View File

@@ -23,10 +23,10 @@ final class ComparisonMethodDoesNotExistException extends Exception
sprintf(
'Comparison method %s::%s() does not exist.',
$className,
$methodName
$methodName,
),
0,
null
null,
);
}

View File

@@ -34,8 +34,8 @@ final class InvalidArgumentException extends Exception
$argument,
$function,
in_array(lcfirst($type)[0], ['a', 'e', 'i', 'o', 'u'], true) ? 'an' : 'a',
$type
)
$type,
),
);
}

View File

@@ -77,8 +77,8 @@ final class ExecutionOrderDependency
static function (self $d)
{
return $d->isValid();
}
)
},
),
);
}
@@ -95,7 +95,7 @@ final class ExecutionOrderDependency
{
return $dependency->getTarget();
},
$existing
$existing,
);
foreach ($additional as $dependency) {
@@ -132,7 +132,7 @@ final class ExecutionOrderDependency
{
return $dependency->getTarget();
},
$right
$right,
);
foreach ($left as $dependency) {

View File

@@ -15,17 +15,17 @@ namespace PHPUnit\Framework;
final class IncompleteTestCase extends TestCase
{
/**
* @var bool
* @var ?bool
*/
protected $backupGlobals = false;
/**
* @var bool
* @var ?bool
*/
protected $backupStaticAttributes = false;
/**
* @var bool
* @var ?bool
*/
protected $runTestInSeparateProcess = false;

View File

@@ -42,7 +42,7 @@ trait Api
{
if (isset(static::$__phpunit_configurableMethods)) {
throw new ConfigurableMethodsAlreadyInitializedException(
'Configurable methods is already initialized and can not be reinitialized'
'Configurable methods is already initialized and can not be reinitialized',
);
}
@@ -67,7 +67,7 @@ trait Api
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new InvocationHandler(
static::$__phpunit_configurableMethods,
$this->__phpunit_returnValueGeneration
$this->__phpunit_returnValueGeneration,
);
}

View File

@@ -24,7 +24,7 @@ trait Method
return call_user_func_array(
[$expects, 'method'],
func_get_args()
func_get_args(),
);
}
}

View File

@@ -241,7 +241,7 @@ final class InvocationMocker implements InvocationStubber, MethodNameMatch
{
return strtolower($configurable->getName());
},
$this->configurableMethods
$this->configurableMethods,
);
if (is_string($constraint) && !in_array(strtolower($constraint), $configurableMethodNames, true)) {
@@ -300,7 +300,7 @@ final class InvocationMocker implements InvocationStubber, MethodNameMatch
if (!$configuredMethod->mayReturn($value)) {
throw new IncompatibleReturnValueException(
$configuredMethod,
$value
$value,
);
}
}

View File

@@ -20,46 +20,46 @@ interface InvocationStubber
public function will(Stub $stub): Identity;
/** @return self */
public function willReturn($value, ...$nextValues)/*: self */;
public function willReturn($value, ...$nextValues)/* : self */;
/**
* @param mixed $reference
*
* @return self
*/
public function willReturnReference(&$reference)/*: self */;
public function willReturnReference(&$reference)/* : self */;
/**
* @param array<int, array<int, mixed>> $valueMap
*
* @return self
*/
public function willReturnMap(array $valueMap)/*: self */;
public function willReturnMap(array $valueMap)/* : self */;
/**
* @param int $argumentIndex
*
* @return self
*/
public function willReturnArgument($argumentIndex)/*: self */;
public function willReturnArgument($argumentIndex)/* : self */;
/**
* @param callable $callback
*
* @return self
*/
public function willReturnCallback($callback)/*: self */;
public function willReturnCallback($callback)/* : self */;
/** @return self */
public function willReturnSelf()/*: self */;
public function willReturnSelf()/* : self */;
/**
* @param mixed $values
*
* @return self
*/
public function willReturnOnConsecutiveCalls(...$values)/*: self */;
public function willReturnOnConsecutiveCalls(...$values)/* : self */;
/** @return self */
public function willThrowException(Throwable $exception)/*: self */;
public function willThrowException(Throwable $exception)/* : self */;
}

View File

@@ -22,8 +22,8 @@ final class CannotUseAddMethodsException extends \PHPUnit\Framework\Exception im
sprintf(
'Trying to configure method "%s" with addMethods(), but it exists in class "%s". Use onlyMethods() for methods that exist in the class',
$methodName,
$type
)
$type,
),
);
}
}

View File

@@ -22,8 +22,8 @@ final class CannotUseOnlyMethodsException extends \PHPUnit\Framework\Exception i
sprintf(
'Trying to configure method "%s" with onlyMethods(), but it does not exist in class "%s". Use addMethods() for methods that do not exist in the class',
$methodName,
$type
)
$type,
),
);
}
}

View File

@@ -21,8 +21,8 @@ final class ClassAlreadyExistsException extends \PHPUnit\Framework\Exception imp
parent::__construct(
sprintf(
'Class "%s" already exists',
$className
)
$className,
),
);
}
}

View File

@@ -21,8 +21,8 @@ final class ClassIsFinalException extends \PHPUnit\Framework\Exception implement
parent::__construct(
sprintf(
'Class "%s" is declared "final" and cannot be doubled',
$className
)
$className,
),
);
}
}

View File

@@ -21,8 +21,8 @@ final class ClassIsReadonlyException extends \PHPUnit\Framework\Exception implem
parent::__construct(
sprintf(
'Class "%s" is declared "readonly" and cannot be doubled',
$className
)
$className,
),
);
}
}

View File

@@ -28,8 +28,8 @@ final class DuplicateMethodException extends \PHPUnit\Framework\Exception implem
sprintf(
'Cannot double using a method list that contains duplicates: "%s" (duplicate: "%s")',
implode(', ', $methods),
implode(', ', array_unique(array_diff_assoc($methods, array_unique($methods))))
)
implode(', ', array_unique(array_diff_assoc($methods, array_unique($methods)))),
),
);
}
}

View File

@@ -29,8 +29,8 @@ final class IncompatibleReturnValueException extends \PHPUnit\Framework\Exceptio
'Method %s may not return value of type %s, its declared return type is "%s"',
$method->getName(),
is_object($value) ? get_class($value) : gettype($value),
$method->getReturnTypeDeclaration()
)
$method->getReturnTypeDeclaration(),
),
);
}
}

View File

@@ -21,8 +21,8 @@ final class InvalidMethodNameException extends \PHPUnit\Framework\Exception impl
parent::__construct(
sprintf(
'Cannot double method with invalid name "%s"',
$method
)
$method,
),
);
}
}

View File

@@ -21,8 +21,8 @@ final class MatchBuilderNotFoundException extends \PHPUnit\Framework\Exception i
parent::__construct(
sprintf(
'No builder found for match builder identification <%s>',
$id
)
$id,
),
);
}
}

View File

@@ -21,8 +21,8 @@ final class MatcherAlreadyRegisteredException extends \PHPUnit\Framework\Excepti
parent::__construct(
sprintf(
'Matcher with id <%s> is already registered',
$id
)
$id,
),
);
}
}

View File

@@ -21,8 +21,8 @@ final class MethodCannotBeConfiguredException extends \PHPUnit\Framework\Excepti
parent::__construct(
sprintf(
'Trying to configure method "%s" which cannot be configured because it does not exist, has not been specified, is final, or is static',
$method
)
$method,
),
);
}
}

View File

@@ -22,8 +22,8 @@ final class ReturnValueNotConfiguredException extends \PHPUnit\Framework\Excepti
sprintf(
'Return value inference disabled and no expectation set up for %s::%s()',
$invocation->getClassName(),
$invocation->getMethodName()
)
$invocation->getMethodName(),
),
);
}
}

View File

@@ -17,7 +17,7 @@ final class SoapExtensionNotAvailableException extends \PHPUnit\Framework\Except
public function __construct()
{
parent::__construct(
'The SOAP extension is required to generate a test double from WSDL'
'The SOAP extension is required to generate a test double from WSDL',
);
}
}

View File

@@ -21,8 +21,8 @@ final class UnknownClassException extends \PHPUnit\Framework\Exception implement
parent::__construct(
sprintf(
'Class "%s" does not exist',
$className
)
$className,
),
);
}
}

View File

@@ -21,8 +21,8 @@ final class UnknownTraitException extends \PHPUnit\Framework\Exception implement
parent::__construct(
sprintf(
'Trait "%s" does not exist',
$traitName
)
$traitName,
),
);
}
}

View File

@@ -21,8 +21,8 @@ final class UnknownTypeException extends \PHPUnit\Framework\Exception implements
parent::__construct(
sprintf(
'Class or interface "%s" does not exist',
$type
)
$type,
),
);
}
}

View File

@@ -186,7 +186,7 @@ EOT;
throw new ReflectionException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
// @codeCoverageIgnoreEnd
@@ -207,7 +207,7 @@ EOT;
$callOriginalClone,
$callAutoload,
$cloneArguments,
$callOriginalMethods
$callOriginalMethods,
);
return $this->getObject(
@@ -218,7 +218,7 @@ EOT;
$arguments,
$callOriginalMethods,
$proxyTarget,
$returnValueGeneration
$returnValueGeneration,
);
}
@@ -265,7 +265,7 @@ EOT;
$intersectionName = sprintf(
'Intersection_%s_%s',
implode('_', $unqualifiedNames),
substr(md5((string) mt_rand()), 0, 8)
substr(md5((string) mt_rand()), 0, 8),
);
} while (interface_exists($intersectionName, false));
@@ -275,7 +275,7 @@ EOT;
[
'intersection' => $intersectionName,
'interfaces' => implode(', ', $interfaces),
]
],
);
eval($template->render());
@@ -318,7 +318,7 @@ EOT;
throw new ReflectionException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
// @codeCoverageIgnoreEnd
@@ -343,7 +343,7 @@ EOT;
$callOriginalConstructor,
$callOriginalClone,
$callAutoload,
$cloneArguments
$cloneArguments,
);
}
@@ -379,7 +379,7 @@ EOT;
$className = $this->generateClassName(
$traitName,
'',
'Trait_'
'Trait_',
);
$classTemplate = $this->getTemplate('trait_class.tpl');
@@ -389,7 +389,7 @@ EOT;
'prologue' => 'abstract ',
'class_name' => $className['className'],
'trait_name' => $traitName,
]
],
);
$mockTrait = new MockTrait($classTemplate->render(), $className['className']);
@@ -416,7 +416,7 @@ EOT;
$className = $this->generateClassName(
$traitName,
$traitClassName,
'Trait_'
'Trait_',
);
$classTemplate = $this->getTemplate('trait_class.tpl');
@@ -426,18 +426,18 @@ EOT;
'prologue' => '',
'class_name' => $className['className'],
'trait_name' => $traitName,
]
],
);
return $this->getObject(
new MockTrait(
$classTemplate->render(),
$className['className']
$className['className'],
),
'',
$callOriginalConstructor,
$callAutoload,
$arguments
$arguments,
);
}
@@ -457,7 +457,7 @@ EOT;
$callOriginalClone,
$callAutoload,
$cloneArguments,
$callOriginalMethods
$callOriginalMethods,
);
}
@@ -466,7 +466,7 @@ EOT;
serialize($methods) .
serialize($callOriginalClone) .
serialize($cloneArguments) .
serialize($callOriginalMethods)
serialize($callOriginalMethods),
);
if (!isset(self::$cache[$key])) {
@@ -477,7 +477,7 @@ EOT;
$callOriginalClone,
$callAutoload,
$cloneArguments,
$callOriginalMethods
$callOriginalMethods,
);
}
@@ -504,7 +504,7 @@ EOT;
throw new RuntimeException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
@@ -523,7 +523,7 @@ EOT;
if (empty($methods) || in_array($name, $methods, true)) {
$args = explode(
',',
str_replace(')', '', substr($method, $nameEnd + 1))
str_replace(')', '', substr($method, $nameEnd + 1)),
);
foreach (range(0, count($args) - 1) as $i) {
@@ -540,7 +540,7 @@ EOT;
[
'method_name' => $name,
'arguments' => implode(', ', $args),
]
],
);
$methodsBuffer .= $methodTemplate->render();
@@ -571,7 +571,7 @@ EOT;
'wsdl' => $wsdlFile,
'options' => $optionsBuffer,
'methods' => $methodsBuffer,
]
],
);
return $classTemplate->render();
@@ -591,7 +591,7 @@ EOT;
throw new ReflectionException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
// @codeCoverageIgnoreEnd
@@ -621,7 +621,7 @@ EOT;
throw new ReflectionException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
// @codeCoverageIgnoreEnd
@@ -651,7 +651,7 @@ EOT;
throw new ReflectionException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
// @codeCoverageIgnoreEnd
@@ -681,7 +681,7 @@ EOT;
throw new ReflectionException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
// @codeCoverageIgnoreEnd
@@ -718,7 +718,7 @@ EOT;
throw new ReflectionException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
// @codeCoverageIgnoreEnd
@@ -745,7 +745,7 @@ EOT;
throw new ReflectionException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
// @codeCoverageIgnoreEnd
@@ -784,7 +784,7 @@ EOT;
$_mockClassName = $this->generateClassName(
$type,
$mockClassName,
'Mock_'
'Mock_',
);
if (class_exists($_mockClassName['fullClassName'], $callAutoload)) {
@@ -813,7 +813,7 @@ EOT;
throw new ReflectionException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
// @codeCoverageIgnoreEnd
@@ -839,7 +839,7 @@ EOT;
throw new ReflectionException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
// @codeCoverageIgnoreEnd
@@ -855,7 +855,7 @@ EOT;
throw new ReflectionException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
// @codeCoverageIgnoreEnd
@@ -866,14 +866,14 @@ EOT;
}
$mockMethods->addMethods(
MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments)
MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments),
);
}
$_mockClassName = $this->generateClassName(
$actualClassName,
$_mockClassName['className'],
'Mock_'
'Mock_',
);
}
@@ -884,7 +884,7 @@ EOT;
$additionalInterfaces[] = Iterator::class;
$mockMethods->addMethods(
...$this->mockClassMethods(Iterator::class, $callOriginalMethods, $cloneArguments)
...$this->mockClassMethods(Iterator::class, $callOriginalMethods, $cloneArguments),
);
}
@@ -896,7 +896,7 @@ EOT;
throw new ReflectionException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
// @codeCoverageIgnoreEnd
@@ -915,13 +915,13 @@ EOT;
if ($isClass && $explicitMethods === []) {
$mockMethods->addMethods(
...$this->mockClassMethods($_mockClassName['fullClassName'], $callOriginalMethods, $cloneArguments)
...$this->mockClassMethods($_mockClassName['fullClassName'], $callOriginalMethods, $cloneArguments),
);
}
if ($isInterface && ($explicitMethods === [] || $explicitMethods === null)) {
$mockMethods->addMethods(
...$this->mockInterfaceMethods($_mockClassName['fullClassName'], $cloneArguments)
...$this->mockInterfaceMethods($_mockClassName['fullClassName'], $cloneArguments),
);
}
@@ -935,14 +935,14 @@ EOT;
throw new ReflectionException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
// @codeCoverageIgnoreEnd
if ($this->canMockMethod($method)) {
$mockMethods->addMethods(
MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments)
MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments),
);
}
} else {
@@ -950,8 +950,8 @@ EOT;
MockMethod::fromName(
$_mockClassName['fullClassName'],
$methodName,
$cloneArguments
)
$cloneArguments,
),
);
}
}
@@ -988,19 +988,19 @@ EOT;
'class_declaration' => $this->generateMockClassDeclaration(
$_mockClassName,
$isInterface,
$additionalInterfaces
$additionalInterfaces,
),
'clone' => $cloneTrait,
'mock_class_name' => $_mockClassName['className'],
'mocked_methods' => $mockedMethods,
'method' => $method,
]
],
);
return new MockClass(
$classTemplate->render(),
$_mockClassName['className'],
$configurable
$configurable,
);
}
@@ -1047,7 +1047,7 @@ EOT;
$buffer .= sprintf(
'%s implements %s',
$mockClassName['className'],
$interfaces
$interfaces,
);
if (!in_array($mockClassName['originalClassName'], $additionalInterfaces, true)) {
@@ -1065,7 +1065,7 @@ EOT;
$mockClassName['className'],
!empty($mockClassName['namespaceName']) ? $mockClassName['namespaceName'] . '\\' : '',
$mockClassName['originalClassName'],
$interfaces
$interfaces,
);
}
@@ -1096,7 +1096,7 @@ EOT;
throw new RuntimeException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
}

View File

@@ -183,7 +183,7 @@ final class Invocation implements SelfDescribing
throw new RuntimeException(
$t->getMessage(),
(int) $t->getCode(),
$t
$t,
);
}
}
@@ -221,7 +221,7 @@ final class Invocation implements SelfDescribing
throw new RuntimeException(
$t->getMessage(),
(int) $t->getCode(),
$t
$t,
);
}
}
@@ -256,8 +256,8 @@ final class Invocation implements SelfDescribing
'Return value for %s::%s() cannot be generated%s, please configure a return value for this method',
$this->className,
$this->methodName,
$reason
)
$reason,
),
);
}
@@ -273,10 +273,10 @@ final class Invocation implements SelfDescribing
', ',
array_map(
[$exporter, 'shortenedExport'],
$this->parameters
)
$this->parameters,
),
),
$this->returnType ? sprintf(': %s', $this->returnType) : ''
$this->returnType ? sprintf(': %s', $this->returnType) : '',
);
}

View File

@@ -102,7 +102,7 @@ final class InvocationHandler
return new InvocationMocker(
$this,
$matcher,
...$this->configurableMethods
...$this->configurableMethods,
);
}

Some files were not shown because too many files have changed in this diff Show More