diff options
| author | Asko Nõmm <asko@nmm.ee> | 2025-04-10 11:39:12 +0300 |
|---|---|---|
| committer | Asko Nõmm <asko@nmm.ee> | 2025-04-10 11:39:12 +0300 |
| commit | 233bbd9d9262002fbeee96114c08d90a7b45edef (patch) | |
| tree | 221c950939479e45b7bb58c81584a3e0fa5fa414 | |
| parent | 38289fea342485943c55bbeaaacd117be7742cc7 (diff) | |
Fix tests
| -rw-r--r-- | composer.json | 74 | ||||
| -rw-r--r-- | composer.lock | 612 | ||||
| -rw-r--r-- | src/Format.php | 44 | ||||
| -rw-r--r-- | tests/FormatTest.php | 115 | ||||
| -rw-r--r-- | tests/LoggrTest.php | 67 |
5 files changed, 430 insertions, 482 deletions
diff --git a/composer.json b/composer.json index 49ce1b5..05b229f 100644 --- a/composer.json +++ b/composer.json @@ -1,41 +1,41 @@ { - "name": "asko/loggr", - "description": "An extendable logging utility class with built-in support for various logging formats.", - "type": "library", - "license": "MIT", - "autoload": { - "psr-4": { - "Asko\\Loggr\\": "src/" - }, - "classmap": [ - "src/" - ] + "name": "asko/loggr", + "description": "An extendable logging utility class with built-in support for various logging formats.", + "type": "library", + "license": "MIT", + "autoload": { + "psr-4": { + "Asko\\Loggr\\": "src/" }, - "autoload-dev": { - "psr-4": { - "Asko\\Loggr\\Tests\\": "tests/" - } - }, - "authors": [ - { - "name": "Asko Nomm", - "email": "asko@faultd.com" - } - ], - "require": { - "php": ">=8.3", - "psr/log": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "11", - "mockery/mockery": "^1.6", - "phpstan/phpstan": "^2.0", - "phpstan/phpstan-mockery": "^2.0", - "phpstan/extension-installer": "^1.4" - }, - "config": { - "allow-plugins": { - "phpstan/extension-installer": true - } + "classmap": [ + "src/" + ] + }, + "autoload-dev": { + "psr-4": { + "Asko\\Loggr\\Tests\\": "tests/" + } + }, + "authors": [ + { + "name": "Asko Nomm", + "email": "asko@faultd.com" + } + ], + "require": { + "php": ">=8.3", + "psr/log": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "12", + "mockery/mockery": "^1.6", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-mockery": "^2.0", + "phpstan/extension-installer": "^1.4" + }, + "config": { + "allow-plugins": { + "phpstan/extension-installer": true } + } } diff --git a/composer.lock b/composer.lock index 39176f7..9a1ef6c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d206ce8d207d38506e18de159f8e68ad", + "content-hash": "3db054180e9f2093f769071436491dec", "packages": [ { "name": "psr/log", @@ -194,16 +194,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.12.1", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" + "reference": "024473a478be9df5fdaca2c793f2232fe788e414" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", - "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/024473a478be9df5fdaca2c793f2232fe788e414", + "reference": "024473a478be9df5fdaca2c793f2232fe788e414", "shasum": "" }, "require": { @@ -242,7 +242,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.0" }, "funding": [ { @@ -250,20 +250,20 @@ "type": "tidelift" } ], - "time": "2024-11-08T17:47:46+00:00" + "time": "2025-02-12T12:17:51+00:00" }, { "name": "nikic/php-parser", - "version": "v5.3.1", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" + "reference": "447a020a1f875a434d62f2a401f53b82a396e494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/447a020a1f875a434d62f2a401f53b82a396e494", + "reference": "447a020a1f875a434d62f2a401f53b82a396e494", "shasum": "" }, "require": { @@ -306,9 +306,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.4.0" }, - "time": "2024-10-08T18:51:32+00:00" + "time": "2024-12-30T11:07:19+00:00" }, { "name": "phar-io/manifest", @@ -478,16 +478,16 @@ }, { "name": "phpstan/phpstan", - "version": "2.0.1", + "version": "2.1.11", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "ab4e9b4415a5fc9e4d27f7fe16c8bc9d067dcd6d" + "reference": "8ca5f79a8f63c49b2359065832a654e1ec70ac30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ab4e9b4415a5fc9e4d27f7fe16c8bc9d067dcd6d", - "reference": "ab4e9b4415a5fc9e4d27f7fe16c8bc9d067dcd6d", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8ca5f79a8f63c49b2359065832a654e1ec70ac30", + "reference": "8ca5f79a8f63c49b2359065832a654e1ec70ac30", "shasum": "" }, "require": { @@ -532,7 +532,7 @@ "type": "github" } ], - "time": "2024-11-11T15:43:04+00:00" + "time": "2025-03-24T13:45:00+00:00" }, { "name": "phpstan/phpstan-mockery", @@ -585,35 +585,34 @@ }, { "name": "phpunit/php-code-coverage", - "version": "11.0.7", + "version": "12.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca" + "reference": "05c33d01a856f9f62488d144bafddc3d7b7a4ebb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f7f08030e8811582cc459871d28d6f5a1a4d35ca", - "reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/05c33d01a856f9f62488d144bafddc3d7b7a4ebb", + "reference": "05c33d01a856f9f62488d144bafddc3d7b7a4ebb", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^5.3.1", - "php": ">=8.2", - "phpunit/php-file-iterator": "^5.1.0", - "phpunit/php-text-template": "^4.0.1", - "sebastian/code-unit-reverse-lookup": "^4.0.1", - "sebastian/complexity": "^4.0.1", - "sebastian/environment": "^7.2.0", - "sebastian/lines-of-code": "^3.0.1", - "sebastian/version": "^5.0.2", + "nikic/php-parser": "^5.4.0", + "php": ">=8.3", + "phpunit/php-file-iterator": "^6.0", + "phpunit/php-text-template": "^5.0", + "sebastian/complexity": "^5.0", + "sebastian/environment": "^8.0", + "sebastian/lines-of-code": "^4.0", + "sebastian/version": "^6.0", "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^11.4.1" + "phpunit/phpunit": "^12.0" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -622,7 +621,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "11.0.x-dev" + "dev-main": "12.1.x-dev" } }, "autoload": { @@ -651,7 +650,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.7" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/12.1.2" }, "funding": [ { @@ -659,32 +658,32 @@ "type": "github" } ], - "time": "2024-10-09T06:21:38+00:00" + "time": "2025-04-03T14:34:39+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "5.1.0", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6" + "reference": "961bc913d42fe24a257bfff826a5068079ac7782" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/118cfaaa8bc5aef3287bf315b6060b1174754af6", - "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/961bc913d42fe24a257bfff826a5068079ac7782", + "reference": "961bc913d42fe24a257bfff826a5068079ac7782", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -712,7 +711,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.0" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/6.0.0" }, "funding": [ { @@ -720,28 +719,28 @@ "type": "github" } ], - "time": "2024-08-27T05:02:59+00:00" + "time": "2025-02-07T04:58:37+00:00" }, { "name": "phpunit/php-invoker", - "version": "5.0.1", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2" + "reference": "12b54e689b07a25a9b41e57736dfab6ec9ae5406" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2", - "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/12b54e689b07a25a9b41e57736dfab6ec9ae5406", + "reference": "12b54e689b07a25a9b41e57736dfab6ec9ae5406", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "suggest": { "ext-pcntl": "*" @@ -749,7 +748,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -776,7 +775,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/php-invoker/tree/6.0.0" }, "funding": [ { @@ -784,32 +783,32 @@ "type": "github" } ], - "time": "2024-07-03T05:07:44+00:00" + "time": "2025-02-07T04:58:58+00:00" }, { "name": "phpunit/php-text-template", - "version": "4.0.1", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964" + "reference": "e1367a453f0eda562eedb4f659e13aa900d66c53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964", - "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/e1367a453f0eda562eedb4f659e13aa900d66c53", + "reference": "e1367a453f0eda562eedb4f659e13aa900d66c53", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -836,7 +835,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1" + "source": "https://github.com/sebastianbergmann/php-text-template/tree/5.0.0" }, "funding": [ { @@ -844,32 +843,32 @@ "type": "github" } ], - "time": "2024-07-03T05:08:43+00:00" + "time": "2025-02-07T04:59:16+00:00" }, { "name": "phpunit/php-timer", - "version": "7.0.1", + "version": "8.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3" + "reference": "f258ce36aa457f3aa3339f9ed4c81fc66dc8c2cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", - "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/f258ce36aa457f3aa3339f9ed4c81fc66dc8c2cc", + "reference": "f258ce36aa457f3aa3339f9ed4c81fc66dc8c2cc", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "7.0-dev" + "dev-main": "8.0-dev" } }, "autoload": { @@ -896,7 +895,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", "security": "https://github.com/sebastianbergmann/php-timer/security/policy", - "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1" + "source": "https://github.com/sebastianbergmann/php-timer/tree/8.0.0" }, "funding": [ { @@ -904,20 +903,20 @@ "type": "github" } ], - "time": "2024-07-03T05:09:35+00:00" + "time": "2025-02-07T04:59:38+00:00" }, { "name": "phpunit/phpunit", - "version": "11.0.0", + "version": "12.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "ece3536c22fc5113906a42e7e82de00baaef36d0" + "reference": "9912c83b5207ab3730fcadc42992e95bdb02dad8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ece3536c22fc5113906a42e7e82de00baaef36d0", - "reference": "ece3536c22fc5113906a42e7e82de00baaef36d0", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9912c83b5207ab3730fcadc42992e95bdb02dad8", + "reference": "9912c83b5207ab3730fcadc42992e95bdb02dad8", "shasum": "" }, "require": { @@ -927,28 +926,25 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", - "php": ">=8.2", - "phpunit/php-code-coverage": "^11.0", - "phpunit/php-file-iterator": "^5.0", - "phpunit/php-invoker": "^5.0", - "phpunit/php-text-template": "^4.0", - "phpunit/php-timer": "^7.0", - "sebastian/cli-parser": "^3.0", - "sebastian/code-unit": "^3.0", - "sebastian/comparator": "^6.0", - "sebastian/diff": "^6.0", - "sebastian/environment": "^7.0", - "sebastian/exporter": "^6.0", - "sebastian/global-state": "^7.0", - "sebastian/object-enumerator": "^6.0", - "sebastian/type": "^5.0", - "sebastian/version": "^5.0" - }, - "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files" + "myclabs/deep-copy": "^1.12.1", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=8.3", + "phpunit/php-code-coverage": "^12.0.0", + "phpunit/php-file-iterator": "^6.0.0", + "phpunit/php-invoker": "^6.0.0", + "phpunit/php-text-template": "^5.0.0", + "phpunit/php-timer": "^8.0.0", + "sebastian/cli-parser": "^4.0.0", + "sebastian/comparator": "^7.0.0", + "sebastian/diff": "^7.0.0", + "sebastian/environment": "^8.0.0", + "sebastian/exporter": "^7.0.0", + "sebastian/global-state": "^8.0.0", + "sebastian/object-enumerator": "^7.0.0", + "sebastian/type": "^6.0.0", + "sebastian/version": "^6.0.0", + "staabm/side-effects-detector": "^1.0.5" }, "bin": [ "phpunit" @@ -956,7 +952,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "11.0-dev" + "dev-main": "12.0-dev" } }, "autoload": { @@ -988,7 +984,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.0.0" + "source": "https://github.com/sebastianbergmann/phpunit/tree/12.0.0" }, "funding": [ { @@ -1004,32 +1000,32 @@ "type": "tidelift" } ], - "time": "2024-02-02T06:12:57+00:00" + "time": "2025-02-07T05:03:33+00:00" }, { "name": "sebastian/cli-parser", - "version": "3.0.2", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180" + "reference": "6d584c727d9114bcdc14c86711cd1cad51778e7c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180", - "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/6d584c727d9114bcdc14c86711cd1cad51778e7c", + "reference": "6d584c727d9114bcdc14c86711cd1cad51778e7c", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1053,120 +1049,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T04:41:36+00:00" - }, - { - "name": "sebastian/code-unit", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "6bb7d09d6623567178cf54126afa9c2310114268" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/6bb7d09d6623567178cf54126afa9c2310114268", - "reference": "6bb7d09d6623567178cf54126afa9c2310114268", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the PHP code units", - "homepage": "https://github.com/sebastianbergmann/code-unit", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "security": "https://github.com/sebastianbergmann/code-unit/security/policy", - "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T04:44:28+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "4.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "183a9b2632194febd219bb9246eee421dad8d45e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e", - "reference": "183a9b2632194febd219bb9246eee421dad8d45e", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/4.0.0" }, "funding": [ { @@ -1174,36 +1057,39 @@ "type": "github" } ], - "time": "2024-07-03T04:45:54+00:00" + "time": "2025-02-07T04:53:50+00:00" }, { "name": "sebastian/comparator", - "version": "6.2.1", + "version": "7.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739" + "reference": "b478f34614f934e0291598d0c08cbaba9644bee5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/43d129d6a0f81c78bee378b46688293eb7ea3739", - "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/b478f34614f934e0291598d0c08cbaba9644bee5", + "reference": "b478f34614f934e0291598d0c08cbaba9644bee5", "shasum": "" }, "require": { "ext-dom": "*", "ext-mbstring": "*", - "php": ">=8.2", - "sebastian/diff": "^6.0", - "sebastian/exporter": "^6.0" + "php": ">=8.3", + "sebastian/diff": "^7.0", + "sebastian/exporter": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^11.4" + "phpunit/phpunit": "^12.0" + }, + "suggest": { + "ext-bcmath": "For comparing BcMath\\Number objects" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.2-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1243,7 +1129,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.2.1" + "source": "https://github.com/sebastianbergmann/comparator/tree/7.0.1" }, "funding": [ { @@ -1251,33 +1137,33 @@ "type": "github" } ], - "time": "2024-10-31T05:30:08+00:00" + "time": "2025-03-07T07:00:32+00:00" }, { "name": "sebastian/complexity", - "version": "4.0.1", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "ee41d384ab1906c68852636b6de493846e13e5a0" + "reference": "bad4316aba5303d0221f43f8cee37eb58d384bbb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0", - "reference": "ee41d384ab1906c68852636b6de493846e13e5a0", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/bad4316aba5303d0221f43f8cee37eb58d384bbb", + "reference": "bad4316aba5303d0221f43f8cee37eb58d384bbb", "shasum": "" }, "require": { "nikic/php-parser": "^5.0", - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1301,7 +1187,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", "security": "https://github.com/sebastianbergmann/complexity/security/policy", - "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1" + "source": "https://github.com/sebastianbergmann/complexity/tree/5.0.0" }, "funding": [ { @@ -1309,33 +1195,33 @@ "type": "github" } ], - "time": "2024-07-03T04:49:50+00:00" + "time": "2025-02-07T04:55:25+00:00" }, { "name": "sebastian/diff", - "version": "6.0.2", + "version": "7.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" + "reference": "7ab1ea946c012266ca32390913653d844ecd085f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", - "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7ab1ea946c012266ca32390913653d844ecd085f", + "reference": "7ab1ea946c012266ca32390913653d844ecd085f", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0", - "symfony/process": "^4.2 || ^5" + "phpunit/phpunit": "^12.0", + "symfony/process": "^7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1368,7 +1254,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" + "source": "https://github.com/sebastianbergmann/diff/tree/7.0.0" }, "funding": [ { @@ -1376,27 +1262,27 @@ "type": "github" } ], - "time": "2024-07-03T04:53:05+00:00" + "time": "2025-02-07T04:55:46+00:00" }, { "name": "sebastian/environment", - "version": "7.2.0", + "version": "8.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5" + "reference": "8afe311eca49171bf95405cc0078be9a3821f9f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", - "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8afe311eca49171bf95405cc0078be9a3821f9f2", + "reference": "8afe311eca49171bf95405cc0078be9a3821f9f2", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "suggest": { "ext-posix": "*" @@ -1404,7 +1290,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "7.2-dev" + "dev-main": "8.0-dev" } }, "autoload": { @@ -1432,7 +1318,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", "security": "https://github.com/sebastianbergmann/environment/security/policy", - "source": "https://github.com/sebastianbergmann/environment/tree/7.2.0" + "source": "https://github.com/sebastianbergmann/environment/tree/8.0.0" }, "funding": [ { @@ -1440,34 +1326,34 @@ "type": "github" } ], - "time": "2024-07-03T04:54:44+00:00" + "time": "2025-02-07T04:56:08+00:00" }, { "name": "sebastian/exporter", - "version": "6.1.3", + "version": "7.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "c414673eee9a8f9d51bbf8d61fc9e3ef1e85b20e" + "reference": "76432aafc58d50691a00d86d0632f1217a47b688" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c414673eee9a8f9d51bbf8d61fc9e3ef1e85b20e", - "reference": "c414673eee9a8f9d51bbf8d61fc9e3ef1e85b20e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/76432aafc58d50691a00d86d0632f1217a47b688", + "reference": "76432aafc58d50691a00d86d0632f1217a47b688", "shasum": "" }, "require": { "ext-mbstring": "*", - "php": ">=8.2", - "sebastian/recursion-context": "^6.0" + "php": ">=8.3", + "sebastian/recursion-context": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^11.2" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.1-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1510,7 +1396,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/6.1.3" + "source": "https://github.com/sebastianbergmann/exporter/tree/7.0.0" }, "funding": [ { @@ -1518,35 +1404,35 @@ "type": "github" } ], - "time": "2024-07-03T04:56:19+00:00" + "time": "2025-02-07T04:56:42+00:00" }, { "name": "sebastian/global-state", - "version": "7.0.2", + "version": "8.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "3be331570a721f9a4b5917f4209773de17f747d7" + "reference": "570a2aeb26d40f057af686d63c4e99b075fb6cbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7", - "reference": "3be331570a721f9a4b5917f4209773de17f747d7", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/570a2aeb26d40f057af686d63c4e99b075fb6cbc", + "reference": "570a2aeb26d40f057af686d63c4e99b075fb6cbc", "shasum": "" }, "require": { - "php": ">=8.2", - "sebastian/object-reflector": "^4.0", - "sebastian/recursion-context": "^6.0" + "php": ">=8.3", + "sebastian/object-reflector": "^5.0", + "sebastian/recursion-context": "^7.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "7.0-dev" + "dev-main": "8.0-dev" } }, "autoload": { @@ -1572,7 +1458,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", "security": "https://github.com/sebastianbergmann/global-state/security/policy", - "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2" + "source": "https://github.com/sebastianbergmann/global-state/tree/8.0.0" }, "funding": [ { @@ -1580,33 +1466,33 @@ "type": "github" } ], - "time": "2024-07-03T04:57:36+00:00" + "time": "2025-02-07T04:56:59+00:00" }, { "name": "sebastian/lines-of-code", - "version": "3.0.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a" + "reference": "97ffee3bcfb5805568d6af7f0f893678fc076d2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a", - "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/97ffee3bcfb5805568d6af7f0f893678fc076d2f", + "reference": "97ffee3bcfb5805568d6af7f0f893678fc076d2f", "shasum": "" }, "require": { "nikic/php-parser": "^5.0", - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1630,7 +1516,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/4.0.0" }, "funding": [ { @@ -1638,34 +1524,34 @@ "type": "github" } ], - "time": "2024-07-03T04:58:38+00:00" + "time": "2025-02-07T04:57:28+00:00" }, { "name": "sebastian/object-enumerator", - "version": "6.0.1", + "version": "7.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "f5b498e631a74204185071eb41f33f38d64608aa" + "reference": "1effe8e9b8e068e9ae228e542d5d11b5d16db894" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa", - "reference": "f5b498e631a74204185071eb41f33f38d64608aa", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1effe8e9b8e068e9ae228e542d5d11b5d16db894", + "reference": "1effe8e9b8e068e9ae228e542d5d11b5d16db894", "shasum": "" }, "require": { - "php": ">=8.2", - "sebastian/object-reflector": "^4.0", - "sebastian/recursion-context": "^6.0" + "php": ">=8.3", + "sebastian/object-reflector": "^5.0", + "sebastian/recursion-context": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1688,7 +1574,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/7.0.0" }, "funding": [ { @@ -1696,32 +1582,32 @@ "type": "github" } ], - "time": "2024-07-03T05:00:13+00:00" + "time": "2025-02-07T04:57:48+00:00" }, { "name": "sebastian/object-reflector", - "version": "4.0.1", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9" + "reference": "4bfa827c969c98be1e527abd576533293c634f6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9", - "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/4bfa827c969c98be1e527abd576533293c634f6a", + "reference": "4bfa827c969c98be1e527abd576533293c634f6a", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1744,7 +1630,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/5.0.0" }, "funding": [ { @@ -1752,32 +1638,32 @@ "type": "github" } ], - "time": "2024-07-03T05:01:32+00:00" + "time": "2025-02-07T04:58:17+00:00" }, { "name": "sebastian/recursion-context", - "version": "6.0.2", + "version": "7.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "694d156164372abbd149a4b85ccda2e4670c0e16" + "reference": "c405ae3a63e01b32eb71577f8ec1604e39858a7c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/694d156164372abbd149a4b85ccda2e4670c0e16", - "reference": "694d156164372abbd149a4b85ccda2e4670c0e16", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/c405ae3a63e01b32eb71577f8ec1604e39858a7c", + "reference": "c405ae3a63e01b32eb71577f8ec1604e39858a7c", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1808,7 +1694,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.2" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/7.0.0" }, "funding": [ { @@ -1816,32 +1702,32 @@ "type": "github" } ], - "time": "2024-07-03T05:10:34+00:00" + "time": "2025-02-07T05:00:01+00:00" }, { "name": "sebastian/type", - "version": "5.1.0", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac" + "reference": "1d7cd6e514384c36d7a390347f57c385d4be6069" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/461b9c5da241511a2a0e8f240814fb23ce5c0aac", - "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/1d7cd6e514384c36d7a390347f57c385d4be6069", + "reference": "1d7cd6e514384c36d7a390347f57c385d4be6069", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.3" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.1-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1865,7 +1751,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/type/issues", "security": "https://github.com/sebastianbergmann/type/security/policy", - "source": "https://github.com/sebastianbergmann/type/tree/5.1.0" + "source": "https://github.com/sebastianbergmann/type/tree/6.0.2" }, "funding": [ { @@ -1873,29 +1759,29 @@ "type": "github" } ], - "time": "2024-09-17T13:12:04+00:00" + "time": "2025-03-18T13:37:31+00:00" }, { "name": "sebastian/version", - "version": "5.0.2", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" + "reference": "3e6ccf7657d4f0a59200564b08cead899313b53c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", - "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/3e6ccf7657d4f0a59200564b08cead899313b53c", + "reference": "3e6ccf7657d4f0a59200564b08cead899313b53c", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1919,7 +1805,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/version/issues", "security": "https://github.com/sebastianbergmann/version/security/policy", - "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" + "source": "https://github.com/sebastianbergmann/version/tree/6.0.0" }, "funding": [ { @@ -1927,7 +1813,59 @@ "type": "github" } ], - "time": "2024-10-09T05:16:32+00:00" + "time": "2025-02-07T05:00:38+00:00" + }, + { + "name": "staabm/side-effects-detector", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/staabm/side-effects-detector.git", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.6", + "phpunit/phpunit": "^9.6.21", + "symfony/var-dumper": "^5.4.43", + "tomasvotruba/type-coverage": "1.0.0", + "tomasvotruba/unused-public": "1.0.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A static analysis tool to detect side effects in PHP code", + "keywords": [ + "static analysis" + ], + "support": { + "issues": "https://github.com/staabm/side-effects-detector/issues", + "source": "https://github.com/staabm/side-effects-detector/tree/1.0.5" + }, + "funding": [ + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2024-10-20T05:08:20+00:00" }, { "name": "theseer/tokenizer", diff --git a/src/Format.php b/src/Format.php index 5f587b6..241da45 100644 --- a/src/Format.php +++ b/src/Format.php @@ -20,9 +20,9 @@ enum Format * @param Message $message The message to be serialized. * @return string The serialized message. */ - public function serialize(Message $message, DateTime $dateTime = new DateTime): string + public function serialize(Message $message, DateTime $dateTime = new DateTime()): string { - return match($this) { + return match ($this) { self::JSON => $this->serializeJson($message, $dateTime), self::IntelliJ => $this->serializeIntelliJ($message, $dateTime), self::Laravel => $this->serializeLaravel($message, $dateTime), @@ -39,23 +39,23 @@ enum Format private function serializeJson(Message $message, DateTime $dateTime): string { /** @var string $trace_file */ - $trace_file = $message->trace['file']; + $trace_file = $message->trace["file"]; /** @var string $trace_line */ - $trace_line = $message->trace['line']; + $trace_line = $message->trace["line"]; $json = json_encode([ - 'date' => $dateTime->format('Y-m-d H:i:s'), - 'level' => strtoupper($message->level->value), - 'message' => $message->content, - 'context' => $message->context, - 'trace' => [ - 'file' => pathinfo($trace_file, PATHINFO_FILENAME), - 'line' => $trace_line, + "date" => $dateTime->format("Y-m-d H:i:s"), + "level" => strtoupper($message->level->value), + "message" => $message->content, + "context" => $message->context, + "trace" => [ + "file" => pathinfo($trace_file, PATHINFO_FILENAME), + "line" => $trace_line, ], ]); if (!$json) { - return ''; + return ""; } return $json; @@ -70,13 +70,13 @@ enum Format private function serializeLaravel(Message $message, DateTime $dateTime): string { /** @var string $trace_file */ - $trace_file = $message->trace['file']; + $trace_file = $message->trace["file"]; - $datetime = $dateTime->format('Y-m-d H:i:s'); + $datetime = $dateTime->format("Y-m-d H:i:s"); $filename = pathinfo($trace_file, PATHINFO_FILENAME); $level = strtoupper($message->level->value); $content = !empty($message->content) ? "$message->content " : ""; - $context = isset($message->context) ? json_encode($message->context) : ''; + $context = isset($message->context) ? json_encode($message->context) : ""; return trim("[$datetime] $filename.$level: $content$context"); } @@ -90,14 +90,14 @@ enum Format private function serializeSymfony(Message $message, DateTime $dateTime): string { /** @var string $trace_file */ - $trace_file = $message->trace['file']; + $trace_file = $message->trace["file"]; // Date - $datetime = $dateTime->format('Y-m-d\TH:i:s.uP'); + $datetime = $dateTime->format("Y-m-d\TH:i:s.uP"); $filename = pathinfo($trace_file, PATHINFO_FILENAME); $level = strtoupper($message->level->value); $content = !empty($message->content) ? "$message->content " : ""; - $context = isset($message->context) ? json_encode($message->context) : ''; + $context = isset($message->context) ? json_encode($message->context) : ""; return trim("[$datetime] $filename.$level: $content$context"); } @@ -111,16 +111,16 @@ enum Format private function serializeIntelliJ(Message $message, DateTime $dateTime): string { /** @var string $trace_file */ - $trace_file = $message->trace['file']; + $trace_file = $message->trace["file"]; /** @var string $trace_line */ - $trace_line = $message->trace['line']; + $trace_line = $message->trace["line"]; // Date - $datetime = $dateTime->format('Y-m-d H:i:s'); + $datetime = $dateTime->format("Y-m-d H:i:s"); $level = strtoupper($message->level->value); $filename = pathinfo($trace_file, PATHINFO_FILENAME); $content = !empty($message->content) ? "$message->content " : ""; - $context = isset($message->context) ? json_encode($message->context) : ''; + $context = isset($message->context) ? json_encode($message->context) : ""; return trim("$datetime [$trace_line] $level - $filename - $content$context"); } diff --git a/tests/FormatTest.php b/tests/FormatTest.php index 4222a81..cc2923a 100644 --- a/tests/FormatTest.php +++ b/tests/FormatTest.php @@ -16,44 +16,42 @@ class FormatTest extends MockeryTestCase $message = new Message( level: Level::Info, trace: debug_backtrace()[0], - context: ['test' => 'test'], + context: ["test" => "test"] ); $format = Format::JSON; $serializedMessage = $format->serialize($message); - $full_date = (new DateTime())->format('Y-m-d H:i:s'); - $expectedJson = '{"date":"' . $full_date . '","level":"INFO","message":"","context":{"test":"test"},"trace":{"file":"TestCase","line":1182}}'; + $full_date = (new DateTime())->format("Y-m-d H:i:s"); + $expectedJson = + '{"date":"' . + $full_date . + '","level":"INFO","message":"","context":{"test":"test"},"trace":{"file":"TestCase","line":1104}}'; $this->assertEquals($expectedJson, $serializedMessage); } public function testJsonStr(): void { - $message = new Message( - level: Level::Info, - trace: debug_backtrace()[0], - context: "test", - ); + $message = new Message(level: Level::Info, trace: debug_backtrace()[0], context: "test"); $format = Format::JSON; $serializedMessage = $format->serialize($message); - $full_date = (new DateTime())->format('Y-m-d H:i:s'); - $expectedJson = '{"date":"' . $full_date . '","level":"INFO","message":"","context":"test","trace":{"file":"TestCase","line":1182}}'; + $full_date = (new DateTime())->format("Y-m-d H:i:s"); + $expectedJson = + '{"date":"' . + $full_date . + '","level":"INFO","message":"","context":"test","trace":{"file":"TestCase","line":1104}}'; $this->assertEquals($expectedJson, $serializedMessage); } public function testJsonFails(): void { - $message = new Message( - level: Level::Info, - trace: debug_backtrace()[0], - context: NAN, - ); + $message = new Message(level: Level::Info, trace: debug_backtrace()[0], context: NAN); $format = Format::JSON; $serializedMessage = $format->serialize($message); - $expectedJson = ''; + $expectedJson = ""; $this->assertEquals($expectedJson, $serializedMessage); } @@ -63,14 +61,14 @@ class FormatTest extends MockeryTestCase $message = new Message( level: Level::Info, trace: debug_backtrace()[0], - content: 'test', - context: ['message' => 'test'], + content: "test", + context: ["message" => "test"] ); $format = Format::IntelliJ; $serializedMessage = $format->serialize($message); - $full_date = (new DateTime())->format('Y-m-d H:i:s'); - $expected = "$full_date [1182] INFO - TestCase - test {\"message\":\"test\"}"; + $full_date = (new DateTime())->format("Y-m-d H:i:s"); + $expected = "$full_date [1104] INFO - TestCase - test {\"message\":\"test\"}"; $this->assertEquals($expected, $serializedMessage); } @@ -80,13 +78,13 @@ class FormatTest extends MockeryTestCase $message = new Message( level: Level::Info, trace: debug_backtrace()[0], - content: "hello world", + content: "hello world" ); $format = Format::IntelliJ; $serializedMessage = $format->serialize($message); - $full_date = (new DateTime())->format('Y-m-d H:i:s'); - $expected = "$full_date [1182] INFO - TestCase - hello world"; + $full_date = (new DateTime())->format("Y-m-d H:i:s"); + $expected = "$full_date [1104] INFO - TestCase - hello world"; $this->assertEquals($expected, $serializedMessage); } @@ -97,13 +95,13 @@ class FormatTest extends MockeryTestCase level: Level::Info, trace: debug_backtrace()[0], content: "hello world", - context: "hello world", + context: "hello world" ); $format = Format::IntelliJ; $serializedMessage = $format->serialize($message); - $full_date = (new DateTime())->format('Y-m-d H:i:s'); - $expected = "$full_date [1182] INFO - TestCase - hello world \"hello world\""; + $full_date = (new DateTime())->format("Y-m-d H:i:s"); + $expected = "$full_date [1104] INFO - TestCase - hello world \"hello world\""; $this->assertEquals($expected, $serializedMessage); } @@ -114,13 +112,13 @@ class FormatTest extends MockeryTestCase level: Level::Info, trace: debug_backtrace()[0], content: "hello world", - context: 123456789, + context: 123456789 ); $format = Format::IntelliJ; $serializedMessage = $format->serialize($message); - $full_date = (new DateTime())->format('Y-m-d H:i:s'); - $expected = "$full_date [1182] INFO - TestCase - hello world 123456789"; + $full_date = (new DateTime())->format("Y-m-d H:i:s"); + $expected = "$full_date [1104] INFO - TestCase - hello world 123456789"; $this->assertEquals($expected, $serializedMessage); } @@ -130,13 +128,13 @@ class FormatTest extends MockeryTestCase $message = new Message( level: Level::Info, trace: debug_backtrace()[0], - content: 'test', - context: ['message' => 'test'], + content: "test", + context: ["message" => "test"] ); $format = Format::Laravel; $serializedMessage = $format->serialize($message); - $full_date = (new DateTime())->format('Y-m-d H:i:s'); + $full_date = (new DateTime())->format("Y-m-d H:i:s"); $expected = "[$full_date] TestCase.INFO: test {\"message\":\"test\"}"; $this->assertEquals($expected, $serializedMessage); @@ -147,12 +145,12 @@ class FormatTest extends MockeryTestCase $message = new Message( level: Level::Info, trace: debug_backtrace()[0], - content: "hello world", + content: "hello world" ); $format = Format::Laravel; $serializedMessage = $format->serialize($message); - $full_date = (new DateTime())->format('Y-m-d H:i:s'); + $full_date = (new DateTime())->format("Y-m-d H:i:s"); $expected = "[$full_date] TestCase.INFO: hello world"; $this->assertEquals($expected, $serializedMessage); @@ -164,12 +162,12 @@ class FormatTest extends MockeryTestCase level: Level::Info, trace: debug_backtrace()[0], content: "hello world", - context: "hello world", + context: "hello world" ); $format = Format::Laravel; $serializedMessage = $format->serialize($message); - $full_date = (new DateTime())->format('Y-m-d H:i:s'); + $full_date = (new DateTime())->format("Y-m-d H:i:s"); $expected = "[$full_date] TestCase.INFO: hello world \"hello world\""; $this->assertEquals($expected, $serializedMessage); @@ -181,12 +179,12 @@ class FormatTest extends MockeryTestCase level: Level::Info, trace: debug_backtrace()[0], content: "hello world", - context: 123456789, + context: 123456789 ); $format = Format::Laravel; $serializedMessage = $format->serialize($message); - $full_date = (new DateTime())->format('Y-m-d H:i:s'); + $full_date = (new DateTime())->format("Y-m-d H:i:s"); $expected = "[$full_date] TestCase.INFO: hello world 123456789"; $this->assertEquals($expected, $serializedMessage); @@ -194,18 +192,18 @@ class FormatTest extends MockeryTestCase public function testSymfony(): void { - $mock_datetime = Mockery::mock('DateTime'); - $mock_datetime->shouldReceive('format')->andReturn('2020-01-01T00:00:00.000000P'); + $mock_datetime = Mockery::mock("DateTime"); + $mock_datetime->shouldReceive("format")->andReturn("2020-01-01T00:00:00.000000P"); $message = new Message( level: Level::Info, trace: debug_backtrace()[0], - context: ['message' => 'test'], + context: ["message" => "test"] ); $format = Format::Symfony; $serializedMessage = $format->serialize($message, $mock_datetime); - $full_date = $mock_datetime->format('Y-m-d\TH:i:s.uP'); + $full_date = $mock_datetime->format("Y-m-d\TH:i:s.uP"); $expected = "[$full_date] TestCase.INFO: {\"message\":\"test\"}"; $this->assertEquals($expected, $serializedMessage); @@ -213,19 +211,19 @@ class FormatTest extends MockeryTestCase public function testSymfonyStr(): void { - $mock_datetime = Mockery::mock('DateTime'); - $mock_datetime->shouldReceive('format')->andReturn('2020-01-01T00:00:00.000000P'); + $mock_datetime = Mockery::mock("DateTime"); + $mock_datetime->shouldReceive("format")->andReturn("2020-01-01T00:00:00.000000P"); $message = new Message( level: Level::Info, trace: debug_backtrace()[0], content: "hello world", - context: "hello world", + context: "hello world" ); $format = Format::Symfony; $serializedMessage = $format->serialize($message, $mock_datetime); - $full_date = $mock_datetime->format('Y-m-d\TH:i:s.uP'); + $full_date = $mock_datetime->format("Y-m-d\TH:i:s.uP"); $expected = "[$full_date] TestCase.INFO: hello world \"hello world\""; $this->assertEquals($expected, $serializedMessage); @@ -233,18 +231,14 @@ class FormatTest extends MockeryTestCase public function testSymfonyNoContentOrContext(): void { - $mock_datetime = Mockery::mock('DateTime'); - $mock_datetime->shouldReceive('format')->andReturn('2020-01-01T00:00:00.000000P'); + $mock_datetime = Mockery::mock("DateTime"); + $mock_datetime->shouldReceive("format")->andReturn("2020-01-01T00:00:00.000000P"); - $message = new Message( - level: Level::Info, - trace: debug_backtrace()[0], - context: [], - ); + $message = new Message(level: Level::Info, trace: debug_backtrace()[0], context: []); $format = Format::Symfony; $serializedMessage = $format->serialize($message, $mock_datetime); - $full_date = $mock_datetime->format('Y-m-d\TH:i:s.uP'); + $full_date = $mock_datetime->format("Y-m-d\TH:i:s.uP"); $expected = "[$full_date] TestCase.INFO: []"; $this->assertEquals($expected, $serializedMessage); @@ -252,19 +246,16 @@ class FormatTest extends MockeryTestCase public function testSymfonyNoContext(): void { - $mock_datetime = Mockery::mock('DateTime'); - $mock_datetime->shouldReceive('format')->andReturn('2020-01-01T00:00:00.000000P'); + $mock_datetime = Mockery::mock("DateTime"); + $mock_datetime->shouldReceive("format")->andReturn("2020-01-01T00:00:00.000000P"); - $message = new Message( - level: Level::Info, - trace: debug_backtrace()[0], - ); + $message = new Message(level: Level::Info, trace: debug_backtrace()[0]); $format = Format::Symfony; $serializedMessage = $format->serialize($message, $mock_datetime); - $full_date = $mock_datetime->format('Y-m-d\TH:i:s.uP'); + $full_date = $mock_datetime->format("Y-m-d\TH:i:s.uP"); $expected = "[$full_date] TestCase.INFO:"; $this->assertEquals($expected, $serializedMessage); } -}
\ No newline at end of file +} diff --git a/tests/LoggrTest.php b/tests/LoggrTest.php index 29cdce2..2503609 100644 --- a/tests/LoggrTest.php +++ b/tests/LoggrTest.php @@ -12,7 +12,7 @@ class LoggrTest extends TestCase public function testNoDriver(): void { $logger = new Loggr(); - $logger->info('test'); + $logger->info("test"); $this->assertEquals("Driver or format not set.", $logger->error); } @@ -20,63 +20,82 @@ class LoggrTest extends TestCase { $logger = new Loggr(new OutputDriver()); $logger->format = null; - $logger->info('test'); + $logger->info("test"); $this->assertEquals("Driver or format not set.", $logger->error); } public function testInterpolation(): void { - $full_date = (new DateTime())->format('Y-m-d H:i:s'); - $this->expectOutputString("[$full_date] LoggrTest.INFO: test something {\"interpolation\":\"something\"}"); + $full_date = (new DateTime())->format("Y-m-d H:i:s"); + $this->expectOutputString( + "[$full_date] LoggrTest.INFO: test something {\"interpolation\":\"something\"}" . + PHP_EOL + ); $logger = new Loggr(new OutputDriver()); - $logger->info('test {interpolation}', ['interpolation' => 'something']); + $logger->info("test {interpolation}", ["interpolation" => "something"]); } public function testNestedInterpolation(): void { - $full_date = (new DateTime())->format('Y-m-d H:i:s'); - $this->expectOutputString("[$full_date] LoggrTest.INFO: test something {\"nested\":{\"interpolation\":\"something\"}}"); + $full_date = (new DateTime())->format("Y-m-d H:i:s"); + $this->expectOutputString( + "[$full_date] LoggrTest.INFO: test something {\"nested\":{\"interpolation\":\"something\"}}" . + PHP_EOL + ); $logger = new Loggr(new OutputDriver()); - $logger->info('test {nested.interpolation}', ['nested' => ['interpolation' => 'something']]); + $logger->info("test {nested.interpolation}", [ + "nested" => ["interpolation" => "something"], + ]); } public function testIntegerInterpolation(): void { - $full_date = (new DateTime())->format('Y-m-d H:i:s'); - $this->expectOutputString("[$full_date] LoggrTest.INFO: test 1234567890 {\"integer\":1234567890}"); + $full_date = (new DateTime())->format("Y-m-d H:i:s"); + $this->expectOutputString( + "[$full_date] LoggrTest.INFO: test 1234567890 {\"integer\":1234567890}" . PHP_EOL + ); $logger = new Loggr(new OutputDriver()); - $logger->info('test {integer}', ['integer' => 1234567890]); + $logger->info("test {integer}", ["integer" => 1234567890]); } public function testBooleanInterpolation(): void { - $full_date = (new DateTime())->format('Y-m-d H:i:s'); - $this->expectOutputString("[$full_date] LoggrTest.INFO: test 1 {\"boolean\":true}"); + $full_date = (new DateTime())->format("Y-m-d H:i:s"); + $this->expectOutputString( + "[$full_date] LoggrTest.INFO: test 1 {\"boolean\":true}" . PHP_EOL + ); $logger = new Loggr(new OutputDriver()); - $logger->info('test {boolean}', ['boolean' => true]); + $logger->info("test {boolean}", ["boolean" => true]); } public function testDoubleInterpolation(): void { - $full_date = (new DateTime())->format('Y-m-d H:i:s'); - $this->expectOutputString("[$full_date] LoggrTest.INFO: test 1234567890.1235 {\"double\":1234567890.1234567}"); + $full_date = (new DateTime())->format("Y-m-d H:i:s"); + $this->expectOutputString( + "[$full_date] LoggrTest.INFO: test 1234567890.1235 {\"double\":1234567890.1234567}" . + PHP_EOL + ); $logger = new Loggr(new OutputDriver()); - $logger->info('test {double}', ['double' => 1234567890.1234567]); + $logger->info("test {double}", ["double" => 1234567890.1234567]); } public function testNullInterpolation(): void { - $full_date = (new DateTime())->format('Y-m-d H:i:s'); - $this->expectOutputString("[$full_date] LoggrTest.INFO: test null {\"null\":null}"); + $full_date = (new DateTime())->format("Y-m-d H:i:s"); + $this->expectOutputString( + "[$full_date] LoggrTest.INFO: test null {\"null\":null}" . PHP_EOL + ); $logger = new Loggr(new OutputDriver()); - $logger->info('test {null}', ['null' => null]); + $logger->info("test {null}", ["null" => null]); } public function testObjectInterpolation(): void { - $full_date = (new DateTime())->format('Y-m-d H:i:s'); - $this->expectOutputString("[$full_date] LoggrTest.INFO: test test {\"object\":{\"test\":\"test\"}}"); + $full_date = (new DateTime())->format("Y-m-d H:i:s"); + $this->expectOutputString( + "[$full_date] LoggrTest.INFO: test test {\"object\":{\"test\":\"test\"}}" . PHP_EOL + ); $logger = new Loggr(new OutputDriver()); - $logger->info('test {object.test}', ['object' => (object) ['test' => 'test']]); + $logger->info("test {object.test}", ["object" => (object) ["test" => "test"]]); } -}
\ No newline at end of file +} |
