From f80b060b004f2765f7649c38363390ec336bb92a Mon Sep 17 00:00:00 2001 From: Edmond <1571649+EdmondDantes@users.noreply.github.com> Date: Thu, 14 Nov 2024 14:01:27 +0200 Subject: [PATCH] % apply PHPSTAN + RECTOR --- composer.lock | 210 ++++++++++--------- src/BaseException.php | 14 +- src/ClientException.php | 1 - src/ContractNotCorrect.php | 6 +- src/Errors/Error.php | 30 ++- src/HelperTrait.php | 2 +- src/InterfaceNotImplemented.php | 2 +- src/MonologProcessor.php | 13 +- src/RecursionLimitExceeded.php | 2 +- src/Registry.php | 9 +- src/RequiredValueEmpty.php | 4 +- src/Resource/FileSystem/FileCloseError.php | 3 +- src/Resource/FileSystem/FileLockFailed.php | 3 +- src/Resource/FileSystem/FileNotExists.php | 3 +- src/Resource/FileSystem/FileNotReadable.php | 3 +- src/Resource/FileSystem/FileNotWritable.php | 3 +- src/Resource/FileSystem/FileOpenError.php | 3 +- src/Resource/FileSystem/FileReadError.php | 3 +- src/Resource/FileSystem/FileUnLockFailed.php | 3 +- src/Resource/FileSystem/FileWriteError.php | 1 - src/Resource/ResourceCloseError.php | 1 - src/Resource/ResourceDataWrong.php | 2 - src/Resource/ResourceException.php | 17 +- src/Resource/ResourceLockFailed.php | 1 - src/Resource/ResourceNotExists.php | 1 - src/Resource/ResourceNotReadable.php | 1 - src/Resource/ResourceNotWritable.php | 1 - src/Resource/ResourceOpenError.php | 1 - src/Resource/ResourceReadError.php | 1 - src/Resource/ResourceUnLockFailed.php | 1 - src/Resource/ResourceWriteError.php | 1 - src/SaveHandlerInterface.php | 1 - src/UnexpectedMethodMode.php | 4 +- src/UnexpectedValue.php | 2 +- src/UnexpectedValueType.php | 2 +- tests/BaseExceptionTest.php | 29 ++- 36 files changed, 183 insertions(+), 201 deletions(-) diff --git a/composer.lock b/composer.lock index a68288c..48eab11 100644 --- a/composer.lock +++ b/composer.lock @@ -73,16 +73,16 @@ }, { "name": "composer/pcre", - "version": "3.3.1", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4" + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/63aaeac21d7e775ff9bc9d45021e1745c97521c4", - "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", "shasum": "" }, "require": { @@ -92,8 +92,8 @@ "phpstan/phpstan": "<1.11.10" }, "require-dev": { - "phpstan/phpstan": "^1.11.10", - "phpstan/phpstan-strict-rules": "^1.1", + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", "phpunit/phpunit": "^8 || ^9" }, "type": "library", @@ -132,7 +132,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.3.1" + "source": "https://github.com/composer/pcre/tree/3.3.2" }, "funding": [ { @@ -148,7 +148,7 @@ "type": "tidelift" } ], - "time": "2024-08-27T18:44:43+00:00" + "time": "2024-11-12T16:29:46+00:00" }, { "name": "composer/semver", @@ -510,16 +510,16 @@ }, { "name": "ifcastle/codestyle", - "version": "v0.1.7", + "version": "v0.1.11", "source": { "type": "git", "url": "https://github.com/EdmondDantes/ifcastle-codestyle.git", - "reference": "b009a6a00a548ed5906094ca12e7068461451dec" + "reference": "6511698ca0d80eaffb88d0f3e320b8d232ebb0d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/EdmondDantes/ifcastle-codestyle/zipball/b009a6a00a548ed5906094ca12e7068461451dec", - "reference": "b009a6a00a548ed5906094ca12e7068461451dec", + "url": "https://api.github.com/repos/EdmondDantes/ifcastle-codestyle/zipball/6511698ca0d80eaffb88d0f3e320b8d232ebb0d5", + "reference": "6511698ca0d80eaffb88d0f3e320b8d232ebb0d5", "shasum": "" }, "require": { @@ -545,22 +545,22 @@ ], "support": { "issues": "https://github.com/EdmondDantes/ifcastle-codestyle/issues", - "source": "https://github.com/EdmondDantes/ifcastle-codestyle/tree/v0.1.7" + "source": "https://github.com/EdmondDantes/ifcastle-codestyle/tree/v0.1.11" }, - "time": "2024-10-26T13:56:03+00:00" + "time": "2024-11-06T12:02:31+00:00" }, { "name": "monolog/monolog", - "version": "3.7.0", + "version": "3.8.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "f4393b648b78a5408747de94fca38beb5f7e9ef8" + "reference": "32e515fdc02cdafbe4593e30a9350d486b125b67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f4393b648b78a5408747de94fca38beb5f7e9ef8", - "reference": "f4393b648b78a5408747de94fca38beb5f7e9ef8", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/32e515fdc02cdafbe4593e30a9350d486b125b67", + "reference": "32e515fdc02cdafbe4593e30a9350d486b125b67", "shasum": "" }, "require": { @@ -580,12 +580,14 @@ "guzzlehttp/psr7": "^2.2", "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4 || ^3", - "phpstan/phpstan": "^1.9", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-strict-rules": "^1.4", - "phpunit/phpunit": "^10.5.17", + "php-console/php-console": "^3.1.8", + "phpstan/phpstan": "^2", + "phpstan/phpstan-deprecation-rules": "^2", + "phpstan/phpstan-strict-rules": "^2", + "phpunit/phpunit": "^10.5.17 || ^11.0.7", "predis/predis": "^1.1 || ^2", - "ruflin/elastica": "^7", + "rollbar/rollbar": "^4.0", + "ruflin/elastica": "^7 || ^8", "symfony/mailer": "^5.4 || ^6", "symfony/mime": "^5.4 || ^6" }, @@ -636,7 +638,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.7.0" + "source": "https://github.com/Seldaek/monolog/tree/3.8.0" }, "funding": [ { @@ -648,20 +650,20 @@ "type": "tidelift" } ], - "time": "2024-06-28T09:40:51+00:00" + "time": "2024-11-12T13:57:08+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.12.0", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", "shasum": "" }, "require": { @@ -700,7 +702,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" }, "funding": [ { @@ -708,7 +710,7 @@ "type": "tidelift" } ], - "time": "2024-06-12T14:39:25+00:00" + "time": "2024-11-08T17:47:46+00:00" }, { "name": "nikic/php-parser", @@ -888,16 +890,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.7", + "version": "1.12.10", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0" + "reference": "fc463b5d0fe906dcf19689be692c65c50406a071" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", - "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/fc463b5d0fe906dcf19689be692c65c50406a071", + "reference": "fc463b5d0fe906dcf19689be692c65c50406a071", "shasum": "" }, "require": { @@ -942,7 +944,7 @@ "type": "github" } ], - "time": "2024-10-18T11:12:07+00:00" + "time": "2024-11-11T15:37:09+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1269,16 +1271,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.4.2", + "version": "11.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1863643c3f04ad03dcb9c6996c294784cdda4805" + "reference": "e8e8ed1854de5d36c088ec1833beae40d2dedd76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1863643c3f04ad03dcb9c6996c294784cdda4805", - "reference": "1863643c3f04ad03dcb9c6996c294784cdda4805", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e8e8ed1854de5d36c088ec1833beae40d2dedd76", + "reference": "e8e8ed1854de5d36c088ec1833beae40d2dedd76", "shasum": "" }, "require": { @@ -1349,7 +1351,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.4.2" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.4.3" }, "funding": [ { @@ -1365,7 +1367,7 @@ "type": "tidelift" } ], - "time": "2024-10-19T13:05:19+00:00" + "time": "2024-10-28T13:07:50+00:00" }, { "name": "psr/container", @@ -2052,16 +2054,16 @@ }, { "name": "rector/rector", - "version": "1.2.8", + "version": "1.2.10", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "05755bf43617449c08ee8e50fb840c85ad3b1240" + "reference": "40f9cf38c05296bd32f444121336a521a293fa61" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/05755bf43617449c08ee8e50fb840c85ad3b1240", - "reference": "05755bf43617449c08ee8e50fb840c85ad3b1240", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/40f9cf38c05296bd32f444121336a521a293fa61", + "reference": "40f9cf38c05296bd32f444121336a521a293fa61", "shasum": "" }, "require": { @@ -2099,7 +2101,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.8" + "source": "https://github.com/rectorphp/rector/tree/1.2.10" }, "funding": [ { @@ -2107,7 +2109,7 @@ "type": "github" } ], - "time": "2024-10-18T11:54:27+00:00" + "time": "2024-11-08T13:59:10+00:00" }, { "name": "sebastian/cli-parser", @@ -2281,16 +2283,16 @@ }, { "name": "sebastian/comparator", - "version": "6.1.1", + "version": "6.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5ef523a49ae7a302b87b2102b72b1eda8918d686" + "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5ef523a49ae7a302b87b2102b72b1eda8918d686", - "reference": "5ef523a49ae7a302b87b2102b72b1eda8918d686", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/43d129d6a0f81c78bee378b46688293eb7ea3739", + "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739", "shasum": "" }, "require": { @@ -2301,12 +2303,12 @@ "sebastian/exporter": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^11.3" + "phpunit/phpunit": "^11.4" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.1-dev" + "dev-main": "6.2-dev" } }, "autoload": { @@ -2346,7 +2348,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/6.1.1" + "source": "https://github.com/sebastianbergmann/comparator/tree/6.2.1" }, "funding": [ { @@ -2354,7 +2356,7 @@ "type": "github" } ], - "time": "2024-10-18T15:00:48+00:00" + "time": "2024-10-31T05:30:08+00:00" }, { "name": "sebastian/complexity", @@ -3034,16 +3036,16 @@ }, { "name": "symfony/console", - "version": "v7.1.5", + "version": "v7.1.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0fa539d12b3ccf068a722bbbffa07ca7079af9ee" + "reference": "ff04e5b5ba043d2badfb308197b9e6b42883fcd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0fa539d12b3ccf068a722bbbffa07ca7079af9ee", - "reference": "0fa539d12b3ccf068a722bbbffa07ca7079af9ee", + "url": "https://api.github.com/repos/symfony/console/zipball/ff04e5b5ba043d2badfb308197b9e6b42883fcd5", + "reference": "ff04e5b5ba043d2badfb308197b9e6b42883fcd5", "shasum": "" }, "require": { @@ -3107,7 +3109,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.5" + "source": "https://github.com/symfony/console/tree/v7.1.8" }, "funding": [ { @@ -3123,7 +3125,7 @@ "type": "tidelift" } ], - "time": "2024-09-20T08:28:38+00:00" + "time": "2024-11-06T14:23:19+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3194,16 +3196,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v7.1.1", + "version": "v7.1.6", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "9fa7f7a21beb22a39a8f3f28618b29e50d7a55a7" + "reference": "87254c78dd50721cfd015b62277a8281c5589702" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9fa7f7a21beb22a39a8f3f28618b29e50d7a55a7", - "reference": "9fa7f7a21beb22a39a8f3f28618b29e50d7a55a7", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/87254c78dd50721cfd015b62277a8281c5589702", + "reference": "87254c78dd50721cfd015b62277a8281c5589702", "shasum": "" }, "require": { @@ -3254,7 +3256,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v7.1.1" + "source": "https://github.com/symfony/event-dispatcher/tree/v7.1.6" }, "funding": [ { @@ -3270,7 +3272,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -3350,16 +3352,16 @@ }, { "name": "symfony/filesystem", - "version": "v7.1.5", + "version": "v7.1.6", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "61fe0566189bf32e8cfee78335d8776f64a66f5a" + "reference": "c835867b3c62bb05c7fe3d637c871c7ae52024d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/61fe0566189bf32e8cfee78335d8776f64a66f5a", - "reference": "61fe0566189bf32e8cfee78335d8776f64a66f5a", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/c835867b3c62bb05c7fe3d637c871c7ae52024d4", + "reference": "c835867b3c62bb05c7fe3d637c871c7ae52024d4", "shasum": "" }, "require": { @@ -3396,7 +3398,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.1.5" + "source": "https://github.com/symfony/filesystem/tree/v7.1.6" }, "funding": [ { @@ -3412,20 +3414,20 @@ "type": "tidelift" } ], - "time": "2024-09-17T09:16:35+00:00" + "time": "2024-10-25T15:11:02+00:00" }, { "name": "symfony/finder", - "version": "v7.1.4", + "version": "v7.1.6", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "d95bbf319f7d052082fb7af147e0f835a695e823" + "reference": "2cb89664897be33f78c65d3d2845954c8d7a43b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/d95bbf319f7d052082fb7af147e0f835a695e823", - "reference": "d95bbf319f7d052082fb7af147e0f835a695e823", + "url": "https://api.github.com/repos/symfony/finder/zipball/2cb89664897be33f78c65d3d2845954c8d7a43b8", + "reference": "2cb89664897be33f78c65d3d2845954c8d7a43b8", "shasum": "" }, "require": { @@ -3460,7 +3462,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.1.4" + "source": "https://github.com/symfony/finder/tree/v7.1.6" }, "funding": [ { @@ -3476,20 +3478,20 @@ "type": "tidelift" } ], - "time": "2024-08-13T14:28:19+00:00" + "time": "2024-10-01T08:31:23+00:00" }, { "name": "symfony/options-resolver", - "version": "v7.1.1", + "version": "v7.1.6", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "47aa818121ed3950acd2b58d1d37d08a94f9bf55" + "reference": "85e95eeede2d41cd146146e98c9c81d9214cae85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/47aa818121ed3950acd2b58d1d37d08a94f9bf55", - "reference": "47aa818121ed3950acd2b58d1d37d08a94f9bf55", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/85e95eeede2d41cd146146e98c9c81d9214cae85", + "reference": "85e95eeede2d41cd146146e98c9c81d9214cae85", "shasum": "" }, "require": { @@ -3527,7 +3529,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v7.1.1" + "source": "https://github.com/symfony/options-resolver/tree/v7.1.6" }, "funding": [ { @@ -3543,7 +3545,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4021,16 +4023,16 @@ }, { "name": "symfony/process", - "version": "v7.1.5", + "version": "v7.1.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "5c03ee6369281177f07f7c68252a280beccba847" + "reference": "42783370fda6e538771f7c7a36e9fa2ee3a84892" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/5c03ee6369281177f07f7c68252a280beccba847", - "reference": "5c03ee6369281177f07f7c68252a280beccba847", + "url": "https://api.github.com/repos/symfony/process/zipball/42783370fda6e538771f7c7a36e9fa2ee3a84892", + "reference": "42783370fda6e538771f7c7a36e9fa2ee3a84892", "shasum": "" }, "require": { @@ -4062,7 +4064,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.1.5" + "source": "https://github.com/symfony/process/tree/v7.1.8" }, "funding": [ { @@ -4078,7 +4080,7 @@ "type": "tidelift" } ], - "time": "2024-09-19T21:48:23+00:00" + "time": "2024-11-06T14:23:19+00:00" }, { "name": "symfony/service-contracts", @@ -4165,16 +4167,16 @@ }, { "name": "symfony/stopwatch", - "version": "v7.1.1", + "version": "v7.1.6", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "5b75bb1ac2ba1b9d05c47fc4b3046a625377d23d" + "reference": "8b4a434e6e7faf6adedffb48783a5c75409a1a05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5b75bb1ac2ba1b9d05c47fc4b3046a625377d23d", - "reference": "5b75bb1ac2ba1b9d05c47fc4b3046a625377d23d", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/8b4a434e6e7faf6adedffb48783a5c75409a1a05", + "reference": "8b4a434e6e7faf6adedffb48783a5c75409a1a05", "shasum": "" }, "require": { @@ -4207,7 +4209,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v7.1.1" + "source": "https://github.com/symfony/stopwatch/tree/v7.1.6" }, "funding": [ { @@ -4223,20 +4225,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/string", - "version": "v7.1.5", + "version": "v7.1.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "d66f9c343fa894ec2037cc928381df90a7ad4306" + "reference": "591ebd41565f356fcd8b090fe64dbb5878f50281" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/d66f9c343fa894ec2037cc928381df90a7ad4306", - "reference": "d66f9c343fa894ec2037cc928381df90a7ad4306", + "url": "https://api.github.com/repos/symfony/string/zipball/591ebd41565f356fcd8b090fe64dbb5878f50281", + "reference": "591ebd41565f356fcd8b090fe64dbb5878f50281", "shasum": "" }, "require": { @@ -4294,7 +4296,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.1.5" + "source": "https://github.com/symfony/string/tree/v7.1.8" }, "funding": [ { @@ -4310,7 +4312,7 @@ "type": "tidelift" } ], - "time": "2024-09-20T08:28:38+00:00" + "time": "2024-11-13T13:31:21+00:00" }, { "name": "theseer/tokenizer", diff --git a/src/BaseException.php b/src/BaseException.php index f200190..32e5f55 100644 --- a/src/BaseException.php +++ b/src/BaseException.php @@ -41,19 +41,17 @@ class BaseException extends \Exception implements BaseExceptionInterface { use HelperTrait; use TemplateHandlerTrait; - + /** - * @param \Throwable|null $throwable - * @param int $recursion * * @return array>|null */ public static function serializeToArray(\Throwable|null $throwable = null, int $recursion = 0): array|null { - if($throwable === null) { + if ($throwable === null) { return null; } - + if ($recursion > 8) { return [ 'message' => 'Depth of exceptions is greater than 8', @@ -64,7 +62,7 @@ public static function serializeToArray(\Throwable|null $throwable = null, int $ 'previous' => null, ]; } - + if ($throwable instanceof BaseExceptionInterface) { return $throwable->toArray(); } @@ -390,7 +388,7 @@ public function getDebugData(): array { return $this->debugData; } - + /** * The method serialized object to an array. */ @@ -438,7 +436,7 @@ public function toArray(): array 'tags' => $this->getTags(), 'code' => $this->getCode(), 'data' => $this->getExceptionData(), - 'previous' => self::serializeToArray($this->getPrevious()) + 'previous' => self::serializeToArray($this->getPrevious()), ]; } diff --git a/src/ClientException.php b/src/ClientException.php index 2213b60..660a61c 100644 --- a/src/ClientException.php +++ b/src/ClientException.php @@ -10,7 +10,6 @@ class ClientException extends BaseException implements ClientAvailableInterface { /** - * @param string $template * @param array $parameters * @param array $debugData */ diff --git a/src/ContractNotCorrect.php b/src/ContractNotCorrect.php index 26c2cbf..d587086 100644 --- a/src/ContractNotCorrect.php +++ b/src/ContractNotCorrect.php @@ -10,7 +10,7 @@ * Traits * throws that exception). */ -class ContractNotCorrect extends LoggableException +class ContractNotCorrect extends LoggableException { public const string PROPERTY = 'property'; @@ -19,7 +19,7 @@ class ContractNotCorrect extends LoggableException public const string METHOD = 'method'; protected string $template = 'Contract is not correctly for {type} in the trait {trait} which used by {object}'; - + /** * The Contract is not correct. * @@ -29,7 +29,7 @@ class ContractNotCorrect extends LoggableException * @param string|null $trait trait name * @param string $notice extended message */ - public function __construct(object $object, $type = self::PROPERTY, $value = null, string $trait = null, string $notice = '') + public function __construct(object $object, $type = self::PROPERTY, $value = null, ?string $trait = null, string $notice = '') { parent::__construct([ 'message' => $notice, diff --git a/src/Errors/Error.php b/src/Errors/Error.php index 9537886..bd9dfe4 100644 --- a/src/Errors/Error.php +++ b/src/Errors/Error.php @@ -12,9 +12,8 @@ */ class Error extends \ErrorException implements BaseExceptionInterface { - /** - * Conformity between PHP-errors and BaseException + * Conformity between PHP-errors and BaseException. * @var array */ protected static array $ERRORS = @@ -35,7 +34,7 @@ class Error extends \ErrorException implements BaseExceptionInterface E_DEPRECATED => self::INFO, E_USER_DEPRECATED => self::INFO, ]; - + /** * @var mixed[]|null */ @@ -50,11 +49,10 @@ class Error extends \ErrorException implements BaseExceptionInterface * Fatal error flag. */ protected bool $isFatal = false; - + /** * @param array|null $error * - * @return BaseExceptionInterface|null */ public static function createFromLastError(?array $error = null): ?BaseExceptionInterface { @@ -75,7 +73,6 @@ public static function createFromLastError(?array $error = null): ?BaseException * @param string $file File * @param int $line Line * - * @return BaseExceptionInterface */ public static function createError(int $severity, string $message, string $file, int $line): BaseExceptionInterface { @@ -117,24 +114,23 @@ public static function createError(int $severity, string $message, string $file, } } } - + public function __construct(int $severity = \E_ERROR, - string $message = '', - ?string $filename = null, - ?int $line = null, - int $code = 0, - ?\Throwable $previous = null - ) - { + string $message = '', + ?string $filename = null, + ?int $line = null, + int $code = 0, + ?\Throwable $previous = null + ) { parent::__construct($message, $code, $severity, $filename, $line, $previous); } - + #[\Override] public function getTags(): array { return []; } - + #[\Override] public function isLoggable(): bool { @@ -181,7 +177,7 @@ public function getLevel(): int return self::$ERRORS[$this->getSeverity()]; } - + /** * @return array{source: string, type: string, function: string} */ diff --git a/src/HelperTrait.php b/src/HelperTrait.php index d284970..823150a 100644 --- a/src/HelperTrait.php +++ b/src/HelperTrait.php @@ -24,7 +24,7 @@ final protected static function getSourceFor(\Throwable $e, bool $isString = fal [ 'source' => $res['class'] ?? $res['file'] . ':' . $res['line'], 'type' => $res['type'] ?? '.', - 'function' => $res['function'] ?? '{}' // @phpstan-ignore-line + 'function' => $res['function'] ?? '{}', // @phpstan-ignore-line ]; } diff --git a/src/InterfaceNotImplemented.php b/src/InterfaceNotImplemented.php index a0d0e2f..c4de6e8 100644 --- a/src/InterfaceNotImplemented.php +++ b/src/InterfaceNotImplemented.php @@ -7,7 +7,7 @@ /** * If class not implemented required interface. */ -class InterfaceNotImplemented extends LoggableException +class InterfaceNotImplemented extends LoggableException { protected string $template = 'Class {class} does not implement interface {interface}'; diff --git a/src/MonologProcessor.php b/src/MonologProcessor.php index 5c9753a..d63775d 100644 --- a/src/MonologProcessor.php +++ b/src/MonologProcessor.php @@ -1,4 +1,5 @@ context['exception'] instanceof BaseExceptionInterface) { + if (false === $record->context['exception'] instanceof BaseExceptionInterface) { return $record; } - + $exception = $record->context['exception']; - + $record->extra['exception_template'] = $exception->getTemplate(); $record->extra['exception_data'] = $exception->getExceptionData(); $record->extra['exception_debug'] = $exception->getDebugData(); - $record->extra['tags'] = array_merge($record->extra['tags'] ?? [], $exception->getTags()); - + $record->extra['tags'] = \array_merge($record->extra['tags'] ?? [], $exception->getTags()); + return $record; } -} \ No newline at end of file +} diff --git a/src/RecursionLimitExceeded.php b/src/RecursionLimitExceeded.php index f554505..2a21e2b 100644 --- a/src/RecursionLimitExceeded.php +++ b/src/RecursionLimitExceeded.php @@ -21,7 +21,7 @@ public function __construct(array|string|int $limit) if (!\is_scalar($limit)) { parent::__construct($limit); } else { - parent::__construct(['limit' => (int)$limit]); + parent::__construct(['limit' => (int) $limit]); } } } diff --git a/src/Registry.php b/src/Registry.php index ab4be87..35f4c14 100644 --- a/src/Registry.php +++ b/src/Registry.php @@ -4,8 +4,6 @@ namespace IfCastle\Exceptions; -use PHPUnit\Event\Code\Throwable; - /** * Register of exceptions. * @@ -21,7 +19,7 @@ class Registry * Flag for global handler. */ public static bool $isActive = false; - + /** * Options for logger. * @var array @@ -111,9 +109,10 @@ public static function getExceptionLog(): array { if (\is_array(self::$exceptions)) { return self::$exceptions; - } else { - return self::$exceptions->getStorageExceptions(); } + + return self::$exceptions->getStorageExceptions(); + } /** diff --git a/src/RequiredValueEmpty.php b/src/RequiredValueEmpty.php index a924688..4e485c4 100644 --- a/src/RequiredValueEmpty.php +++ b/src/RequiredValueEmpty.php @@ -10,7 +10,7 @@ class RequiredValueEmpty extends LoggableException { protected string $template = 'The Required value {name} is empty ({expected})'; - + /** * If required value is empty. * @@ -18,7 +18,7 @@ class RequiredValueEmpty extends LoggableException * or array with parameters. * @param string|null $expected Excepted type */ - public function __construct(array|string $name, string $expected = null) + public function __construct(array|string $name, ?string $expected = null) { if (!\is_scalar($name)) { parent::__construct($name); diff --git a/src/Resource/FileSystem/FileCloseError.php b/src/Resource/FileSystem/FileCloseError.php index 74c1c7d..3ddcfa2 100644 --- a/src/Resource/FileSystem/FileCloseError.php +++ b/src/Resource/FileSystem/FileCloseError.php @@ -9,10 +9,9 @@ class FileCloseError extends ResourceCloseError implements FileSystemExceptionInterface { protected string $system = self::SYSTEM; - + /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'file') { diff --git a/src/Resource/FileSystem/FileLockFailed.php b/src/Resource/FileSystem/FileLockFailed.php index ba7b5b8..528b522 100644 --- a/src/Resource/FileSystem/FileLockFailed.php +++ b/src/Resource/FileSystem/FileLockFailed.php @@ -9,10 +9,9 @@ class FileLockFailed extends ResourceLockFailed implements FileSystemExceptionInterface { protected string $system = self::SYSTEM; - + /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'file') { diff --git a/src/Resource/FileSystem/FileNotExists.php b/src/Resource/FileSystem/FileNotExists.php index 70d8267..39e03dc 100644 --- a/src/Resource/FileSystem/FileNotExists.php +++ b/src/Resource/FileSystem/FileNotExists.php @@ -9,10 +9,9 @@ class FileNotExists extends ResourceNotExists implements FileSystemExceptionInterface { protected string $system = self::SYSTEM; - + /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'file') { diff --git a/src/Resource/FileSystem/FileNotReadable.php b/src/Resource/FileSystem/FileNotReadable.php index 04da013..f38a75a 100644 --- a/src/Resource/FileSystem/FileNotReadable.php +++ b/src/Resource/FileSystem/FileNotReadable.php @@ -9,10 +9,9 @@ class FileNotReadable extends ResourceNotReadable implements FileSystemExceptionInterface { protected string $system = self::SYSTEM; - + /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'file') { diff --git a/src/Resource/FileSystem/FileNotWritable.php b/src/Resource/FileSystem/FileNotWritable.php index 6ab5bf4..a5ec2b6 100644 --- a/src/Resource/FileSystem/FileNotWritable.php +++ b/src/Resource/FileSystem/FileNotWritable.php @@ -9,10 +9,9 @@ class FileNotWritable extends ResourceNotWritable implements FileSystemExceptionInterface { protected string $system = self::SYSTEM; - + /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'file') { diff --git a/src/Resource/FileSystem/FileOpenError.php b/src/Resource/FileSystem/FileOpenError.php index f94d0fb..1e41bfb 100644 --- a/src/Resource/FileSystem/FileOpenError.php +++ b/src/Resource/FileSystem/FileOpenError.php @@ -9,10 +9,9 @@ class FileOpenError extends ResourceOpenError implements FileSystemExceptionInterface { protected string $system = self::SYSTEM; - + /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'file') { diff --git a/src/Resource/FileSystem/FileReadError.php b/src/Resource/FileSystem/FileReadError.php index d58b57b..fc89f44 100644 --- a/src/Resource/FileSystem/FileReadError.php +++ b/src/Resource/FileSystem/FileReadError.php @@ -9,10 +9,9 @@ class FileReadError extends ResourceReadError implements FileSystemExceptionInterface { protected string $system = self::SYSTEM; - + /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'file') { diff --git a/src/Resource/FileSystem/FileUnLockFailed.php b/src/Resource/FileSystem/FileUnLockFailed.php index 6db9eb1..cf8ca73 100644 --- a/src/Resource/FileSystem/FileUnLockFailed.php +++ b/src/Resource/FileSystem/FileUnLockFailed.php @@ -9,10 +9,9 @@ class FileUnLockFailed extends ResourceUnLockFailed implements FileSystemExceptionInterface { protected string $system = self::SYSTEM; - + /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'file') { diff --git a/src/Resource/FileSystem/FileWriteError.php b/src/Resource/FileSystem/FileWriteError.php index 0c095ab..2c357d1 100644 --- a/src/Resource/FileSystem/FileWriteError.php +++ b/src/Resource/FileSystem/FileWriteError.php @@ -12,7 +12,6 @@ class FileWriteError extends ResourceWriteError implements FileSystemExceptionIn /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'file') { diff --git a/src/Resource/ResourceCloseError.php b/src/Resource/ResourceCloseError.php index b39baf8..74244ee 100644 --- a/src/Resource/ResourceCloseError.php +++ b/src/Resource/ResourceCloseError.php @@ -8,7 +8,6 @@ class ResourceCloseError extends ResourceException { /** * @param string|object|resource|array $resource - * @param $type */ public function __construct(mixed $resource, string $type = 'resource') { diff --git a/src/Resource/ResourceDataWrong.php b/src/Resource/ResourceDataWrong.php index ab2741a..6bd50bc 100644 --- a/src/Resource/ResourceDataWrong.php +++ b/src/Resource/ResourceDataWrong.php @@ -10,8 +10,6 @@ class ResourceDataWrong extends ResourceException /** * @param string|object|resource|array $resource - * @param string $type - * @param string $format */ public function __construct(mixed $resource, string $type = 'resource', string $format = 'format') { diff --git a/src/Resource/ResourceException.php b/src/Resource/ResourceException.php index e1c7c10..202e2d6 100644 --- a/src/Resource/ResourceException.php +++ b/src/Resource/ResourceException.php @@ -20,23 +20,21 @@ class ResourceException extends SystemException /** * @param string|object|resource|array $resource - * @param string $operation - * @param string $type */ public function __construct(mixed $resource, string $type = '', string $operation = '') { if (\is_array($resource)) { parent::__construct($resource); } else { - - if(is_resource($resource)) { - $resource = get_resource_type($resource); - } elseif(is_object($resource)) { + + if (\is_resource($resource)) { + $resource = \get_resource_type($resource); + } elseif (\is_object($resource)) { $resource = $resource::class; - } elseif(!is_string($resource)) { + } elseif (!\is_string($resource)) { $resource = '!unknown!'; } - + parent::__construct([ 'message' => $this->resourceSystem() . ' error: operation "' . $operation . '" failed', 'resource' => $resource, @@ -58,7 +56,6 @@ public function resource(): string /** * Method return system of Resource. - * @return string */ public function resourceSystem(): string { @@ -68,7 +65,6 @@ public function resourceSystem(): string /** * Method return type of Resource. * - * @return string */ public function resourceType(): string { @@ -78,7 +74,6 @@ public function resourceType(): string /** * Method return operation. * - * @return string */ public function resourceOperation(): string { diff --git a/src/Resource/ResourceLockFailed.php b/src/Resource/ResourceLockFailed.php index 24fe055..15f1885 100644 --- a/src/Resource/ResourceLockFailed.php +++ b/src/Resource/ResourceLockFailed.php @@ -8,7 +8,6 @@ class ResourceLockFailed extends ResourceException { /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'resource') { diff --git a/src/Resource/ResourceNotExists.php b/src/Resource/ResourceNotExists.php index af98bb3..aece6f6 100644 --- a/src/Resource/ResourceNotExists.php +++ b/src/Resource/ResourceNotExists.php @@ -10,7 +10,6 @@ class ResourceNotExists extends ResourceException /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'resource') { diff --git a/src/Resource/ResourceNotReadable.php b/src/Resource/ResourceNotReadable.php index 56b4284..a6fc8b9 100644 --- a/src/Resource/ResourceNotReadable.php +++ b/src/Resource/ResourceNotReadable.php @@ -8,7 +8,6 @@ class ResourceNotReadable extends ResourceException { /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'resource') { diff --git a/src/Resource/ResourceNotWritable.php b/src/Resource/ResourceNotWritable.php index bcbf2d9..75e03bf 100644 --- a/src/Resource/ResourceNotWritable.php +++ b/src/Resource/ResourceNotWritable.php @@ -8,7 +8,6 @@ class ResourceNotWritable extends ResourceException { /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'resource') { diff --git a/src/Resource/ResourceOpenError.php b/src/Resource/ResourceOpenError.php index 175adee..d4b7077 100644 --- a/src/Resource/ResourceOpenError.php +++ b/src/Resource/ResourceOpenError.php @@ -8,7 +8,6 @@ class ResourceOpenError extends ResourceException { /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'resource') { diff --git a/src/Resource/ResourceReadError.php b/src/Resource/ResourceReadError.php index 5298016..659f514 100644 --- a/src/Resource/ResourceReadError.php +++ b/src/Resource/ResourceReadError.php @@ -8,7 +8,6 @@ class ResourceReadError extends ResourceException { /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'resource') { diff --git a/src/Resource/ResourceUnLockFailed.php b/src/Resource/ResourceUnLockFailed.php index e0f695f..efc295e 100644 --- a/src/Resource/ResourceUnLockFailed.php +++ b/src/Resource/ResourceUnLockFailed.php @@ -8,7 +8,6 @@ class ResourceUnLockFailed extends ResourceException { /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'resource') { diff --git a/src/Resource/ResourceWriteError.php b/src/Resource/ResourceWriteError.php index 16af536..9e4b2e9 100644 --- a/src/Resource/ResourceWriteError.php +++ b/src/Resource/ResourceWriteError.php @@ -8,7 +8,6 @@ class ResourceWriteError extends ResourceException { /** * @param string|object|resource|array $resource - * @param string $type */ public function __construct(mixed $resource, string $type = 'resource') { diff --git a/src/SaveHandlerInterface.php b/src/SaveHandlerInterface.php index ca87b10..d91ea38 100644 --- a/src/SaveHandlerInterface.php +++ b/src/SaveHandlerInterface.php @@ -8,7 +8,6 @@ interface SaveHandlerInterface { /** * @param array<\Throwable> $exceptions - * @param callable $resetLog * @param array $loggerOptions * @param array $debugOptions */ diff --git a/src/UnexpectedMethodMode.php b/src/UnexpectedMethodMode.php index bae1701..44bd61f 100644 --- a/src/UnexpectedMethodMode.php +++ b/src/UnexpectedMethodMode.php @@ -10,7 +10,7 @@ class UnexpectedMethodMode extends LoggableException { protected string $template = 'Unexpected method mode occurred (method: {method}, mode: {mode} = {value})'; - + /** * The method does not support this mode of work. * @@ -20,7 +20,7 @@ class UnexpectedMethodMode extends LoggableException * @param string|null $mode Name of mode * @param string|int|null $value Mode value */ - public function __construct(array|string $method, string $mode = null, string|int $value = null) + public function __construct(array|string $method, ?string $mode = null, string|int|null $value = null) { if (!\is_scalar($method)) { parent::__construct($method); diff --git a/src/UnexpectedValue.php b/src/UnexpectedValue.php index 6a67fb8..a181519 100644 --- a/src/UnexpectedValue.php +++ b/src/UnexpectedValue.php @@ -10,7 +10,7 @@ class UnexpectedValue extends LoggableException { protected string $template = 'Unexpected value {value} occurred in the variable {name}'; - + /** * The variable has an unexpected value! * diff --git a/src/UnexpectedValueType.php b/src/UnexpectedValueType.php index 1386c14..dd9ffb8 100644 --- a/src/UnexpectedValueType.php +++ b/src/UnexpectedValueType.php @@ -10,7 +10,7 @@ class UnexpectedValueType extends LoggableException { protected string $template = 'Unexpected type occurred for the value {name} and type {type}. Expected {expected}'; - + /** * Value of variable has unexpected type. * diff --git a/tests/BaseExceptionTest.php b/tests/BaseExceptionTest.php index 8009ecb..1e63bdc 100644 --- a/tests/BaseExceptionTest.php +++ b/tests/BaseExceptionTest.php @@ -42,7 +42,7 @@ class BaseExceptionTest extends \PHPUnit\Framework\TestCase * Exception. */ protected BaseException $baseException; - + protected int $line; /** @@ -193,6 +193,19 @@ public function testToArray(): void 'tags' => [], 'code' => $this->testBaseData['code'], 'data' => '', + 'previous' => [ + 'message' => 'previous message', + 'code' => 123, + 'source' => + [ + 'source' => BaseExceptionTest::class, + 'type' => '->', + 'function' => 'setUp', + ], + 'file' => __FILE__, + 'line' => 66, + 'previous' => null, + ], ]; $this->assertIsArray($data, 'data must be array'); @@ -272,7 +285,7 @@ public function testToArrayForContainer2(): void 'code' => 0, 'data' => ['exdata' => $data], 'container' => \IfCastle\Exceptions\LoggableException::class, - 'previous' => null + 'previous' => null, ]; $this->assertIsArray($data, 'data must be array'); @@ -312,7 +325,7 @@ public function testToArrayForTemplate(): void $this->assertIsArray($data, 'data must be array'); - foreach (array_keys($mockup) as $main_key) { + foreach (\array_keys($mockup) as $main_key) { $this->assertArrayHasKey($main_key, $data); $this->assertEquals($mockup[$main_key], $data[$main_key], "$main_key is failed"); @@ -385,21 +398,21 @@ public function testAppendData(): void $this->assertEquals(['data' => 'test', ['append_data' => 'data']], $exception->getExceptionData()); } - + public function testSerializeToArray(): void { $baseException = new BaseException('message', 0, new \Exception('previous')); - + $array = BaseException::serializeToArray($baseException); - + $this->assertArrayHasKey('message', $array, 'message key not found'); $this->assertArrayHasKey('source', $array, 'source key not found'); $this->assertArrayHasKey('code', $array, 'code key not found'); $this->assertArrayHasKey('file', $array, 'file key not found'); $this->assertArrayHasKey('line', $array, 'line key not found'); - + $array = BaseException::serializeToArray(new \Exception('Some message')); - + $this->assertArrayHasKey('message', $array, 'message key not found'); $this->assertArrayHasKey('source', $array, 'source key not found'); $this->assertArrayHasKey('code', $array, 'code key not found');