diff --git a/composer.lock b/composer.lock index 4e3dabfad..8f36ddeb3 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "brick/math", - "version": "0.14.1", + "version": "0.14.8", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "f05858549e5f9d7bb45875a75583240a38a281d0" + "reference": "63422359a44b7f06cae63c3b429b59e8efcc0629" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/f05858549e5f9d7bb45875a75583240a38a281d0", - "reference": "f05858549e5f9d7bb45875a75583240a38a281d0", + "url": "https://api.github.com/repos/brick/math/zipball/63422359a44b7f06cae63c3b429b59e8efcc0629", + "reference": "63422359a44b7f06cae63c3b429b59e8efcc0629", "shasum": "" }, "require": { @@ -56,7 +56,7 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.14.1" + "source": "https://github.com/brick/math/tree/0.14.8" }, "funding": [ { @@ -64,7 +64,7 @@ "type": "github" } ], - "time": "2025-11-24T14:40:29+00:00" + "time": "2026-02-10T14:33:43+00:00" }, { "name": "doctrine/dbal", @@ -174,29 +174,29 @@ }, { "name": "doctrine/deprecations", - "version": "1.1.5", + "version": "1.1.6", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38" + "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", - "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", + "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "conflict": { - "phpunit/phpunit": "<=7.5 || >=13" + "phpunit/phpunit": "<=7.5 || >=14" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^12 || ^13", - "phpstan/phpstan": "1.4.10 || 2.1.11", + "doctrine/coding-standard": "^9 || ^12 || ^14", + "phpstan/phpstan": "1.4.10 || 2.1.30", "phpstan/phpstan-phpunit": "^1.0 || ^2", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12.4 || ^13.0", "psr/log": "^1 || ^2 || ^3" }, "suggest": { @@ -216,22 +216,22 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.5" + "source": "https://github.com/doctrine/deprecations/tree/1.1.6" }, - "time": "2025-04-07T20:06:18+00:00" + "time": "2026-02-07T07:09:04+00:00" }, { "name": "doctrine/event-manager", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/doctrine/event-manager.git", - "reference": "c07799fcf5ad362050960a0fd068dded40b1e312" + "reference": "dda33921b198841ca8dbad2eaa5d4d34769d18cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/c07799fcf5ad362050960a0fd068dded40b1e312", - "reference": "c07799fcf5ad362050960a0fd068dded40b1e312", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/dda33921b198841ca8dbad2eaa5d4d34769d18cf", + "reference": "dda33921b198841ca8dbad2eaa5d4d34769d18cf", "shasum": "" }, "require": { @@ -293,7 +293,7 @@ ], "support": { "issues": "https://github.com/doctrine/event-manager/issues", - "source": "https://github.com/doctrine/event-manager/tree/2.1.0" + "source": "https://github.com/doctrine/event-manager/tree/2.1.1" }, "funding": [ { @@ -309,20 +309,20 @@ "type": "tidelift" } ], - "time": "2026-01-17T22:40:21+00:00" + "time": "2026-01-29T07:11:08+00:00" }, { "name": "doctrine/migrations", - "version": "3.9.5", + "version": "3.9.6", "source": { "type": "git", "url": "https://github.com/doctrine/migrations.git", - "reference": "1b823afbc40f932dae8272574faee53f2755eac5" + "reference": "ffd8355cdd8505fc650d9604f058bf62aedd80a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/migrations/zipball/1b823afbc40f932dae8272574faee53f2755eac5", - "reference": "1b823afbc40f932dae8272574faee53f2755eac5", + "url": "https://api.github.com/repos/doctrine/migrations/zipball/ffd8355cdd8505fc650d9604f058bf62aedd80a1", + "reference": "ffd8355cdd8505fc650d9604f058bf62aedd80a1", "shasum": "" }, "require": { @@ -396,7 +396,7 @@ ], "support": { "issues": "https://github.com/doctrine/migrations/issues", - "source": "https://github.com/doctrine/migrations/tree/3.9.5" + "source": "https://github.com/doctrine/migrations/tree/3.9.6" }, "funding": [ { @@ -412,20 +412,20 @@ "type": "tidelift" } ], - "time": "2025-11-20T11:15:36+00:00" + "time": "2026-02-11T06:46:11+00:00" }, { "name": "patchlevel/hydrator", - "version": "1.13.0", + "version": "1.16.0", "source": { "type": "git", "url": "https://github.com/patchlevel/hydrator.git", - "reference": "dc6fe9a835edaa2d6972ad148738eaeb95a6cb35" + "reference": "27b29f806f366194752cbaaa241e426bed2d942f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/patchlevel/hydrator/zipball/dc6fe9a835edaa2d6972ad148738eaeb95a6cb35", - "reference": "dc6fe9a835edaa2d6972ad148738eaeb95a6cb35", + "url": "https://api.github.com/repos/patchlevel/hydrator/zipball/27b29f806f366194752cbaaa241e426bed2d942f", + "reference": "27b29f806f366194752cbaaa241e426bed2d942f", "shasum": "" }, "require": { @@ -437,13 +437,13 @@ "symfony/type-info": "^7.3.0 || ^8.0.0" }, "require-dev": { - "infection/infection": "^0.31.9", + "infection/infection": "^0.32.4", "patchlevel/coding-standard": "^1.3.0", - "phpat/phpat": "^0.12.0", - "phpbench/phpbench": "^1.2.15", - "phpstan/phpstan": "^2.1.32", - "phpstan/phpstan-phpunit": "^2.0.8", - "phpunit/phpunit": "^11.5.17", + "phpat/phpat": "^0.12.2", + "phpbench/phpbench": "^1.4.3", + "phpstan/phpstan": "^2.1.39", + "phpstan/phpstan-phpunit": "^2.0.15", + "phpunit/phpunit": "^11.5.53", "symfony/var-dumper": "^5.4.29 || ^6.4.0 || ^7.0.0 || ^8.0.0" }, "type": "library", @@ -474,9 +474,9 @@ ], "support": { "issues": "https://github.com/patchlevel/hydrator/issues", - "source": "https://github.com/patchlevel/hydrator/tree/1.13.0" + "source": "https://github.com/patchlevel/hydrator/tree/1.16.0" }, - "time": "2025-11-27T16:58:40+00:00" + "time": "2026-02-17T11:56:35+00:00" }, { "name": "patchlevel/worker", @@ -995,16 +995,16 @@ }, { "name": "symfony/console", - "version": "v8.0.3", + "version": "v8.0.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "6145b304a5c1ea0bdbd0b04d297a5864f9a7d587" + "reference": "ace03c4cf9805080ff40cbeec69fca180c339a3b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/6145b304a5c1ea0bdbd0b04d297a5864f9a7d587", - "reference": "6145b304a5c1ea0bdbd0b04d297a5864f9a7d587", + "url": "https://api.github.com/repos/symfony/console/zipball/ace03c4cf9805080ff40cbeec69fca180c339a3b", + "reference": "ace03c4cf9805080ff40cbeec69fca180c339a3b", "shasum": "" }, "require": { @@ -1061,7 +1061,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v8.0.3" + "source": "https://github.com/symfony/console/tree/v8.0.4" }, "funding": [ { @@ -1081,7 +1081,7 @@ "type": "tidelift" } ], - "time": "2025-12-23T14:52:06+00:00" + "time": "2026-01-13T13:06:50+00:00" }, { "name": "symfony/deprecation-contracts", @@ -1152,16 +1152,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v8.0.0", + "version": "v8.0.4", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "573f95783a2ec6e38752979db139f09fec033f03" + "reference": "99301401da182b6cfaa4700dbe9987bb75474b47" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/573f95783a2ec6e38752979db139f09fec033f03", - "reference": "573f95783a2ec6e38752979db139f09fec033f03", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/99301401da182b6cfaa4700dbe9987bb75474b47", + "reference": "99301401da182b6cfaa4700dbe9987bb75474b47", "shasum": "" }, "require": { @@ -1213,7 +1213,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/v8.0.0" + "source": "https://github.com/symfony/event-dispatcher/tree/v8.0.4" }, "funding": [ { @@ -1233,7 +1233,7 @@ "type": "tidelift" } ], - "time": "2025-10-30T14:17:19+00:00" + "time": "2026-01-05T11:45:55+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -1313,16 +1313,16 @@ }, { "name": "symfony/finder", - "version": "v8.0.3", + "version": "v8.0.5", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "dd3a2953570a283a2ba4e17063bb98c734cf5b12" + "reference": "8bd576e97c67d45941365bf824e18dc8538e6eb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/dd3a2953570a283a2ba4e17063bb98c734cf5b12", - "reference": "dd3a2953570a283a2ba4e17063bb98c734cf5b12", + "url": "https://api.github.com/repos/symfony/finder/zipball/8bd576e97c67d45941365bf824e18dc8538e6eb0", + "reference": "8bd576e97c67d45941365bf824e18dc8538e6eb0", "shasum": "" }, "require": { @@ -1357,7 +1357,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v8.0.3" + "source": "https://github.com/symfony/finder/tree/v8.0.5" }, "funding": [ { @@ -1377,7 +1377,7 @@ "type": "tidelift" } ], - "time": "2025-12-23T14:52:06+00:00" + "time": "2026-01-26T15:08:38+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1869,16 +1869,16 @@ }, { "name": "symfony/string", - "version": "v8.0.1", + "version": "v8.0.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc" + "reference": "758b372d6882506821ed666032e43020c4f57194" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ba65a969ac918ce0cc3edfac6cdde847eba231dc", - "reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc", + "url": "https://api.github.com/repos/symfony/string/zipball/758b372d6882506821ed666032e43020c4f57194", + "reference": "758b372d6882506821ed666032e43020c4f57194", "shasum": "" }, "require": { @@ -1935,7 +1935,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v8.0.1" + "source": "https://github.com/symfony/string/tree/v8.0.4" }, "funding": [ { @@ -1955,20 +1955,20 @@ "type": "tidelift" } ], - "time": "2025-12-01T09:13:36+00:00" + "time": "2026-01-12T12:37:40+00:00" }, { "name": "symfony/type-info", - "version": "v8.0.1", + "version": "v8.0.4", "source": { "type": "git", "url": "https://github.com/symfony/type-info.git", - "reference": "bb091cec1f70383538c7d000699781813f8d1a6a" + "reference": "106a2d3bbf0d4576b2f70e6ca866fa420956ed0d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/type-info/zipball/bb091cec1f70383538c7d000699781813f8d1a6a", - "reference": "bb091cec1f70383538c7d000699781813f8d1a6a", + "url": "https://api.github.com/repos/symfony/type-info/zipball/106a2d3bbf0d4576b2f70e6ca866fa420956ed0d", + "reference": "106a2d3bbf0d4576b2f70e6ca866fa420956ed0d", "shasum": "" }, "require": { @@ -2017,7 +2017,7 @@ "type" ], "support": { - "source": "https://github.com/symfony/type-info/tree/v8.0.1" + "source": "https://github.com/symfony/type-info/tree/v8.0.4" }, "funding": [ { @@ -2037,7 +2037,7 @@ "type": "tidelift" } ], - "time": "2025-12-05T14:08:45+00:00" + "time": "2026-01-09T12:15:10+00:00" }, { "name": "symfony/var-exporter", @@ -2926,16 +2926,16 @@ }, { "name": "doctrine/orm", - "version": "3.6.1", + "version": "3.6.2", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "2148940290e4c44b9101095707e71fb590832fa5" + "reference": "4262eb495b4d2a53b45de1ac58881e0091f2970f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/2148940290e4c44b9101095707e71fb590832fa5", - "reference": "2148940290e4c44b9101095707e71fb590832fa5", + "url": "https://api.github.com/repos/doctrine/orm/zipball/4262eb495b4d2a53b45de1ac58881e0091f2970f", + "reference": "4262eb495b4d2a53b45de1ac58881e0091f2970f", "shasum": "" }, "require": { @@ -3008,9 +3008,9 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/3.6.1" + "source": "https://github.com/doctrine/orm/tree/3.6.2" }, - "time": "2026-01-09T05:28:15+00:00" + "time": "2026-01-30T21:41:41+00:00" }, { "name": "doctrine/persistence", @@ -3345,16 +3345,16 @@ }, { "name": "infection/infection", - "version": "0.32.3", + "version": "0.32.5", "source": { "type": "git", "url": "https://github.com/infection/infection.git", - "reference": "3654db483619b63b9bcb04c24caeb03677c6d057" + "reference": "932fc7aa7a03bdbe387e42f8c8bd17d9d347653e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/infection/infection/zipball/3654db483619b63b9bcb04c24caeb03677c6d057", - "reference": "3654db483619b63b9bcb04c24caeb03677c6d057", + "url": "https://api.github.com/repos/infection/infection/zipball/932fc7aa7a03bdbe387e42f8c8bd17d9d347653e", + "reference": "932fc7aa7a03bdbe387e42f8c8bd17d9d347653e", "shasum": "" }, "require": { @@ -3375,11 +3375,11 @@ "ondram/ci-detector": "^4.1.0", "php": "^8.2", "psr/log": "^2.0 || ^3.0", - "sanmai/di-container": "^0.1.4", + "sanmai/di-container": "^0.1.12", "sanmai/duoclock": "^0.1.0", "sanmai/later": "^0.1.7", - "sanmai/pipeline": "^7.0", - "sebastian/diff": "^4.0 || ^5.0 || ^6.0 || ^7.0", + "sanmai/pipeline": "^7.2", + "sebastian/diff": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0", "symfony/console": "^6.4 || ^7.0 || ^8.0", "symfony/filesystem": "^6.4 || ^7.0 || ^8.0", "symfony/finder": "^6.4 || ^7.0 || ^8.0", @@ -3465,7 +3465,7 @@ ], "support": { "issues": "https://github.com/infection/infection/issues", - "source": "https://github.com/infection/infection/tree/0.32.3" + "source": "https://github.com/infection/infection/tree/0.32.5" }, "funding": [ { @@ -3477,7 +3477,7 @@ "type": "open_collective" } ], - "time": "2026-01-13T14:23:38+00:00" + "time": "2026-02-20T07:59:31+00:00" }, { "name": "infection/mutator", @@ -3534,16 +3534,16 @@ }, { "name": "justinrainbow/json-schema", - "version": "6.6.4", + "version": "v6.7.2", "source": { "type": "git", "url": "https://github.com/jsonrainbow/json-schema.git", - "reference": "2eeb75d21cf73211335888e7f5e6fd7440723ec7" + "reference": "6fea66c7204683af437864e7c4e7abf383d14bc0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/2eeb75d21cf73211335888e7f5e6fd7440723ec7", - "reference": "2eeb75d21cf73211335888e7f5e6fd7440723ec7", + "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/6fea66c7204683af437864e7c4e7abf383d14bc0", + "reference": "6fea66c7204683af437864e7c4e7abf383d14bc0", "shasum": "" }, "require": { @@ -3603,9 +3603,9 @@ ], "support": { "issues": "https://github.com/jsonrainbow/json-schema/issues", - "source": "https://github.com/jsonrainbow/json-schema/tree/6.6.4" + "source": "https://github.com/jsonrainbow/json-schema/tree/v6.7.2" }, - "time": "2025-12-19T15:01:32+00:00" + "time": "2026-02-15T15:06:22+00:00" }, { "name": "league/commonmark", @@ -3931,16 +3931,16 @@ }, { "name": "nette/schema", - "version": "v1.3.3", + "version": "v1.3.4", "source": { "type": "git", "url": "https://github.com/nette/schema.git", - "reference": "2befc2f42d7c715fd9d95efc31b1081e5d765004" + "reference": "086497a2f34b82fede9b5a41cc8e131d087cd8f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/schema/zipball/2befc2f42d7c715fd9d95efc31b1081e5d765004", - "reference": "2befc2f42d7c715fd9d95efc31b1081e5d765004", + "url": "https://api.github.com/repos/nette/schema/zipball/086497a2f34b82fede9b5a41cc8e131d087cd8f7", + "reference": "086497a2f34b82fede9b5a41cc8e131d087cd8f7", "shasum": "" }, "require": { @@ -3948,8 +3948,8 @@ "php": "8.1 - 8.5" }, "require-dev": { - "nette/tester": "^2.5.2", - "phpstan/phpstan-nette": "^2.0@stable", + "nette/tester": "^2.6", + "phpstan/phpstan": "^2.0@stable", "tracy/tracy": "^2.8" }, "type": "library", @@ -3990,22 +3990,22 @@ ], "support": { "issues": "https://github.com/nette/schema/issues", - "source": "https://github.com/nette/schema/tree/v1.3.3" + "source": "https://github.com/nette/schema/tree/v1.3.4" }, - "time": "2025-10-30T22:57:59+00:00" + "time": "2026-02-08T02:54:00+00:00" }, { "name": "nette/utils", - "version": "v4.1.1", + "version": "v4.1.3", "source": { "type": "git", "url": "https://github.com/nette/utils.git", - "reference": "c99059c0315591f1a0db7ad6002000288ab8dc72" + "reference": "bb3ea637e3d131d72acc033cfc2746ee893349fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/c99059c0315591f1a0db7ad6002000288ab8dc72", - "reference": "c99059c0315591f1a0db7ad6002000288ab8dc72", + "url": "https://api.github.com/repos/nette/utils/zipball/bb3ea637e3d131d72acc033cfc2746ee893349fe", + "reference": "bb3ea637e3d131d72acc033cfc2746ee893349fe", "shasum": "" }, "require": { @@ -4017,8 +4017,10 @@ }, "require-dev": { "jetbrains/phpstorm-attributes": "^1.2", + "nette/phpstan-rules": "^1.0", "nette/tester": "^2.5", - "phpstan/phpstan-nette": "^2.0@stable", + "phpstan/extension-installer": "^1.4@stable", + "phpstan/phpstan": "^2.1@stable", "tracy/tracy": "^2.9" }, "suggest": { @@ -4079,9 +4081,9 @@ ], "support": { "issues": "https://github.com/nette/utils/issues", - "source": "https://github.com/nette/utils/tree/v4.1.1" + "source": "https://github.com/nette/utils/tree/v4.1.3" }, - "time": "2025-12-22T12:14:32+00:00" + "time": "2026-02-13T03:05:33+00:00" }, { "name": "nikic/php-parser", @@ -4394,16 +4396,16 @@ }, { "name": "phpat/phpat", - "version": "0.12.1", + "version": "0.12.3", "source": { "type": "git", "url": "https://github.com/carlosas/phpat.git", - "reference": "67b9e179757fbaa8b87e1469a66f103725858ee0" + "reference": "2412a8959254a076e751498cbba8cf29406e0cf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/carlosas/phpat/zipball/67b9e179757fbaa8b87e1469a66f103725858ee0", - "reference": "67b9e179757fbaa8b87e1469a66f103725858ee0", + "url": "https://api.github.com/repos/carlosas/phpat/zipball/2412a8959254a076e751498cbba8cf29406e0cf4", + "reference": "2412a8959254a076e751498cbba8cf29406e0cf4", "shasum": "" }, "require": { @@ -4445,9 +4447,9 @@ "description": "PHP Architecture Tester", "support": { "issues": "https://github.com/carlosas/phpat/issues", - "source": "https://github.com/carlosas/phpat/tree/0.12.1" + "source": "https://github.com/carlosas/phpat/tree/0.12.3" }, - "time": "2025-12-25T17:53:07+00:00" + "time": "2026-02-20T11:15:22+00:00" }, { "name": "phpbench/container", @@ -4600,16 +4602,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "2.3.1", + "version": "2.3.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "16dbf9937da8d4528ceb2145c9c7c0bd29e26374" + "reference": "a004701b11273a26cd7955a61d67a7f1e525a45a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/16dbf9937da8d4528ceb2145c9c7c0bd29e26374", - "reference": "16dbf9937da8d4528ceb2145c9c7c0bd29e26374", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/a004701b11273a26cd7955a61d67a7f1e525a45a", + "reference": "a004701b11273a26cd7955a61d67a7f1e525a45a", "shasum": "" }, "require": { @@ -4641,17 +4643,17 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.2" }, - "time": "2026-01-12T11:33:04+00:00" + "time": "2026-01-25T14:56:51+00:00" }, { "name": "phpstan/phpstan", - "version": "2.1.33", + "version": "2.1.39", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9e800e6bee7d5bd02784d4c6069b48032d16224f", - "reference": "9e800e6bee7d5bd02784d4c6069b48032d16224f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c6f73a2af4cbcd99c931d0fb8f08548cc0fa8224", + "reference": "c6f73a2af4cbcd99c931d0fb8f08548cc0fa8224", "shasum": "" }, "require": { @@ -4696,20 +4698,20 @@ "type": "github" } ], - "time": "2025-12-05T10:24:31+00:00" + "time": "2026-02-11T14:48:56+00:00" }, { "name": "phpstan/phpstan-phpunit", - "version": "2.0.11", + "version": "2.0.16", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "5e30669bef866eff70db8b58d72a5c185aa82414" + "reference": "6ab598e1bc106e6827fd346ae4a12b4a5d634c32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/5e30669bef866eff70db8b58d72a5c185aa82414", - "reference": "5e30669bef866eff70db8b58d72a5c185aa82414", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/6ab598e1bc106e6827fd346ae4a12b4a5d634c32", + "reference": "6ab598e1bc106e6827fd346ae4a12b4a5d634c32", "shasum": "" }, "require": { @@ -4745,11 +4747,14 @@ "MIT" ], "description": "PHPUnit extensions and rules for PHPStan", + "keywords": [ + "static analysis" + ], "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.11" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.16" }, - "time": "2025-12-19T09:05:35+00:00" + "time": "2026-02-14T09:05:21+00:00" }, { "name": "phpunit/php-code-coverage", @@ -4843,28 +4848,28 @@ }, { "name": "phpunit/php-file-iterator", - "version": "5.1.0", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6" + "reference": "2f3a64888c814fc235386b7387dd5b5ed92ad903" }, "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/2f3a64888c814fc235386b7387dd5b5ed92ad903", + "reference": "2f3a64888c814fc235386b7387dd5b5ed92ad903", "shasum": "" }, "require": { "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -4892,15 +4897,27 @@ "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/5.1.1" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-file-iterator", + "type": "tidelift" } ], - "time": "2024-08-27T05:02:59+00:00" + "time": "2026-02-02T13:52:54+00:00" }, { "name": "phpunit/php-invoker", @@ -5088,16 +5105,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.5.50", + "version": "11.5.55", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "fdfc727f0fcacfeb8fcb30c7e5da173125b58be3" + "reference": "adc7262fccc12de2b30f12a8aa0b33775d814f00" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fdfc727f0fcacfeb8fcb30c7e5da173125b58be3", - "reference": "fdfc727f0fcacfeb8fcb30c7e5da173125b58be3", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/adc7262fccc12de2b30f12a8aa0b33775d814f00", + "reference": "adc7262fccc12de2b30f12a8aa0b33775d814f00", "shasum": "" }, "require": { @@ -5112,7 +5129,7 @@ "phar-io/version": "^3.2.1", "php": ">=8.2", "phpunit/php-code-coverage": "^11.0.12", - "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-file-iterator": "^5.1.1", "phpunit/php-invoker": "^5.0.1", "phpunit/php-text-template": "^4.0.1", "phpunit/php-timer": "^7.0.1", @@ -5124,6 +5141,7 @@ "sebastian/exporter": "^6.3.2", "sebastian/global-state": "^7.0.2", "sebastian/object-enumerator": "^6.0.1", + "sebastian/recursion-context": "^6.0.3", "sebastian/type": "^5.1.3", "sebastian/version": "^5.0.2", "staabm/side-effects-detector": "^1.0.5" @@ -5169,7 +5187,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.5.50" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.55" }, "funding": [ { @@ -5193,20 +5211,20 @@ "type": "tidelift" } ], - "time": "2026-01-27T05:59:18+00:00" + "time": "2026-02-18T12:37:06+00:00" }, { "name": "sanmai/di-container", - "version": "0.1.11", + "version": "0.1.12", "source": { "type": "git", "url": "https://github.com/sanmai/di-container.git", - "reference": "4723e235e04589f88c0a114a4e438ff57a7cbb8a" + "reference": "8b9ad72f6ac1f9e185e5bd060dc9479cb5191d8b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sanmai/di-container/zipball/4723e235e04589f88c0a114a4e438ff57a7cbb8a", - "reference": "4723e235e04589f88c0a114a4e438ff57a7cbb8a", + "url": "https://api.github.com/repos/sanmai/di-container/zipball/8b9ad72f6ac1f9e185e5bd060dc9479cb5191d8b", + "reference": "8b9ad72f6ac1f9e185e5bd060dc9479cb5191d8b", "shasum": "" }, "require": { @@ -5264,7 +5282,7 @@ ], "support": { "issues": "https://github.com/sanmai/di-container/issues", - "source": "https://github.com/sanmai/di-container/tree/0.1.11" + "source": "https://github.com/sanmai/di-container/tree/0.1.12" }, "funding": [ { @@ -5272,7 +5290,7 @@ "type": "github" } ], - "time": "2026-01-13T07:38:17+00:00" + "time": "2026-01-27T08:25:46+00:00" }, { "name": "sanmai/duoclock", @@ -6864,16 +6882,16 @@ }, { "name": "symfony/messenger", - "version": "v8.0.3", + "version": "v8.0.4", "source": { "type": "git", "url": "https://github.com/symfony/messenger.git", - "reference": "b56b89aee16ceb623f76c8739ab62202ec198190" + "reference": "3483db96bcc33310cd1807d2b962e7e01d9f41c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/messenger/zipball/b56b89aee16ceb623f76c8739ab62202ec198190", - "reference": "b56b89aee16ceb623f76c8739ab62202ec198190", + "url": "https://api.github.com/repos/symfony/messenger/zipball/3483db96bcc33310cd1807d2b962e7e01d9f41c2", + "reference": "3483db96bcc33310cd1807d2b962e7e01d9f41c2", "shasum": "" }, "require": { @@ -6883,7 +6901,9 @@ }, "conflict": { "symfony/console": "<7.4", - "symfony/event-dispatcher-contracts": "<2.5" + "symfony/event-dispatcher-contracts": "<2.5", + "symfony/lock": "<7.4", + "symfony/serializer": "<7.4.4|>=8.0,<8.0.4" }, "require-dev": { "psr/cache": "^1.0|^2.0|^3.0", @@ -6896,7 +6916,7 @@ "symfony/property-access": "^7.4|^8.0", "symfony/rate-limiter": "^7.4|^8.0", "symfony/routing": "^7.4|^8.0", - "symfony/serializer": "^7.4|^8.0", + "symfony/serializer": "^7.4.4|^8.0.4", "symfony/service-contracts": "^2.5|^3", "symfony/stopwatch": "^7.4|^8.0", "symfony/validator": "^7.4|^8.0", @@ -6928,7 +6948,7 @@ "description": "Helps applications send and receive messages to/from other applications or via message queues", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/messenger/tree/v8.0.3" + "source": "https://github.com/symfony/messenger/tree/v8.0.4" }, "funding": [ { @@ -6948,7 +6968,7 @@ "type": "tidelift" } ], - "time": "2025-12-23T14:52:06+00:00" + "time": "2026-01-08T22:36:47+00:00" }, { "name": "symfony/options-resolver", @@ -7267,16 +7287,16 @@ }, { "name": "symfony/process", - "version": "v8.0.3", + "version": "v8.0.5", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "0cbbd88ec836f8757641c651bb995335846abb78" + "reference": "b5f3aa6762e33fd95efbaa2ec4f4bc9fdd16d674" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/0cbbd88ec836f8757641c651bb995335846abb78", - "reference": "0cbbd88ec836f8757641c651bb995335846abb78", + "url": "https://api.github.com/repos/symfony/process/zipball/b5f3aa6762e33fd95efbaa2ec4f4bc9fdd16d674", + "reference": "b5f3aa6762e33fd95efbaa2ec4f4bc9fdd16d674", "shasum": "" }, "require": { @@ -7308,7 +7328,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v8.0.3" + "source": "https://github.com/symfony/process/tree/v8.0.5" }, "funding": [ { @@ -7328,20 +7348,20 @@ "type": "tidelift" } ], - "time": "2025-12-19T10:01:18+00:00" + "time": "2026-01-26T15:08:38+00:00" }, { "name": "symfony/var-dumper", - "version": "v8.0.3", + "version": "v8.0.4", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "3bc368228532ad538cc216768caa8968be95a8d6" + "reference": "326e0406fc315eca57ef5740fa4a280b7a068c82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/3bc368228532ad538cc216768caa8968be95a8d6", - "reference": "3bc368228532ad538cc216768caa8968be95a8d6", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/326e0406fc315eca57ef5740fa4a280b7a068c82", + "reference": "326e0406fc315eca57ef5740fa4a280b7a068c82", "shasum": "" }, "require": { @@ -7395,7 +7415,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v8.0.3" + "source": "https://github.com/symfony/var-dumper/tree/v8.0.4" }, "funding": [ { @@ -7415,20 +7435,20 @@ "type": "tidelift" } ], - "time": "2025-12-18T11:23:51+00:00" + "time": "2026-01-01T23:07:29+00:00" }, { "name": "thecodingmachine/safe", - "version": "v3.3.0", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/thecodingmachine/safe.git", - "reference": "2cdd579eeaa2e78e51c7509b50cc9fb89a956236" + "reference": "705683a25bacf0d4860c7dea4d7947bfd09eea19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thecodingmachine/safe/zipball/2cdd579eeaa2e78e51c7509b50cc9fb89a956236", - "reference": "2cdd579eeaa2e78e51c7509b50cc9fb89a956236", + "url": "https://api.github.com/repos/thecodingmachine/safe/zipball/705683a25bacf0d4860c7dea4d7947bfd09eea19", + "reference": "705683a25bacf0d4860c7dea4d7947bfd09eea19", "shasum": "" }, "require": { @@ -7538,7 +7558,7 @@ "description": "PHP core functions that throw exceptions instead of returning FALSE on error", "support": { "issues": "https://github.com/thecodingmachine/safe/issues", - "source": "https://github.com/thecodingmachine/safe/tree/v3.3.0" + "source": "https://github.com/thecodingmachine/safe/tree/v3.4.0" }, "funding": [ { @@ -7549,12 +7569,16 @@ "url": "https://github.com/shish", "type": "github" }, + { + "url": "https://github.com/silasjoisten", + "type": "github" + }, { "url": "https://github.com/staabm", "type": "github" } ], - "time": "2025-05-14T06:15:44+00:00" + "time": "2026-02-04T18:08:13+00:00" }, { "name": "theseer/tokenizer", @@ -7608,16 +7632,16 @@ }, { "name": "webmozart/assert", - "version": "2.1.2", + "version": "2.1.5", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "ce6a2f100c404b2d32a1dd1270f9b59ad4f57649" + "reference": "79155f94852fa27e2f73b459f6503f5e87e2c188" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/ce6a2f100c404b2d32a1dd1270f9b59ad4f57649", - "reference": "ce6a2f100c404b2d32a1dd1270f9b59ad4f57649", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/79155f94852fa27e2f73b459f6503f5e87e2c188", + "reference": "79155f94852fa27e2f73b459f6503f5e87e2c188", "shasum": "" }, "require": { @@ -7664,9 +7688,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/2.1.2" + "source": "https://github.com/webmozarts/assert/tree/2.1.5" }, - "time": "2026-01-13T14:02:24+00:00" + "time": "2026-02-18T14:09:36+00:00" }, { "name": "webmozart/glob", diff --git a/deptrac-baseline.yaml b/deptrac-baseline.yaml index 83ffb4da8..eb6a9bb9d 100644 --- a/deptrac-baseline.yaml +++ b/deptrac-baseline.yaml @@ -10,6 +10,8 @@ deptrac: - Patchlevel\EventSourcing\Subscription\RunMode Patchlevel\EventSourcing\Attribute\Projector: - Patchlevel\EventSourcing\Subscription\RunMode + Patchlevel\EventSourcing\Attribute\SharedApplyContext: + - Patchlevel\EventSourcing\Aggregate\AggregateRoot Patchlevel\EventSourcing\Attribute\Stream: - Patchlevel\EventSourcing\Aggregate\AggregateRoot Patchlevel\EventSourcing\Attribute\Subscriber: diff --git a/docs/pages/aggregate.md b/docs/pages/aggregate.md index 8439d427c..015f4de52 100644 --- a/docs/pages/aggregate.md +++ b/docs/pages/aggregate.md @@ -303,6 +303,11 @@ final class Profile extends BasicAggregateRoot } } ``` +!!! tip + + You don't necessarily need to define multiple `Apply` attributes with the event class + if you define the event types in the method using a union type. + ## Suppress missing apply methods Sometimes you have events that do not change the state of the aggregate itself, @@ -358,6 +363,38 @@ final class Profile extends BasicAggregateRoot When all events are suppressed, debugging becomes more difficult if you forget an apply method. +## Shared apply context + +When working with [micro-aggregates](./aggregate.md#micro-aggregates), +it’s common that events are applied by different aggregates. +As a result, an aggregate may receive events it does not handle, which can lead to multiple “missing apply” warnings. + +The `SharedApplyContext` attribute allows you to declare that several aggregates share the same apply context. +With this configuration, a missing apply is only reported if none of the shared aggregates handle the event. + +```php +use Patchlevel\EventSourcing\Aggregate\BasicAggregateRoot; +use Patchlevel\EventSourcing\Attribute\Aggregate; +use Patchlevel\EventSourcing\Attribute\SharedApplyContext; +use Patchlevel\EventSourcing\Attribute\Stream; + +#[Aggregate('profile')] +#[SharedApplyContext([PersonalInformation::class])] +final class Profile extends BasicAggregateRoot +{ +} + +#[Aggregate('personal_information')] +#[Stream(Profile::class)] +#[SharedApplyContext([Profile::class])] +final class PersonalInformation extends BasicAggregateRoot +{ +} +``` +!!! warning + + You need to define the `SharedApplyContext` attribute on all aggregates that share the apply context. + ## Stream Name !!! warning @@ -675,8 +712,10 @@ use Patchlevel\EventSourcing\Aggregate\Uuid; use Patchlevel\EventSourcing\Attribute\Aggregate; use Patchlevel\EventSourcing\Attribute\Apply; use Patchlevel\EventSourcing\Attribute\Id; +use Patchlevel\EventSourcing\Attribute\SharedApplyContext; #[Aggregate('order')] +#[SharedApplyContext([Shipping::class])] final class Order extends BasicAggregateRoot { #[Id] @@ -706,10 +745,12 @@ use Patchlevel\EventSourcing\Aggregate\Uuid; use Patchlevel\EventSourcing\Attribute\Aggregate; use Patchlevel\EventSourcing\Attribute\Apply; use Patchlevel\EventSourcing\Attribute\Id; +use Patchlevel\EventSourcing\Attribute\SharedApplyContext; use Patchlevel\EventSourcing\Attribute\Stream; #[Aggregate('shipping')] #[Stream(Order::class)] +#[SharedApplyContext([Order::class])] final class Shipping extends BasicAggregateRoot { #[Id] @@ -740,6 +781,11 @@ final class Shipping extends BasicAggregateRoot } } ``` +!!! tip + + With the [SharedApplyContext](./aggregate.md#shared-apply-context) attribute, + you can suppress missing applies for events that are handled by other aggregates. + ### Child Aggregates ??? example "Experimental" @@ -830,6 +876,53 @@ final class Order extends BasicAggregateRoot } } ``` + +## Auto Initialize + +??? example "Experimental" + + This feature is still experimental and may change in the future. + Use it with caution. + +Sometimes you want to be able to access an aggregate even if it has not yet been created in the system. +In this case, the aggregate should be automatically initialized if it cannot be found in the store. +To achieve this, the aggregate must mark the initialization method with the `AutoInitialize` attribute. +The method must be static, receives the aggregate ID as an argument and must return an instance of the aggregate. + +```php +use Patchlevel\EventSourcing\Aggregate\BasicAggregateRoot; +use Patchlevel\EventSourcing\Aggregate\Uuid; +use Patchlevel\EventSourcing\Attribute\Aggregate; +use Patchlevel\EventSourcing\Attribute\Apply; +use Patchlevel\EventSourcing\Attribute\AutoInitialize; +use Patchlevel\EventSourcing\Attribute\Id; + +#[Aggregate('profile')] +final class Profile extends BasicAggregateRoot +{ + #[Id] + private Uuid $id; + + #[AutoInitialize] + public static function initialize(Uuid $id): static + { + $self = new static(); + $self->recordThat(new ProfileCreated($id)); + + return $self; + } + + #[Apply] + public function applyProfileCreated(ProfileCreated $event): void + { + $this->id = $event->id; + } +} +``` +!!! note + + Recording events in the `initialize` method is optional but recommended. + ## Aggregate Root Registry The library needs to know about all aggregates so that the correct aggregate class is used to load from the database. diff --git a/docs/pages/command_bus.md b/docs/pages/command_bus.md index 75d23da1c..ea11339d7 100644 --- a/docs/pages/command_bus.md +++ b/docs/pages/command_bus.md @@ -45,6 +45,59 @@ final class CreateProfileHandler !!! tip A class can have multiple handle methods. + +### Multiple Handle Attributes + +A method can also have multiple `#[Handle]` attributes. +This is useful if you want to handle different commands with the same method. + +```php +use Patchlevel\EventSourcing\Attribute\Handle; + +final class CreateProfileHandler +{ + #[Handle(CreateProfile::class)] + #[Handle(UpdateProfile::class)] + public function __invoke(object $command): void + { + // handle both commands + } +} +``` + +### Union Types + +You can also use union types to handle multiple commands and the library will automatically detect the commands. + +```php +use Patchlevel\EventSourcing\Attribute\Handle; + +final class CreateProfileHandler +{ + #[Handle] + public function __invoke(CreateProfile|UpdateProfile $command): void + { + // handle both commands + } +} +``` + +### Inheritance + +The handler will also be invoked if the command implements an interface or extends a class that the handler expects. + +```php +use Patchlevel\EventSourcing\Attribute\Handle; + +final class CreateProfileHandler +{ + #[Handle] + public function __invoke(CommandInterface $command): void + { + // handle all commands that implement CommandInterface + } +} +``` ### Aggregate Handler @@ -138,6 +191,11 @@ final class Profile extends BasicAggregateRoot // ... apply methods } ``` +!!! tip + + If you want to automatically initialize an aggregate if it cannot be found in the store, + you can use the [Auto Initialize](aggregate.md#auto-initialize) feature. + #### Inject Service You can inject services into aggregate handler methods. diff --git a/docs/pages/repository.md b/docs/pages/repository.md index cd0cd0a42..5285658d7 100644 --- a/docs/pages/repository.md +++ b/docs/pages/repository.md @@ -198,12 +198,17 @@ $profile = $repository->load($id); !!! warning When the method is called, the aggregate is always reloaded and rebuilt from the database. - + !!! note You can only fetch one aggregate at a time and don't do any complex queries either. Projections are used for this purpose. - + +!!! tip + + If you want to automatically initialize an aggregate if it cannot be found in the store, + you can use the [Auto Initialize](aggregate.md#auto-initialize) feature. + ### Has an aggregate You can also check whether an `aggregate` with a certain id exists. diff --git a/docs/pages/subscription.md b/docs/pages/subscription.md index b89aec427..65f6aa6ae 100644 --- a/docs/pages/subscription.md +++ b/docs/pages/subscription.md @@ -422,6 +422,11 @@ Default, we provide the following cleanup tasks for `doctrine/dbal`: | `DropIndexTask` | Drops an index from a table. | | `DropTableTask` | Drops a table. | +!!! note + + If you are passing connection registry, you can use the connection name as parameter. + The `connectionName` parameter is optional and defaults to the default connection. + !!! tip You can create your own cleanup tasks and handler. @@ -1054,11 +1059,9 @@ Lastly, we have to add the new handler to `DefaultCleaner`, which is responsible for cleaning up subscriptions. ```php -use Patchlevel\EventSourcing\Subscription\Cleanup\Dbal\DbalCleanupTaskHandler; use Patchlevel\EventSourcing\Subscription\Cleanup\DefaultCleaner; $cleaner = new DefaultCleaner([ - new DbalCleanupTaskHandler($projectionConnection), new MongodbCleanupTaskHandler($mongodbDatabase), ]); ``` @@ -1066,6 +1069,35 @@ $cleaner = new DefaultCleaner([ You need to pass the Cleaner to the Subscription Engine. +#### Dbal Cleanup Task Handler + +We provide a Dbal cleanup task handler by default. +More information about the available tasks can be found in the [Dbal Cleanup Tasks](#dbal-cleanup-tasks) documentation. + +```php +use Doctrine\Dbal\Connection; +use Patchlevel\EventSourcing\Subscription\Cleanup\Dbal\DbalCleanupTaskHandler; +use Patchlevel\EventSourcing\Subscription\Cleanup\DefaultCleaner; + +/** @var Connection $connection */ +$cleaner = new DefaultCleaner([ + new DbalCleanupTaskHandler($connection), +]); +``` +If you have multiple database connections and want to use the `DbalCleanupTaskHandler` to clean up the respective databases, +you can also pass a `ConnectionRegistry` (from `doctrine/persistence`) to the `DbalCleanupTaskHandler`. +Then you can pass the connection name as parameter in the cleanup task and the handler will use the corresponding connection to execute the task. + +```php +use Doctrine\Persistence\ConnectionRegistry; +use Patchlevel\EventSourcing\Subscription\Cleanup\Dbal\DbalCleanupTaskHandler; +use Patchlevel\EventSourcing\Subscription\Cleanup\DefaultCleaner; + +/** @var ConnectionRegistry $connectionRegistry */ +$cleaner = new DefaultCleaner([ + new DbalCleanupTaskHandler($connectionRegistry), +]); +``` ### Subscriber Accessor The subscriber accessor repository is responsible for providing the subscribers to the subscription engine. @@ -1315,6 +1347,18 @@ foreach ($subscriptions as $subscription) { echo $subscription->status()->value; } ``` +### Refresh + +If you change the metadata of a subscriber in the code (e.g. `runMode`, `group` or `cleanupTasks`), +you can use the `refresh` method to update the existing subscriptions in the store. + +```php +use Patchlevel\EventSourcing\Subscription\Engine\SubscriptionEngine; +use Patchlevel\EventSourcing\Subscription\Engine\SubscriptionEngineCriteria; + +/** @var SubscriptionEngine $subscriptionEngine */ +$subscriptionEngine->refresh(new SubscriptionEngineCriteria()); +``` ## Learn more * [How to use CLI commands](./cli.md) diff --git a/docs/requirements.txt b/docs/requirements.txt index 91f2ec792..68da3c4d0 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,11 +1,11 @@ mkdocs==1.6.1 mike==2.1.3 markdown==3.10.2 -mkdocs-material==9.7.1 +mkdocs-material==9.7.2 # Markdown extensions Pygments==2.19.2 -pymdown-extensions==10.20.1 +pymdown-extensions==10.21 # MkDocs plugins mkdocs-material-extensions==1.3.1 diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 070a80330..f7e40e355 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,7 +1,7 @@ parameters: ignoreErrors: - - message: '#^Cannot unset offset ''url'' on array\{application_name\?\: string, charset\?\: string, dbname\?\: string, defaultTableOptions\?\: array\, driver\?\: ''ibm_db2''\|''mysqli''\|''oci8''\|''pdo_mysql''\|''pdo_oci''\|''pdo_pgsql''\|''pdo_sqlite''\|''pdo_sqlsrv''\|''pgsql''\|''sqlite3''\|''sqlsrv'', driverClass\?\: class\-string\, driverOptions\?\: array\, host\?\: string, \.\.\.\}\.$#' + message: '#^Cannot unset offset ''url'' on array\{application_name\?\: string, charset\?\: string, defaultTableOptions\?\: array\, driver\?\: ''ibm_db2''\|''mysqli''\|''oci8''\|''pdo_mysql''\|''pdo_oci''\|''pdo_pgsql''\|''pdo_sqlite''\|''pdo_sqlsrv''\|''pgsql''\|''sqlite3''\|''sqlsrv'', driverClass\?\: class\-string\, driverOptions\?\: array\, host\?\: string, keepReplica\?\: bool, \.\.\.\}\.$#' identifier: unset.offset count: 1 path: src/Console/DoctrineHelper.php @@ -444,6 +444,12 @@ parameters: count: 1 path: tests/Unit/Fixture/ProfileWithHandler.php + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithSharedApplyContext\:\:\$id is unused\.$#' + identifier: property.unused + count: 1 + path: tests/Unit/Fixture/ProfileWithSharedApplyContext.php + - message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithSuppressAll\:\:\$id is unused\.$#' identifier: property.unused diff --git a/src/Attribute/AutoInitialize.php b/src/Attribute/AutoInitialize.php new file mode 100644 index 000000000..fa175edd4 --- /dev/null +++ b/src/Attribute/AutoInitialize.php @@ -0,0 +1,13 @@ +> $aggregates */ + public function __construct( + public array $aggregates, + ) { + } +} diff --git a/src/CommandBus/AggregateHandlerProvider.php b/src/CommandBus/AggregateHandlerProvider.php index bdab44f70..13d050da0 100644 --- a/src/CommandBus/AggregateHandlerProvider.php +++ b/src/CommandBus/AggregateHandlerProvider.php @@ -11,6 +11,9 @@ use Patchlevel\EventSourcing\Repository\RepositoryManager; use Psr\Container\ContainerInterface; +use function class_implements; +use function class_parents; + final class AggregateHandlerProvider implements HandlerProvider { private bool $initialized = false; @@ -36,7 +39,9 @@ public function handlerForCommand(string $commandClass): iterable $this->initialize(); } - return $this->handlers[$commandClass] ?? []; + foreach (self::resolveClasses($commandClass) as $class) { + yield from $this->handlers[$class] ?? []; + } } private function initialize(): void @@ -69,4 +74,19 @@ private function initialize(): void $this->initialized = true; } + + /** + * @param class-string $class + * + * @return array + */ + private static function resolveClasses(string $class): array + { + /** @var array $classes */ + $classes = [$class => $class] + + class_parents($class) + + class_implements($class); + + return $classes; + } } diff --git a/src/CommandBus/HandlerFinder.php b/src/CommandBus/HandlerFinder.php index f00af8609..69c0f12d6 100644 --- a/src/CommandBus/HandlerFinder.php +++ b/src/CommandBus/HandlerFinder.php @@ -6,11 +6,15 @@ use Patchlevel\EventSourcing\Attribute\Handle; use ReflectionClass; +use ReflectionMethod; use Symfony\Component\TypeInfo\Type\ObjectType; +use Symfony\Component\TypeInfo\Type\UnionType; use Symfony\Component\TypeInfo\TypeResolver\TypeResolver; final class HandlerFinder { + private static TypeResolver $typeResolver; + /** * @param class-string $classString * @@ -18,7 +22,6 @@ final class HandlerFinder */ public static function findInClass(string $classString): iterable { - $typeResolver = TypeResolver::create(); $reflectionClass = new ReflectionClass($classString); foreach ($reflectionClass->getMethods() as $reflectionMethod) { @@ -28,53 +31,88 @@ public static function findInClass(string $classString): iterable continue; } - $handle = $handleAttributes[0]->newInstance(); + foreach ($handleAttributes as $attribute) { + $handle = $attribute->newInstance(); + + if ($handle->commandClass !== null) { + yield new HandlerReference( + $handle->commandClass, + $reflectionMethod->getName(), + $reflectionMethod->isStatic(), + ); + + continue; + } + + foreach (self::guessHandledClasses($reflectionMethod) as $class) { + yield new HandlerReference( + $class, + $reflectionMethod->getName(), + $reflectionMethod->isStatic(), + ); + } + } + } + } - if ($handle->commandClass !== null) { - yield new HandlerReference( - $handle->commandClass, - $reflectionMethod->getName(), - $reflectionMethod->isStatic(), - ); + /** @return list */ + private static function guessHandledClasses(ReflectionMethod $reflectionMethod): array + { + $parameters = $reflectionMethod->getParameters(); - continue; - } + if ($parameters === []) { + throw InvalidHandleMethod::noParameters( + $reflectionMethod->getDeclaringClass()->getName(), + $reflectionMethod->getName(), + ); + } - $parameters = $reflectionMethod->getParameters(); + $reflectionType = $parameters[0]->getType(); - if ($parameters === []) { - throw InvalidHandleMethod::noParameters( - $reflectionMethod->getDeclaringClass()->getName(), - $reflectionMethod->getName(), - ); - } + if ($reflectionType === null) { + throw InvalidHandleMethod::incompatibleType( + $reflectionMethod->getDeclaringClass()->getName(), + $reflectionMethod->getName(), + ); + } - $reflectionType = $parameters[0]->getType(); + $type = self::typeResolver()->resolve($reflectionType); - if ($reflectionType === null) { - throw InvalidHandleMethod::incompatibleType( - $reflectionMethod->getDeclaringClass()->getName(), - $reflectionMethod->getName(), - ); - } + if ($type instanceof ObjectType) { + /** @var class-string $className */ + $className = $type->getClassName(); - $type = $typeResolver->resolve($reflectionType); + return [$className]; + } - if (!$type instanceof ObjectType) { - throw InvalidHandleMethod::incompatibleType( - $reflectionMethod->getDeclaringClass()->getName(), - $reflectionMethod->getName(), - ); - } + if ($type instanceof UnionType) { + $types = []; - /** @var class-string $commandClass */ - $commandClass = $type->getClassName(); + foreach ($type->getTypes() as $unionType) { + if (!$unionType instanceof ObjectType) { + throw InvalidHandleMethod::incompatibleType( + $reflectionMethod->getDeclaringClass()->getName(), + $reflectionMethod->getName(), + ); + } - yield new HandlerReference( - $commandClass, - $reflectionMethod->getName(), - $reflectionMethod->isStatic(), - ); + /** @var class-string $className */ + $className = $unionType->getClassName(); + + $types[] = $className; + } + + return $types; } + + throw InvalidHandleMethod::incompatibleType( + $reflectionMethod->getDeclaringClass()->getName(), + $reflectionMethod->getName(), + ); + } + + private static function typeResolver(): TypeResolver + { + return self::$typeResolver ??= TypeResolver::create(); } } diff --git a/src/CommandBus/ServiceHandlerProvider.php b/src/CommandBus/ServiceHandlerProvider.php index 656a936ee..82beb319d 100644 --- a/src/CommandBus/ServiceHandlerProvider.php +++ b/src/CommandBus/ServiceHandlerProvider.php @@ -4,6 +4,9 @@ namespace Patchlevel\EventSourcing\CommandBus; +use function class_implements; +use function class_parents; + final class ServiceHandlerProvider implements HandlerProvider { private bool $initialized = false; @@ -28,7 +31,9 @@ public function handlerForCommand(string $commandClass): iterable $this->initialize(); } - return $this->handlers[$commandClass] ?? []; + foreach (self::resolveClasses($commandClass) as $class) { + yield from $this->handlers[$class] ?? []; + } } private function initialize(): void @@ -51,4 +56,19 @@ private function initialize(): void $this->initialized = true; } + + /** + * @param class-string $class + * + * @return array + */ + private static function resolveClasses(string $class): array + { + /** @var array $classes */ + $classes = [$class => $class] + + class_parents($class) + + class_implements($class); + + return $classes; + } } diff --git a/src/Console/Command/SubscriptionRefreshCommand.php b/src/Console/Command/SubscriptionRefreshCommand.php new file mode 100644 index 000000000..fa6b0cdab --- /dev/null +++ b/src/Console/Command/SubscriptionRefreshCommand.php @@ -0,0 +1,36 @@ +engine instanceof CanRefreshSubscriptions) { + throw new LogicException(sprintf( + '"%s" does not implement "%s" and cannot call refresh.', + $this->engine::class, + CanRefreshSubscriptions::class, + )); + } + + $criteria = $this->subscriptionEngineCriteria($input); + $this->engine->refresh($criteria); + + return 0; + } +} diff --git a/src/Metadata/AggregateRoot/AggregateRootMetadata.php b/src/Metadata/AggregateRoot/AggregateRootMetadata.php index afe79ff98..bfbfb4d5c 100644 --- a/src/Metadata/AggregateRoot/AggregateRootMetadata.php +++ b/src/Metadata/AggregateRoot/AggregateRootMetadata.php @@ -28,6 +28,7 @@ public function __construct( /** @var list */ public readonly array $childAggregates = [], string|null $streamName = null, + public readonly string|null $autoInitializeMethod = null, ) { $this->streamName = $streamName ?? $this->name . '-{id}'; } diff --git a/src/Metadata/AggregateRoot/AttributeAggregateRootMetadataFactory.php b/src/Metadata/AggregateRoot/AttributeAggregateRootMetadataFactory.php index e622b4910..4ec2a8c11 100644 --- a/src/Metadata/AggregateRoot/AttributeAggregateRootMetadataFactory.php +++ b/src/Metadata/AggregateRoot/AttributeAggregateRootMetadataFactory.php @@ -7,8 +7,10 @@ use Patchlevel\EventSourcing\Aggregate\AggregateRoot; use Patchlevel\EventSourcing\Attribute\Aggregate; use Patchlevel\EventSourcing\Attribute\Apply; +use Patchlevel\EventSourcing\Attribute\AutoInitialize; use Patchlevel\EventSourcing\Attribute\ChildAggregate; use Patchlevel\EventSourcing\Attribute\Id; +use Patchlevel\EventSourcing\Attribute\SharedApplyContext; use Patchlevel\EventSourcing\Attribute\Snapshot as AttributeSnapshot; use Patchlevel\EventSourcing\Attribute\Stream; use Patchlevel\EventSourcing\Attribute\SuppressMissingApply; @@ -51,6 +53,7 @@ public function metadata(string $aggregate): AggregateRootMetadata [$suppressEvents, $suppressAll] = $this->findSuppressMissingApply($reflectionClass); $applyMethods = $this->findApplyMethods($reflectionClass, $aggregate, $childAggregates); $snapshot = $this->findSnapshot($reflectionClass); + $autoInitializeMethod = $this->findAutoInitializeMethod($reflectionClass); $metadata = new AggregateRootMetadata( $aggregate, @@ -62,6 +65,7 @@ public function metadata(string $aggregate): AggregateRootMetadata $snapshot, array_map(static fn (array $list) => $list[0], $childAggregates), $this->findStreamName($reflectionClass), + $autoInitializeMethod, ); $this->aggregateMetadata[$aggregate] = $metadata; @@ -73,17 +77,14 @@ public function metadata(string $aggregate): AggregateRootMetadata private function findSuppressMissingApply(ReflectionClass $reflector): array { $suppressEvents = []; - $suppressAll = false; $attributes = $reflector->getAttributes(SuppressMissingApply::class); - foreach ($attributes as $attribute) { - $instance = $attribute->newInstance(); + if ($attributes !== []) { + $instance = $attributes[0]->newInstance(); if ($instance->suppressAll) { - $suppressAll = true; - - continue; + return [[], true]; } foreach ($instance->suppressEvents as $event) { @@ -91,7 +92,27 @@ private function findSuppressMissingApply(ReflectionClass $reflector): array } } - return [$suppressEvents, $suppressAll]; + $attributes = $reflector->getAttributes(SharedApplyContext::class); + + if ($attributes !== []) { + $instance = $attributes[0]->newInstance(); + + foreach ($instance->aggregates as $aggregateClass) { + $reflectionClass = new ReflectionClass($aggregateClass); + + $applyMethods = $this->findApplyMethods( + $reflectionClass, + $aggregateClass, + $this->findChildAggregates($reflectionClass), + ); + + foreach ($applyMethods as $eventClass => $method) { + $suppressEvents[$eventClass] = true; + } + } + } + + return [$suppressEvents, false]; } private function findAggregateName(ReflectionClass $reflector): string @@ -158,6 +179,19 @@ private function findStreamName(ReflectionClass $reflector): string|null return $attributes[0]->newInstance()->name; } + private function findAutoInitializeMethod(ReflectionClass $reflector): string|null + { + foreach ($reflector->getMethods() as $method) { + $attributes = $method->getAttributes(AutoInitialize::class); + + if ($attributes !== []) { + return $method->getName(); + } + } + + return null; + } + /** @return list */ private function findChildAggregates(ReflectionClass $reflector): array { diff --git a/src/Repository/DefaultRepository.php b/src/Repository/DefaultRepository.php index 2a0bc24b8..2b99d6f23 100644 --- a/src/Repository/DefaultRepository.php +++ b/src/Repository/DefaultRepository.php @@ -40,6 +40,8 @@ use function array_map; use function assert; use function count; +use function is_a; +use function is_object; use function sprintf; /** @@ -138,6 +140,30 @@ public function load(AggregateRootId $id): AggregateRoot $firstMessage = $stream->current(); if ($firstMessage === null) { + if ($this->metadata->autoInitializeMethod) { + $aggregate = $this->metadata->className::{$this->metadata->autoInitializeMethod}($id); + + if (!is_object($aggregate) || !is_a($aggregate, $this->metadata->className, true)) { + throw new InvalidAggregate( + $this->metadata->autoInitializeMethod, + $this->metadata->className, + $aggregate, + ); + } + + $this->logger->debug( + sprintf( + 'Repository: Auto initialize aggregate "%s" with the id "%s".', + $this->metadata->name, + $id->toString(), + ), + ); + + $this->aggregateIsValid[$aggregate] = true; + + return $aggregate; + } + $this->logger->debug( sprintf( 'Repository: Aggregate "%s" with the id "%s" not found.', diff --git a/src/Repository/InvalidAggregate.php b/src/Repository/InvalidAggregate.php new file mode 100644 index 000000000..358af9f79 --- /dev/null +++ b/src/Repository/InvalidAggregate.php @@ -0,0 +1,26 @@ +connection->createSchemaManager()->dropTable($task->table); + $this->connection($task->connectionName)->createSchemaManager()->dropTable($task->table); return; } if ($task instanceof DropIndexTask) { - $this->connection->createSchemaManager()->dropIndex($task->index, $task->table); + $this->connection($task->connectionName)->createSchemaManager()->dropIndex($task->index, $task->table); return; } @@ -36,4 +37,23 @@ public function supports(object $task): bool { return $task instanceof DropTableTask || $task instanceof DropIndexTask; } + + private function connection(string|null $connectionName): Connection + { + if ($this->connection instanceof ConnectionRegistry) { + $connection = $this->connection->getConnection($connectionName); + + if (!$connection instanceof Connection) { + throw new UnexpectedConnectionType($connectionName, Connection::class, $connection::class); + } + + return $connection; + } + + if ($connectionName === null) { + return $this->connection; + } + + throw new ConnectionNameNotSupported($connectionName); + } } diff --git a/src/Subscription/Cleanup/Dbal/DropIndexTask.php b/src/Subscription/Cleanup/Dbal/DropIndexTask.php index 227f2c558..6dcad5066 100644 --- a/src/Subscription/Cleanup/Dbal/DropIndexTask.php +++ b/src/Subscription/Cleanup/Dbal/DropIndexTask.php @@ -9,6 +9,7 @@ final class DropIndexTask public function __construct( public readonly string $index, public readonly string $table, + public readonly string|null $connectionName = null, ) { } } diff --git a/src/Subscription/Cleanup/Dbal/DropTableTask.php b/src/Subscription/Cleanup/Dbal/DropTableTask.php index 46e62b4e2..73a363da5 100644 --- a/src/Subscription/Cleanup/Dbal/DropTableTask.php +++ b/src/Subscription/Cleanup/Dbal/DropTableTask.php @@ -8,6 +8,7 @@ final class DropTableTask { public function __construct( public readonly string $table, + public readonly string|null $connectionName = null, ) { } } diff --git a/src/Subscription/Cleanup/Dbal/UnexpectedConnectionType.php b/src/Subscription/Cleanup/Dbal/UnexpectedConnectionType.php new file mode 100644 index 000000000..cad8b2d1b --- /dev/null +++ b/src/Subscription/Cleanup/Dbal/UnexpectedConnectionType.php @@ -0,0 +1,28 @@ +parent->subscriptions($criteria); } + public function refresh(SubscriptionEngineCriteria|null $criteria = null): Result + { + if (!$this->parent instanceof CanRefreshSubscriptions) { + throw new LogicException(sprintf( + '"%s" does not implement "%s" and cannot call refresh.', + $this->parent::class, + CanRefreshSubscriptions::class, + )); + } + + return $this->parent->refresh($criteria); + } + private function mergeResult(ProcessedResult ...$results): ProcessedResult { $processedMessages = 0; diff --git a/src/Subscription/Engine/DefaultSubscriptionEngine.php b/src/Subscription/Engine/DefaultSubscriptionEngine.php index 8c8771733..98281c626 100644 --- a/src/Subscription/Engine/DefaultSubscriptionEngine.php +++ b/src/Subscription/Engine/DefaultSubscriptionEngine.php @@ -29,7 +29,7 @@ use function count; use function sprintf; -final class DefaultSubscriptionEngine implements SubscriptionEngine +final class DefaultSubscriptionEngine implements SubscriptionEngine, CanRefreshSubscriptions { private SubscriptionManager $subscriptionManager; @@ -823,6 +823,82 @@ public function subscriptions(SubscriptionEngineCriteria|null $criteria = null): ); } + public function refresh(SubscriptionEngineCriteria|null $criteria = null): Result + { + $criteria ??= new SubscriptionEngineCriteria(); + + $this->discoverNewSubscriptions(); + + $subscriptions = $this->subscriptionManager->find(new SubscriptionCriteria( + ids: $criteria->ids, + groups: $criteria->groups, + )); + + foreach ($subscriptions as $subscription) { + $subscriber = $this->subscriber($subscription->id()); + + if (!$subscriber) { + continue; + } + + $changed = false; + + if ($subscription->runMode() !== $subscriber->runMode()) { + $changed = true; + $oldRunMode = $subscription->runMode(); + $subscription->changeRunMode($subscriber->runMode()); + + $this->logger?->info( + sprintf( + 'Subscription Engine: Subscription "%s" run mode changed from "%s" to "%s".', + $subscription->id(), + $oldRunMode->value, + $subscription->runMode()->value, + ), + ); + } + + if ($subscription->group() !== $subscriber->group()) { + $changed = true; + $oldGroup = $subscription->group(); + $subscription->changeGroup($subscriber->group()); + + $this->logger?->info( + sprintf( + 'Subscription Engine: Subscription "%s" group changed from "%s" to "%s".', + $subscription->id(), + $oldGroup, + $subscription->group(), + ), + ); + } + + $cleanupTasks = $this->cleanupTasks($subscriber); + + if ($subscription->cleanupTasks() !== $cleanupTasks) { + $changed = true; + $subscription->replaceCleanupTasks($cleanupTasks); + + $this->logger?->info( + sprintf( + 'Subscription Engine: Subscription "%s" cleanup tasks changed.', + $subscription->id(), + ), + ); + } + + if (!$changed) { + continue; + } + + $this->subscriptionManager->update($subscription); + } + + $this->subscriptionManager->flush(); + + return new Result(); + } + private function handleMessage(int $index, Message $message, Subscription $subscription): Error|null { $subscriber = $this->subscriber($subscription->id()); diff --git a/src/Subscription/Engine/ThrowOnErrorSubscriptionEngine.php b/src/Subscription/Engine/ThrowOnErrorSubscriptionEngine.php index 35f62dbb9..2066bd1c2 100644 --- a/src/Subscription/Engine/ThrowOnErrorSubscriptionEngine.php +++ b/src/Subscription/Engine/ThrowOnErrorSubscriptionEngine.php @@ -4,9 +4,12 @@ namespace Patchlevel\EventSourcing\Subscription\Engine; +use LogicException; use Patchlevel\EventSourcing\Subscription\Subscription; -final class ThrowOnErrorSubscriptionEngine implements SubscriptionEngine +use function sprintf; + +final class ThrowOnErrorSubscriptionEngine implements SubscriptionEngine, CanRefreshSubscriptions { public function __construct( private readonly SubscriptionEngine $parent, @@ -54,6 +57,19 @@ public function subscriptions(SubscriptionEngineCriteria|null $criteria = null): return $this->parent->subscriptions($criteria); } + public function refresh(SubscriptionEngineCriteria|null $criteria = null): Result + { + if (!$this->parent instanceof CanRefreshSubscriptions) { + throw new LogicException(sprintf( + '"%s" does not implement "%s" and cannot call refresh.', + $this->parent::class, + CanRefreshSubscriptions::class, + )); + } + + return $this->throwOnError($this->parent->refresh($criteria)); + } + /** * @param T $result * diff --git a/src/Subscription/Subscription.php b/src/Subscription/Subscription.php index c2e1d56b4..0dd056de8 100644 --- a/src/Subscription/Subscription.php +++ b/src/Subscription/Subscription.php @@ -14,8 +14,8 @@ final class Subscription /** @param list|null $cleanupTasks */ public function __construct( private readonly string $id, - private readonly string $group = self::DEFAULT_GROUP, - private readonly RunMode $runMode = RunMode::FromBeginning, + private string $group = self::DEFAULT_GROUP, + private RunMode $runMode = RunMode::FromBeginning, private Status $status = Status::New, private int $position = 0, private SubscriptionError|null $error = null, @@ -35,11 +35,21 @@ public function group(): string return $this->group; } + public function changeGroup(string $group): void + { + $this->group = $group; + } + public function runMode(): RunMode { return $this->runMode; } + public function changeRunMode(RunMode $runMode): void + { + $this->runMode = $runMode; + } + public function status(): Status { return $this->status; @@ -193,6 +203,12 @@ public function updateLastSavedAt(DateTimeImmutable $lastSavedAt): void $this->lastSavedAt = $lastSavedAt; } + /** @param list|null $cleanupTask */ + public function replaceCleanupTasks(array|null $cleanupTask): void + { + $this->cleanupTasks = $cleanupTask; + } + /** @return list|null */ public function cleanupTasks(): array|null { diff --git a/tests/Integration/BasicImplementation/BasicIntegrationTest.php b/tests/Integration/BasicImplementation/BasicIntegrationTest.php index 19c11d0d3..b93116445 100644 --- a/tests/Integration/BasicImplementation/BasicIntegrationTest.php +++ b/tests/Integration/BasicImplementation/BasicIntegrationTest.php @@ -31,8 +31,10 @@ use Patchlevel\EventSourcing\Subscription\Store\InMemorySubscriptionStore; use Patchlevel\EventSourcing\Subscription\Subscriber\MetadataSubscriberAccessorRepository; use Patchlevel\EventSourcing\Tests\DbalManager; +use Patchlevel\EventSourcing\Tests\Integration\BasicImplementation\Command\AdjustStockForProduct; use Patchlevel\EventSourcing\Tests\Integration\BasicImplementation\Command\ChangeProfileName; use Patchlevel\EventSourcing\Tests\Integration\BasicImplementation\Command\CreateProfile; +use Patchlevel\EventSourcing\Tests\Integration\BasicImplementation\Command\DecreaseStockForProduct; use Patchlevel\EventSourcing\Tests\Integration\BasicImplementation\Events\NameChanged; use Patchlevel\EventSourcing\Tests\Integration\BasicImplementation\Events\ProfileCreated; use Patchlevel\EventSourcing\Tests\Integration\BasicImplementation\MessageDecorator\FooMessageDecorator; @@ -392,4 +394,50 @@ public function testQueryBus(): void self::assertSame('John Doe', $result); } + + public function testAggregateInitialization(): void + { + $store = new DoctrineDbalStore( + $this->connection, + DefaultEventSerializer::createFromPaths([__DIR__ . '/Events']), + DefaultHeadersSerializer::createFromPaths([ + __DIR__ . '/Header', + ]), + ); + + $aggregateRootRegistry = new AggregateRootRegistry(['stock' => Stock::class]); + + $manager = new DefaultRepositoryManager( + $aggregateRootRegistry, + $store, + null, + new DefaultSnapshotStore(['default' => new InMemorySnapshotAdapter()]), + new FooMessageDecorator(), + ); + + $commandBus = SyncCommandBus::createForAggregateHandlers( + $aggregateRootRegistry, + $manager, + ); + + $schemaDirector = new DoctrineSchemaDirector( + $this->connection, + $store, + ); + + $schemaDirector->create(); + + $stockId = StockId::create(); + $productId = ProductId::generate(); + + $commandBus->dispatch(new AdjustStockForProduct($stockId, $productId, 5)); + $commandBus->dispatch(new DecreaseStockForProduct($stockId, $productId, 3)); + + $repository = $manager->get(Stock::class); + $stock = $repository->load($stockId); + + self::assertEquals($stockId, $stock->aggregateRootId()); + self::assertSame(3, $stock->playhead()); + self::assertSame(2, $stock->stockFor($productId)); + } } diff --git a/tests/Integration/BasicImplementation/Command/AdjustStockForProduct.php b/tests/Integration/BasicImplementation/Command/AdjustStockForProduct.php new file mode 100644 index 000000000..e08242aab --- /dev/null +++ b/tests/Integration/BasicImplementation/Command/AdjustStockForProduct.php @@ -0,0 +1,20 @@ + */ + private array $stock; + + #[AutoInitialize] + public static function initialize(StockId $id): static + { + $stock = new self(); + $stock->recordThat(new StockCreated($id)); + + return $stock; + } + + public function id(): StockId + { + return $this->id; + } + + public function stockFor(ProductId $productId): int + { + return $this->stock[$productId->toString()] ?? 0; + } + + #[Handle] + public function decreaseStock(DecreaseStockForProduct $command): void + { + $this->recordThat(new StockDecreased($this->id, $command->productId, $command->quantity)); + } + + #[Handle] + public function adjustStock(AdjustStockForProduct $command): void + { + $this->recordThat(new StockAdjusted($this->id, $command->productId, $command->quantity)); + } + + #[Apply] + protected function applyStockCreated(StockCreated $event): void + { + $this->id = $event->stockId; + $this->stock = []; + } + + #[Apply] + protected function applyStockDecreased(StockDecreased $event): void + { + $this->stock[$event->productId->toString()] = $this->stockFor($event->productId) - $event->quantity; + } + + #[Apply] + protected function applyStockAdjusted(StockAdjusted $event): void + { + $this->stock[$event->productId->toString()] = $event->quantity; + } +} diff --git a/tests/Integration/BasicImplementation/StockId.php b/tests/Integration/BasicImplementation/StockId.php new file mode 100644 index 000000000..92fcc68d4 --- /dev/null +++ b/tests/Integration/BasicImplementation/StockId.php @@ -0,0 +1,18 @@ +connection, + DefaultEventSerializer::createFromPaths([__DIR__ . '/Events']), + ); + + $clock = new FrozenClock(new DateTimeImmutable('2021-01-01T00:00:00')); + + $subscriptionStore = new DoctrineSubscriptionStore( + $this->connection, + $clock, + ); + + $schemaDirector = new DoctrineSchemaDirector( + $this->connection, + new ChainDoctrineSchemaConfigurator([ + $store, + $subscriptionStore, + ]), + ); + + $schemaDirector->create(); + + $subscriber = new #[Subscriber('test', RunMode::FromBeginning, group: 'default')] + class { + }; + + $subscriberRepository = new MetadataSubscriberAccessorRepository([$subscriber]); + + $engine = new DefaultSubscriptionEngine( + $this->createMock(MessageLoader::class), + $subscriptionStore, + $subscriberRepository, + ); + + $engine->setup(); + + $subscriptions = $engine->subscriptions(); + self::assertCount(1, $subscriptions); + self::assertEquals('test', $subscriptions[0]->id()); + self::assertEquals('default', $subscriptions[0]->group()); + self::assertEquals(RunMode::FromBeginning, $subscriptions[0]->runMode()); + + // change subscriber metadata + $newSubscriber = new #[Subscriber('test', RunMode::FromNow, group: 'new-group')] + class { + }; + + $newSubscriberRepository = new MetadataSubscriberAccessorRepository([$newSubscriber]); + + $engine = new DefaultSubscriptionEngine( + $this->createMock(MessageLoader::class), + $subscriptionStore, + $newSubscriberRepository, + ); + + $engine->refresh(); + + $subscriptions = $engine->subscriptions(); + self::assertCount(1, $subscriptions); + self::assertEquals('test', $subscriptions[0]->id()); + self::assertEquals('new-group', $subscriptions[0]->group()); + self::assertEquals(RunMode::FromNow, $subscriptions[0]->runMode()); + } + /** @param list $subscriptions */ private static function findSubscription(array $subscriptions, string $id): Subscription { diff --git a/tests/Unit/CommandBus/AggregateHandlerProviderTest.php b/tests/Unit/CommandBus/AggregateHandlerProviderTest.php index 5db923df9..e4ece227d 100644 --- a/tests/Unit/CommandBus/AggregateHandlerProviderTest.php +++ b/tests/Unit/CommandBus/AggregateHandlerProviderTest.php @@ -10,9 +10,12 @@ use Patchlevel\EventSourcing\CommandBus\Handler\UpdateAggregateHandler; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootRegistry; use Patchlevel\EventSourcing\Repository\RepositoryManager; +use Patchlevel\EventSourcing\Tests\Unit\Fixture\BaseCommand; use Patchlevel\EventSourcing\Tests\Unit\Fixture\ChangeProfileName; use Patchlevel\EventSourcing\Tests\Unit\Fixture\CreateProfile; use Patchlevel\EventSourcing\Tests\Unit\Fixture\ProfileWithHandler; +use Patchlevel\EventSourcing\Tests\Unit\Fixture\ProfileWithInheritanceHandler; +use Patchlevel\EventSourcing\Tests\Unit\Fixture\SomeCommand; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; @@ -28,7 +31,7 @@ public function testEmpty(): void $repositoryManager, ); - $result = $provider->handlerForCommand(CreateProfile::class); + $result = [...$provider->handlerForCommand(CreateProfile::class)]; self::assertCount(0, $result); } @@ -42,7 +45,7 @@ public function testGetCreateHandler(): void $repositoryManager, ); - $result = $provider->handlerForCommand(CreateProfile::class); + $result = [...$provider->handlerForCommand(CreateProfile::class)]; $handler = new CreateAggregateHandler( $repositoryManager, @@ -64,7 +67,7 @@ public function testGetUpdateHandler(): void $repositoryManager, ); - $result = $provider->handlerForCommand(ChangeProfileName::class); + $result = [...$provider->handlerForCommand(ChangeProfileName::class)]; $handler = new UpdateAggregateHandler( $repositoryManager, @@ -76,4 +79,52 @@ public function testGetUpdateHandler(): void self::assertCount(1, $result); self::assertEquals($handler->__invoke(...), $result[0]->callable()); } + + public function testGetHandlerByInterface(): void + { + $repositoryManager = $this->createMock(RepositoryManager::class); + $command = new class () implements SomeCommand { + }; + + $provider = new AggregateHandlerProvider( + new AggregateRootRegistry(['profile' => ProfileWithInheritanceHandler::class]), + $repositoryManager, + ); + + $result = [...$provider->handlerForCommand($command::class)]; + + $handler = new UpdateAggregateHandler( + $repositoryManager, + ProfileWithInheritanceHandler::class, + 'handleInterface', + new DefaultParameterResolver(), + ); + + self::assertCount(1, $result); + self::assertEquals($handler->__invoke(...), $result[0]->callable()); + } + + public function testGetHandlerByAbstractClass(): void + { + $repositoryManager = $this->createMock(RepositoryManager::class); + $command = new class () extends BaseCommand { + }; + + $provider = new AggregateHandlerProvider( + new AggregateRootRegistry(['profile' => ProfileWithInheritanceHandler::class]), + $repositoryManager, + ); + + $result = [...$provider->handlerForCommand($command::class)]; + + $handler = new UpdateAggregateHandler( + $repositoryManager, + ProfileWithInheritanceHandler::class, + 'handleAbstract', + new DefaultParameterResolver(), + ); + + self::assertCount(1, $result); + self::assertEquals($handler->__invoke(...), $result[0]->callable()); + } } diff --git a/tests/Unit/CommandBus/HandlerFinderTest.php b/tests/Unit/CommandBus/HandlerFinderTest.php index 6a038def0..5b11014d0 100644 --- a/tests/Unit/CommandBus/HandlerFinderTest.php +++ b/tests/Unit/CommandBus/HandlerFinderTest.php @@ -8,6 +8,7 @@ use Patchlevel\EventSourcing\CommandBus\HandlerFinder; use Patchlevel\EventSourcing\CommandBus\HandlerReference; use Patchlevel\EventSourcing\CommandBus\InvalidHandleMethod; +use Patchlevel\EventSourcing\Tests\Unit\Fixture\ChangeProfileName; use Patchlevel\EventSourcing\Tests\Unit\Fixture\CreateProfile; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; @@ -105,4 +106,39 @@ public function handle(CreateProfile $command): void new HandlerReference(CreateProfile::class, 'handle', false), ], $result); } + + public function testWithUnionTypeGuessing(): void + { + $class = new class () { + #[Handle] + public function handle(CreateProfile|ChangeProfileName $command): void + { + } + }; + + $result = [...HandlerFinder::findInClass($class::class)]; + + self::assertEquals([ + new HandlerReference(ChangeProfileName::class, 'handle', false), + new HandlerReference(CreateProfile::class, 'handle', false), + ], $result); + } + + public function testWithMultipleAttributes(): void + { + $class = new class () { + #[Handle(CreateProfile::class)] + #[Handle(ChangeProfileName::class)] + public function handle(CreateProfile $command): void + { + } + }; + + $result = [...HandlerFinder::findInClass($class::class)]; + + self::assertEquals([ + new HandlerReference(CreateProfile::class, 'handle', false), + new HandlerReference(ChangeProfileName::class, 'handle', false), + ], $result); + } } diff --git a/tests/Unit/CommandBus/ServiceHandlerProviderTest.php b/tests/Unit/CommandBus/ServiceHandlerProviderTest.php index 571f874a6..06a06a780 100644 --- a/tests/Unit/CommandBus/ServiceHandlerProviderTest.php +++ b/tests/Unit/CommandBus/ServiceHandlerProviderTest.php @@ -6,7 +6,9 @@ use Patchlevel\EventSourcing\Attribute\Handle; use Patchlevel\EventSourcing\CommandBus\ServiceHandlerProvider; +use Patchlevel\EventSourcing\Tests\Unit\Fixture\BaseCommand; use Patchlevel\EventSourcing\Tests\Unit\Fixture\CreateProfile; +use Patchlevel\EventSourcing\Tests\Unit\Fixture\SomeCommand; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; @@ -16,7 +18,7 @@ final class ServiceHandlerProviderTest extends TestCase public function testEmpty(): void { $provider = new ServiceHandlerProvider([]); - $result = $provider->handlerForCommand(CreateProfile::class); + $result = [...$provider->handlerForCommand(CreateProfile::class)]; self::assertCount(0, $result); } @@ -32,7 +34,7 @@ public function handle(): void $provider = new ServiceHandlerProvider([$class]); - $result = $provider->handlerForCommand(CreateProfile::class); + $result = [...$provider->handlerForCommand(CreateProfile::class)]; self::assertCount(1, $result); self::assertEquals($class->handle(...), $result[0]->callable()); @@ -49,9 +51,49 @@ public static function handle(): void $provider = new ServiceHandlerProvider([$class]); - $result = $provider->handlerForCommand(CreateProfile::class); + $result = [...$provider->handlerForCommand(CreateProfile::class)]; self::assertCount(1, $result); self::assertEquals($class::handle(...), $result[0]->callable()); } + + public function testFindHandlerByInterface(): void + { + $command = new class () implements SomeCommand { + }; + + $class = new class () { + #[Handle] + public function handle(SomeCommand $command): void + { + } + }; + + $provider = new ServiceHandlerProvider([$class]); + + $result = [...$provider->handlerForCommand($command::class)]; + + self::assertCount(1, $result); + self::assertEquals($class->handle(...), $result[0]->callable()); + } + + public function testFindHandlerByParentClass(): void + { + $command = new class () extends BaseCommand { + }; + + $class = new class () { + #[Handle] + public function handle(BaseCommand $command): void + { + } + }; + + $provider = new ServiceHandlerProvider([$class]); + + $result = [...$provider->handlerForCommand($command::class)]; + + self::assertCount(1, $result); + self::assertEquals($class->handle(...), $result[0]->callable()); + } } diff --git a/tests/Unit/Fixture/AutoInitializableProfile.php b/tests/Unit/Fixture/AutoInitializableProfile.php new file mode 100644 index 000000000..1d043f2f1 --- /dev/null +++ b/tests/Unit/Fixture/AutoInitializableProfile.php @@ -0,0 +1,38 @@ +id; + } + + #[AutoInitialize] + public static function initialize(ProfileId $id): static + { + $self = new self(); + $self->recordThat(new ProfileCreated($id, Email::fromString('initial@patchlevel.de'))); + + return $self; + } + + #[Apply] + protected function applyProfileCreated(ProfileCreated $event): void + { + $this->id = $event->profileId; + } +} diff --git a/tests/Unit/Fixture/BaseCommand.php b/tests/Unit/Fixture/BaseCommand.php new file mode 100644 index 000000000..d7aedbfd5 --- /dev/null +++ b/tests/Unit/Fixture/BaseCommand.php @@ -0,0 +1,9 @@ +recordThat(new SplittingEvent($this->email, $this->visits)); } - #[Apply(ProfileCreated::class)] - #[Apply(ProfileVisited::class)] + #[Apply] protected function applyProfileCreated(ProfileCreated|ProfileVisited $event): void { if ($event instanceof ProfileCreated) { diff --git a/tests/Unit/Fixture/ProfileWithInheritanceHandler.php b/tests/Unit/Fixture/ProfileWithInheritanceHandler.php new file mode 100644 index 000000000..b1828ad7e --- /dev/null +++ b/tests/Unit/Fixture/ProfileWithInheritanceHandler.php @@ -0,0 +1,33 @@ +id); + } +} diff --git a/tests/Unit/Fixture/ProfileWithSharedApplyContext.php b/tests/Unit/Fixture/ProfileWithSharedApplyContext.php new file mode 100644 index 000000000..34eb11971 --- /dev/null +++ b/tests/Unit/Fixture/ProfileWithSharedApplyContext.php @@ -0,0 +1,18 @@ +metadata(ProfileWithBrokenApplyBothUsage::class); } + + public function testSuppressAll(): void + { + $metadataFactory = new AttributeAggregateRootMetadataFactory(); + $metadata = $metadataFactory->metadata(ProfileWithSuppressAll::class); + + self::assertTrue($metadata->suppressAll); + self::assertSame([], $metadata->suppressEvents); + } + + public function testSharedApplyContext(): void + { + $metadataFactory = new AttributeAggregateRootMetadataFactory(); + $metadata = $metadataFactory->metadata(ProfileWithSharedApplyContext::class); + + self::assertFalse($metadata->suppressAll); + self::assertSame([ProfileCreated::class => true], $metadata->suppressEvents); + } } diff --git a/tests/Unit/Repository/DefaultRepositoryTest.php b/tests/Unit/Repository/DefaultRepositoryTest.php index 6560d8367..44a93b9d9 100644 --- a/tests/Unit/Repository/DefaultRepositoryTest.php +++ b/tests/Unit/Repository/DefaultRepositoryTest.php @@ -34,6 +34,7 @@ use Patchlevel\EventSourcing\Store\Store; use Patchlevel\EventSourcing\Store\StreamStore; use Patchlevel\EventSourcing\Store\UniqueConstraintViolation; +use Patchlevel\EventSourcing\Tests\Unit\Fixture\AutoInitializableProfile; use Patchlevel\EventSourcing\Tests\Unit\Fixture\Email; use Patchlevel\EventSourcing\Tests\Unit\Fixture\Profile; use Patchlevel\EventSourcing\Tests\Unit\Fixture\ProfileCreated; @@ -750,4 +751,20 @@ public function testLoadAggregateFromOtherStream(): void self::assertEquals(ProfileId::fromString('1'), $aggregate->id()); self::assertEquals(Email::fromString('hallo@patchlevel.de'), $aggregate->email()); } + + public function testLoadInitializableAggregate(): void + { + $store = $this->createMock(Store::class); + $store + ->expects($this->once()) + ->method('load') + ->willReturn(new ArrayStream([])); + + $repository = new DefaultRepository($store, AutoInitializableProfile::metadata()); + $aggregate = $repository->load(ProfileId::fromString('1')); + + self::assertInstanceOf(AutoInitializableProfile::class, $aggregate); + self::assertSame(1, $aggregate->playhead()); + self::assertEquals(ProfileId::fromString('1'), $aggregate->id()); + } } diff --git a/tests/Unit/Subscription/Cleanup/Dbal/DbalCleanupTaskHandlerTest.php b/tests/Unit/Subscription/Cleanup/Dbal/DbalCleanupTaskHandlerTest.php index 3b04a21c3..04a6252dd 100644 --- a/tests/Unit/Subscription/Cleanup/Dbal/DbalCleanupTaskHandlerTest.php +++ b/tests/Unit/Subscription/Cleanup/Dbal/DbalCleanupTaskHandlerTest.php @@ -6,10 +6,13 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Schema\AbstractSchemaManager; +use Doctrine\Persistence\ConnectionRegistry; use Patchlevel\EventSourcing\Subscription\Cleanup\CleanupTaskNotSupported; +use Patchlevel\EventSourcing\Subscription\Cleanup\Dbal\ConnectionNameNotSupported; use Patchlevel\EventSourcing\Subscription\Cleanup\Dbal\DbalCleanupTaskHandler; use Patchlevel\EventSourcing\Subscription\Cleanup\Dbal\DropIndexTask; use Patchlevel\EventSourcing\Subscription\Cleanup\Dbal\DropTableTask; +use Patchlevel\EventSourcing\Subscription\Cleanup\Dbal\UnexpectedConnectionType; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use stdClass; @@ -78,4 +81,51 @@ public function testHandleDropIndex(): void $handler(new DropIndexTask('foo', 'bar')); } + + public function testHandleWithConnectionRegistry(): void + { + $schemaManager = $this->createMock(AbstractSchemaManager::class); + $schemaManager->expects($this->once())->method('dropTable')->with('test'); + + $connection = $this->createMock(Connection::class); + $connection + ->expects($this->once()) + ->method('createSchemaManager') + ->willReturn($schemaManager); + + $registry = $this->createMock(ConnectionRegistry::class); + $registry + ->expects($this->once()) + ->method('getConnection') + ->with('foo') + ->willReturn($connection); + + $handler = new DbalCleanupTaskHandler($registry); + + $handler(new DropTableTask('test', 'foo')); + } + + public function testHandleWithConnectionRegistryAndUnexpectedType(): void + { + $registry = $this->createMock(ConnectionRegistry::class); + $registry + ->expects($this->once()) + ->method('getConnection') + ->with('foo') + ->willReturn(new stdClass()); + + $handler = new DbalCleanupTaskHandler($registry); + + $this->expectException(UnexpectedConnectionType::class); + $handler(new DropTableTask('test', 'foo')); + } + + public function testHandleWithConnectionAndConnectionNameNotSupported(): void + { + $connection = $this->createMock(Connection::class); + $handler = new DbalCleanupTaskHandler($connection); + + $this->expectException(ConnectionNameNotSupported::class); + $handler(new DropTableTask('test', 'foo')); + } } diff --git a/tests/Unit/Subscription/Engine/CatchUpSubscriptionEngineTest.php b/tests/Unit/Subscription/Engine/CatchUpSubscriptionEngineTest.php index 47d04d2fc..f871c0d69 100644 --- a/tests/Unit/Subscription/Engine/CatchUpSubscriptionEngineTest.php +++ b/tests/Unit/Subscription/Engine/CatchUpSubscriptionEngineTest.php @@ -4,6 +4,8 @@ namespace Patchlevel\EventSourcing\Tests\Unit\Subscription\Engine; +use LogicException; +use Patchlevel\EventSourcing\Subscription\Engine\CanRefreshSubscriptions; use Patchlevel\EventSourcing\Subscription\Engine\CatchUpSubscriptionEngine; use Patchlevel\EventSourcing\Subscription\Engine\Error; use Patchlevel\EventSourcing\Subscription\Engine\ProcessedResult; @@ -216,4 +218,32 @@ public function testSubscriptions(): void self::assertEquals($expectedSubscriptions, $subscriptions); } + + public function testRefreshSubscriptions(): void + { + $parent = $this->createMockForIntersectionOfInterfaces([ + SubscriptionEngine::class, + CanRefreshSubscriptions::class, + ]); + + $engine = new CatchUpSubscriptionEngine($parent); + $criteria = new SubscriptionEngineCriteria(); + + $expectedResult = new Result(); + + $parent->expects($this->once())->method('refresh')->with($criteria)->willReturn($expectedResult); + $result = $engine->refresh($criteria); + + self::assertSame($expectedResult, $result); + } + + public function testRefreshSubscriptionsNotSupported(): void + { + $parent = $this->createMock(SubscriptionEngine::class); + + $engine = new CatchUpSubscriptionEngine($parent); + + $this->expectException(LogicException::class); + $engine->refresh(); + } } diff --git a/tests/Unit/Subscription/Engine/DefaultSubscriptionEngineTest.php b/tests/Unit/Subscription/Engine/DefaultSubscriptionEngineTest.php index adbdcc843..27417d652 100644 --- a/tests/Unit/Subscription/Engine/DefaultSubscriptionEngineTest.php +++ b/tests/Unit/Subscription/Engine/DefaultSubscriptionEngineTest.php @@ -17,6 +17,7 @@ use Patchlevel\EventSourcing\Store\Criteria\Criteria; use Patchlevel\EventSourcing\Store\Criteria\FromIndexCriterion; use Patchlevel\EventSourcing\Store\Store; +use Patchlevel\EventSourcing\Subscription\Cleanup\Cleaner; use Patchlevel\EventSourcing\Subscription\Cleanup\CleanupFailed; use Patchlevel\EventSourcing\Subscription\Cleanup\CleanupTaskHandler; use Patchlevel\EventSourcing\Subscription\Cleanup\Dbal\DropTableTask; @@ -4572,4 +4573,262 @@ private function criteria(int $fromIndex = 0): Criteria { return new Criteria(new FromIndexCriterion($fromIndex)); } + + public function testRefreshSubscriptionsNoChanges(): void + { + $subscriber = new #[Subscriber('test', RunMode::FromBeginning, group: 'default')] + class { + }; + + $subscription = new Subscription( + 'test', + 'default', + RunMode::FromBeginning, + Status::Active, + ); + + $subscriptionStore = new DummySubscriptionStore([$subscription]); + + $engine = new DefaultSubscriptionEngine( + $this->createMock(Store::class), + $subscriptionStore, + new MetadataSubscriberAccessorRepository([$subscriber]), + logger: new NullLogger(), + cleaner: $this->createMock(Cleaner::class), + ); + + $engine->refresh(); + + $subscriptionStore->assertNoChanges(); + } + + public function testRefreshSubscriptionsChangeRunMode(): void + { + $subscriber = new #[Subscriber('test', RunMode::FromNow)] + class { + }; + + $subscription = new Subscription( + 'test', + 'default', + RunMode::FromBeginning, + Status::Active, + ); + + $subscriptionStore = new DummySubscriptionStore([$subscription]); + + $engine = new DefaultSubscriptionEngine( + $this->createMock(Store::class), + $subscriptionStore, + new MetadataSubscriberAccessorRepository([$subscriber]), + logger: new NullLogger(), + cleaner: $this->createMock(Cleaner::class), + ); + + $engine->refresh(); + + $subscriptionStore->assertUpdated( + new Subscription( + 'test', + 'default', + RunMode::FromNow, + Status::Active, + ), + ); + } + + public function testRefreshSubscriptionsChangeGroup(): void + { + $subscriber = new #[Subscriber('test', RunMode::FromBeginning, group: 'new-group')] + class { + }; + + $subscription = new Subscription( + 'test', + 'default', + RunMode::FromBeginning, + Status::Active, + ); + + $subscriptionStore = new DummySubscriptionStore([$subscription]); + + $engine = new DefaultSubscriptionEngine( + $this->createMock(Store::class), + $subscriptionStore, + new MetadataSubscriberAccessorRepository([$subscriber]), + logger: new NullLogger(), + cleaner: $this->createMock(Cleaner::class), + ); + + $engine->refresh(); + + $subscriptionStore->assertUpdated( + new Subscription( + 'test', + 'new-group', + RunMode::FromBeginning, + Status::Active, + ), + ); + } + + public function testRefreshSubscriptionsChangeCleanupTasks(): void + { + $subscriber = new #[Subscriber('test', RunMode::FromBeginning)] + class { + /** @return iterable */ + #[Cleanup] + public function cleanup(): iterable + { + yield new DropTableTask('test'); + } + }; + + $subscription = new Subscription( + 'test', + 'default', + RunMode::FromBeginning, + Status::Active, + ); + + $subscriptionStore = new DummySubscriptionStore([$subscription]); + + $engine = new DefaultSubscriptionEngine( + $this->createMock(Store::class), + $subscriptionStore, + new MetadataSubscriberAccessorRepository([$subscriber]), + logger: new NullLogger(), + cleaner: $this->createMock(Cleaner::class), + ); + + $engine->refresh(); + + $subscriptionStore->assertUpdated( + new Subscription( + 'test', + 'default', + RunMode::FromBeginning, + Status::Active, + cleanupTasks: [new DropTableTask('test')], + ), + ); + } + + public function testRefreshSubscriptionsMultipleChanges(): void + { + $subscriber = new #[Subscriber('test', RunMode::FromNow, group: 'new-group')] + class { + /** @return iterable */ + #[Cleanup] + public function cleanup(): iterable + { + yield new DropTableTask('test'); + } + }; + + $subscription = new Subscription( + 'test', + 'default', + RunMode::FromBeginning, + Status::Active, + ); + + $subscriptionStore = new DummySubscriptionStore([$subscription]); + + $engine = new DefaultSubscriptionEngine( + $this->createMock(Store::class), + $subscriptionStore, + new MetadataSubscriberAccessorRepository([$subscriber]), + logger: new NullLogger(), + cleaner: $this->createMock(Cleaner::class), + ); + + $engine->refresh(); + + $subscriptionStore->assertUpdated( + new Subscription( + 'test', + 'new-group', + RunMode::FromNow, + Status::Active, + cleanupTasks: [new DropTableTask('test')], + ), + ); + } + + public function testRefreshSubscriptionsWithCriteria(): void + { + $subscriber1 = new #[Subscriber('test1', RunMode::FromNow)] + class { + }; + + $subscriber2 = new #[Subscriber('test2', RunMode::FromNow)] + class { + }; + + $subscription1 = new Subscription( + 'test1', + 'default', + RunMode::FromBeginning, + Status::Active, + ); + + $subscription2 = new Subscription( + 'test2', + 'default', + RunMode::FromBeginning, + Status::Active, + ); + + $subscriptionStore = new DummySubscriptionStore([$subscription1, $subscription2]); + + $engine = new DefaultSubscriptionEngine( + $this->createMock(Store::class), + $subscriptionStore, + new MetadataSubscriberAccessorRepository([$subscriber1, $subscriber2]), + logger: new NullLogger(), + cleaner: $this->createMock(Cleaner::class), + ); + + $engine->refresh(new SubscriptionEngineCriteria(['test1'])); + + $subscriptionStore->assertUpdated( + new Subscription( + 'test1', + 'default', + RunMode::FromNow, + Status::Active, + ), + ); + + self::assertCount(1, $subscriptionStore->updatedSubscriptions); + } + + public function testRefreshSubscriptionsDiscoverNewSubscribers(): void + { + $subscriber = new #[Subscriber('test', RunMode::FromBeginning)] + class { + }; + + $subscriptionStore = new DummySubscriptionStore(); + + $engine = new DefaultSubscriptionEngine( + $this->createMock(Store::class), + $subscriptionStore, + new MetadataSubscriberAccessorRepository([$subscriber]), + logger: new NullLogger(), + cleaner: $this->createMock(Cleaner::class), + ); + + $engine->refresh(); + + $subscriptionStore->assertAdded( + new Subscription( + 'test', + 'default', + RunMode::FromBeginning, + Status::New, + ), + ); + } } diff --git a/tests/Unit/Subscription/Engine/ThrowOnErrorSubscriptionEngineTest.php b/tests/Unit/Subscription/Engine/ThrowOnErrorSubscriptionEngineTest.php index e3941270b..50d888f7c 100644 --- a/tests/Unit/Subscription/Engine/ThrowOnErrorSubscriptionEngineTest.php +++ b/tests/Unit/Subscription/Engine/ThrowOnErrorSubscriptionEngineTest.php @@ -4,6 +4,8 @@ namespace Patchlevel\EventSourcing\Tests\Unit\Subscription\Engine; +use LogicException; +use Patchlevel\EventSourcing\Subscription\Engine\CanRefreshSubscriptions; use Patchlevel\EventSourcing\Subscription\Engine\Error; use Patchlevel\EventSourcing\Subscription\Engine\ErrorDetected; use Patchlevel\EventSourcing\Subscription\Engine\ProcessedResult; @@ -261,4 +263,52 @@ public function testSubscriptions(): void self::assertSame([], $result); } + + public function testRefreshSubscriptionsSuccess(): void + { + $parent = $this->createMockForIntersectionOfInterfaces([ + SubscriptionEngine::class, + CanRefreshSubscriptions::class, + ]); + + $engine = new ThrowOnErrorSubscriptionEngine($parent); + $criteria = new SubscriptionEngineCriteria(); + + $expectedResult = new Result(); + + $parent->expects($this->once())->method('refresh')->with($criteria)->willReturn($expectedResult); + $result = $engine->refresh($criteria); + + self::assertSame($expectedResult, $result); + } + + public function testRefreshSubscriptionsError(): void + { + $this->expectException(ErrorDetected::class); + + $parent = $this->createMockForIntersectionOfInterfaces([ + SubscriptionEngine::class, + CanRefreshSubscriptions::class, + ]); + + $engine = new ThrowOnErrorSubscriptionEngine($parent); + $criteria = new SubscriptionEngineCriteria(); + + $expectedResult = new Result([ + new Error('id1', 'error1', new RuntimeException('error1')), + ]); + + $parent->expects($this->once())->method('refresh')->with($criteria)->willReturn($expectedResult); + $engine->refresh($criteria); + } + + public function testRefreshSubscriptionsNotSupported(): void + { + $parent = $this->createMock(SubscriptionEngine::class); + + $engine = new ThrowOnErrorSubscriptionEngine($parent); + + $this->expectException(LogicException::class); + $engine->refresh(); + } } diff --git a/tools/composer.lock b/tools/composer.lock index bdfc8f877..4d8aed241 100644 --- a/tools/composer.lock +++ b/tools/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "azjezz/psl", - "version": "4.2.0", + "version": "4.2.1", "source": { "type": "git", "url": "https://github.com/azjezz/psl.git", - "reference": "15153a64c9824335ce11654522e7d88de762d39e" + "reference": "28c6752857597a1bb6fa8be16678c144b9097ab8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/azjezz/psl/zipball/15153a64c9824335ce11654522e7d88de762d39e", - "reference": "15153a64c9824335ce11654522e7d88de762d39e", + "url": "https://api.github.com/repos/azjezz/psl/zipball/28c6752857597a1bb6fa8be16678c144b9097ab8", + "reference": "28c6752857597a1bb6fa8be16678c144b9097ab8", "shasum": "" }, "require": { @@ -30,7 +30,7 @@ "revolt/event-loop": "^1.0.7" }, "require-dev": { - "carthage-software/mago": "^1.0.0-beta.32", + "carthage-software/mago": "^1.3.0", "infection/infection": "^0.31.2", "php-coveralls/php-coveralls": "^2.7.0", "phpbench/phpbench": "^1.4.0", @@ -68,7 +68,7 @@ "description": "PHP Standard Library", "support": { "issues": "https://github.com/azjezz/psl/issues", - "source": "https://github.com/azjezz/psl/tree/4.2.0" + "source": "https://github.com/azjezz/psl/tree/4.2.1" }, "funding": [ { @@ -80,7 +80,7 @@ "type": "github" } ], - "time": "2025-10-25T08:31:40+00:00" + "time": "2026-01-29T12:38:33+00:00" }, { "name": "beberlei/assert", @@ -292,16 +292,16 @@ }, { "name": "composer/composer", - "version": "2.9.3", + "version": "2.9.5", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "fb3bee27676fd852a8a11ebbb1de19b4dada5aba" + "reference": "72a8f8e653710e18d83e5dd531eb5a71fc3223e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/fb3bee27676fd852a8a11ebbb1de19b4dada5aba", - "reference": "fb3bee27676fd852a8a11ebbb1de19b4dada5aba", + "url": "https://api.github.com/repos/composer/composer/zipball/72a8f8e653710e18d83e5dd531eb5a71fc3223e6", + "reference": "72a8f8e653710e18d83e5dd531eb5a71fc3223e6", "shasum": "" }, "require": { @@ -389,7 +389,7 @@ "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/composer/issues", "security": "https://github.com/composer/composer/security/policy", - "source": "https://github.com/composer/composer/tree/2.9.3" + "source": "https://github.com/composer/composer/tree/2.9.5" }, "funding": [ { @@ -401,7 +401,7 @@ "type": "github" } ], - "time": "2025-12-30T12:40:17+00:00" + "time": "2026-01-29T10:40:53+00:00" }, { "name": "composer/metadata-minifier", @@ -776,43 +776,43 @@ }, { "name": "deptrac/deptrac", - "version": "4.4.0", + "version": "4.6.0", "source": { "type": "git", "url": "https://github.com/deptrac/deptrac.git", - "reference": "3058cb1b5908a25711ccc0f4c96b64e6fd704114" + "reference": "b27bfc5291a1cbe1c0ebf514716b1d25c68c63fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/deptrac/deptrac/zipball/3058cb1b5908a25711ccc0f4c96b64e6fd704114", - "reference": "3058cb1b5908a25711ccc0f4c96b64e6fd704114", + "url": "https://api.github.com/repos/deptrac/deptrac/zipball/b27bfc5291a1cbe1c0ebf514716b1d25c68c63fd", + "reference": "b27bfc5291a1cbe1c0ebf514716b1d25c68c63fd", "shasum": "" }, "require": { "composer/xdebug-handler": "^3.0", - "jetbrains/phpstorm-stubs": "2024.3", + "jetbrains/phpstorm-stubs": "2024.3 || 2025.3", "nikic/php-parser": "^5", - "php": "^8.1", + "php": "^8.2", "phpdocumentor/graphviz": "^2.1", - "phpdocumentor/type-resolver": "^1.9.0", - "phpstan/phpdoc-parser": "^1.5.0|^2.1.0", + "phpdocumentor/type-resolver": "^1.9.0 || ^2.0.0", + "phpstan/phpdoc-parser": "^1.5.0 || ^2.1.0", "phpstan/phpstan": "^2.0", "psr/container": "^2.0", "psr/event-dispatcher": "^1.0", - "symfony/config": "^6.4|^7.0", - "symfony/console": "^6.4|^7.0", - "symfony/dependency-injection": "^6.4|^7.0", - "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/config": "^6.4 || ^7.4 || ^8.0", + "symfony/console": "^6.4 || ^7.4 || ^8.0", + "symfony/dependency-injection": "^6.4 || ^7.4 || ^8.0", + "symfony/event-dispatcher": "^6.4 || ^7.4 || ^8.0", "symfony/event-dispatcher-contracts": "^3.4", - "symfony/filesystem": "^6.4|^7.0", - "symfony/finder": "^6.4|^7.0", - "symfony/yaml": "^6.4|^7.0" + "symfony/filesystem": "^6.4 || ^7.4 || ^8.0", + "symfony/finder": "^6.4 || ^7.4 || ^8.0", + "symfony/yaml": "^6.4 || ^7.4 || ^8.0" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8", "ergebnis/composer-normalize": "^2.45", "ext-libxml": "*", - "symfony/stopwatch": "^6.4" + "symfony/stopwatch": "^6.4 || ^7.4 || ^8.0" }, "suggest": { "ext-dom": "For using the JUnit output formatter" @@ -855,35 +855,35 @@ ], "support": { "issues": "https://github.com/deptrac/deptrac/issues", - "source": "https://github.com/deptrac/deptrac/tree/4.4.0" + "source": "https://github.com/deptrac/deptrac/tree/4.6.0" }, - "time": "2025-12-08T08:14:18+00:00" + "time": "2026-02-02T09:44:37+00:00" }, { "name": "doctrine/deprecations", - "version": "1.1.5", + "version": "1.1.6", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38" + "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", - "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", + "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "conflict": { - "phpunit/phpunit": "<=7.5 || >=13" + "phpunit/phpunit": "<=7.5 || >=14" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^12 || ^13", - "phpstan/phpstan": "1.4.10 || 2.1.11", + "doctrine/coding-standard": "^9 || ^12 || ^14", + "phpstan/phpstan": "1.4.10 || 2.1.30", "phpstan/phpstan-phpunit": "^1.0 || ^2", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12.4 || ^13.0", "psr/log": "^1 || ^2 || ^3" }, "suggest": { @@ -903,29 +903,29 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.5" + "source": "https://github.com/doctrine/deprecations/tree/1.1.6" }, - "time": "2025-04-07T20:06:18+00:00" + "time": "2026-02-07T07:09:04+00:00" }, { "name": "jetbrains/phpstorm-stubs", - "version": "v2024.3", + "version": "v2025.3", "source": { "type": "git", - "url": "https://github.com/JetBrains/phpstorm-stubs.git", - "reference": "0e82bdfe850c71857ee4ee3501ed82a9fc5d043c" + "url": "https://github.com/JetBrains/phpstorm-stubs", + "reference": "d1ee5e570343bd4276a3d5959e6e1c2530b006d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/0e82bdfe850c71857ee4ee3501ed82a9fc5d043c", - "reference": "0e82bdfe850c71857ee4ee3501ed82a9fc5d043c", + "url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/d1ee5e570343bd4276a3d5959e6e1c2530b006d0", + "reference": "d1ee5e570343bd4276a3d5959e6e1c2530b006d0", "shasum": "" }, "require-dev": { - "friendsofphp/php-cs-fixer": "v3.64.0", - "nikic/php-parser": "v5.3.1", - "phpdocumentor/reflection-docblock": "5.6.0", - "phpunit/phpunit": "11.4.3" + "friendsofphp/php-cs-fixer": "^v3.86", + "nikic/php-parser": "^v5.6", + "phpdocumentor/reflection-docblock": "^5.6", + "phpunit/phpunit": "^12.3" }, "type": "library", "autoload": { @@ -949,23 +949,20 @@ "stubs", "type" ], - "support": { - "source": "https://github.com/JetBrains/phpstorm-stubs/tree/v2024.3" - }, - "time": "2024-12-14T08:03:12+00:00" + "time": "2025-09-18T15:47:24+00:00" }, { "name": "justinrainbow/json-schema", - "version": "6.6.4", + "version": "v6.7.2", "source": { "type": "git", "url": "https://github.com/jsonrainbow/json-schema.git", - "reference": "2eeb75d21cf73211335888e7f5e6fd7440723ec7" + "reference": "6fea66c7204683af437864e7c4e7abf383d14bc0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/2eeb75d21cf73211335888e7f5e6fd7440723ec7", - "reference": "2eeb75d21cf73211335888e7f5e6fd7440723ec7", + "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/6fea66c7204683af437864e7c4e7abf383d14bc0", + "reference": "6fea66c7204683af437864e7c4e7abf383d14bc0", "shasum": "" }, "require": { @@ -1025,9 +1022,9 @@ ], "support": { "issues": "https://github.com/jsonrainbow/json-schema/issues", - "source": "https://github.com/jsonrainbow/json-schema/tree/6.6.4" + "source": "https://github.com/jsonrainbow/json-schema/tree/v6.7.2" }, - "time": "2025-12-19T15:01:32+00:00" + "time": "2026-02-15T15:06:22+00:00" }, { "name": "marc-mabe/php-enum", @@ -1392,38 +1389,38 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.12.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "92a98ada2b93d9b201a613cb5a33584dde25f195" + "reference": "327a05bbee54120d4786a0dc67aad30226ad4cf9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/92a98ada2b93d9b201a613cb5a33584dde25f195", - "reference": "92a98ada2b93d9b201a613cb5a33584dde25f195", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/327a05bbee54120d4786a0dc67aad30226ad4cf9", + "reference": "327a05bbee54120d4786a0dc67aad30226ad4cf9", "shasum": "" }, "require": { "doctrine/deprecations": "^1.0", - "php": "^7.3 || ^8.0", + "php": "^7.4 || ^8.0", "phpdocumentor/reflection-common": "^2.0", - "phpstan/phpdoc-parser": "^1.18|^2.0" + "phpstan/phpdoc-parser": "^2.0" }, "require-dev": { "ext-tokenizer": "*", "phpbench/phpbench": "^1.2", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-phpunit": "^1.1", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-phpunit": "^2.0", "phpunit/phpunit": "^9.5", - "rector/rector": "^0.13.9", - "vimeo/psalm": "^4.25" + "psalm/phar": "^4" }, "type": "library", "extra": { "branch-alias": { - "dev-1.x": "1.x-dev" + "dev-1.x": "1.x-dev", + "dev-2.x": "2.x-dev" } }, "autoload": { @@ -1444,22 +1441,22 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.12.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/2.0.0" }, - "time": "2025-11-21T15:09:14+00:00" + "time": "2026-01-06T21:53:42+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "2.3.1", + "version": "2.3.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "16dbf9937da8d4528ceb2145c9c7c0bd29e26374" + "reference": "a004701b11273a26cd7955a61d67a7f1e525a45a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/16dbf9937da8d4528ceb2145c9c7c0bd29e26374", - "reference": "16dbf9937da8d4528ceb2145c9c7c0bd29e26374", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/a004701b11273a26cd7955a61d67a7f1e525a45a", + "reference": "a004701b11273a26cd7955a61d67a7f1e525a45a", "shasum": "" }, "require": { @@ -1491,17 +1488,17 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.2" }, - "time": "2026-01-12T11:33:04+00:00" + "time": "2026-01-25T14:56:51+00:00" }, { "name": "phpstan/phpstan", - "version": "2.1.33", + "version": "2.1.39", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9e800e6bee7d5bd02784d4c6069b48032d16224f", - "reference": "9e800e6bee7d5bd02784d4c6069b48032d16224f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c6f73a2af4cbcd99c931d0fb8f08548cc0fa8224", + "reference": "c6f73a2af4cbcd99c931d0fb8f08548cc0fa8224", "shasum": "" }, "require": { @@ -1546,7 +1543,7 @@ "type": "github" } ], - "time": "2025-12-05T10:24:31+00:00" + "time": "2026-02-11T14:48:56+00:00" }, { "name": "psr/container", @@ -1848,31 +1845,31 @@ }, { "name": "roave/backward-compatibility-check", - "version": "8.17.0", + "version": "8.19.0", "source": { "type": "git", "url": "https://github.com/Roave/BackwardCompatibilityCheck.git", - "reference": "b3aab0b917d127c3e048b4f96a7f588388e30ac9" + "reference": "810eb88eeff37ef300653bcfb77ca51a314777a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/BackwardCompatibilityCheck/zipball/b3aab0b917d127c3e048b4f96a7f588388e30ac9", - "reference": "b3aab0b917d127c3e048b4f96a7f588388e30ac9", + "url": "https://api.github.com/repos/Roave/BackwardCompatibilityCheck/zipball/810eb88eeff37ef300653bcfb77ca51a314777a2", + "reference": "810eb88eeff37ef300653bcfb77ca51a314777a2", "shasum": "" }, "require": { - "azjezz/psl": "^4.2.0", - "composer/composer": "^2.9.2", + "azjezz/psl": "^4.2.1", + "composer/composer": "^2.9.5", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-simplexml": "*", - "nikic/php-parser": "^5.6.2", + "nikic/php-parser": "^5.7.0", "nikolaposa/version": "^4.2.1", "ocramius/package-versions": "^2.11.0", "php": "~8.3.0 || ~8.4.0 || ~8.5.0", - "roave/better-reflection": "^6.66.0", - "symfony/console": "^7.4.0" + "roave/better-reflection": "^6.69.0", + "symfony/console": "^7.4.4" }, "conflict": { "marc-mabe/php-enum": "<4.7.2", @@ -1881,14 +1878,14 @@ }, "require-dev": { "doctrine/coding-standard": "^14.0.0", - "justinrainbow/json-schema": "^6.6.2", + "justinrainbow/json-schema": "^6.6.4", "php-standard-library/psalm-plugin": "^2.3.0", - "phpunit/phpunit": "^12.4.4", + "phpunit/phpunit": "^12.5.11", "psalm/plugin-phpunit": "^0.19.5", - "roave/infection-static-analysis-plugin": "^1.41.0", + "roave/infection-static-analysis-plugin": "^1.43.0", "roave/security-advisories": "dev-master", "squizlabs/php_codesniffer": "^4.0.1", - "vimeo/psalm": "^6.13.1" + "vimeo/psalm": "^6.15.1" }, "bin": [ "bin/roave-backward-compatibility-check" @@ -1916,27 +1913,27 @@ "description": "Tool to compare two revisions of a public API to check for BC breaks", "support": { "issues": "https://github.com/Roave/BackwardCompatibilityCheck/issues", - "source": "https://github.com/Roave/BackwardCompatibilityCheck/tree/8.17.0" + "source": "https://github.com/Roave/BackwardCompatibilityCheck/tree/8.19.0" }, - "time": "2025-11-29T01:02:22+00:00" + "time": "2026-02-13T19:14:25+00:00" }, { "name": "roave/better-reflection", - "version": "6.67.0", + "version": "6.69.0", "source": { "type": "git", "url": "https://github.com/Roave/BetterReflection.git", - "reference": "59ed7abcddba98b3a0533cbfbf6d033b9d239fc4" + "reference": "dccbd10b5b3da8718f2945ad50faf90a1cb2db55" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/BetterReflection/zipball/59ed7abcddba98b3a0533cbfbf6d033b9d239fc4", - "reference": "59ed7abcddba98b3a0533cbfbf6d033b9d239fc4", + "url": "https://api.github.com/repos/Roave/BetterReflection/zipball/dccbd10b5b3da8718f2945ad50faf90a1cb2db55", + "reference": "dccbd10b5b3da8718f2945ad50faf90a1cb2db55", "shasum": "" }, "require": { "ext-json": "*", - "jetbrains/phpstorm-stubs": "2024.3", + "jetbrains/phpstorm-stubs": "2025.3", "nikic/php-parser": "^5.7.0", "php": "~8.3.2 || ~8.4.1 || ~8.5.0" }, @@ -1945,7 +1942,7 @@ }, "require-dev": { "phpbench/phpbench": "^1.4.3", - "phpunit/phpunit": "^11.5.46" + "phpunit/phpunit": "^12.5.8" }, "suggest": { "composer/composer": "Required to use the ComposerSourceLocator" @@ -1985,9 +1982,9 @@ "description": "Better Reflection - an improved code reflection API", "support": { "issues": "https://github.com/Roave/BetterReflection/issues", - "source": "https://github.com/Roave/BetterReflection/tree/6.67.0" + "source": "https://github.com/Roave/BetterReflection/tree/6.69.0" }, - "time": "2026-01-13T16:19:15+00:00" + "time": "2026-02-01T13:20:30+00:00" }, { "name": "seld/jsonlint", @@ -2164,34 +2161,33 @@ }, { "name": "symfony/config", - "version": "v7.4.3", + "version": "v8.0.4", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "800ce889e358a53a9678b3212b0c8cecd8c6aace" + "reference": "8f45af92f08f82902827a8b6f403aaf49d893539" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/800ce889e358a53a9678b3212b0c8cecd8c6aace", - "reference": "800ce889e358a53a9678b3212b0c8cecd8c6aace", + "url": "https://api.github.com/repos/symfony/config/zipball/8f45af92f08f82902827a8b6f403aaf49d893539", + "reference": "8f45af92f08f82902827a8b6f403aaf49d893539", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/filesystem": "^7.1|^8.0", - "symfony/polyfill-ctype": "~1.8" + "symfony/filesystem": "^7.4|^8.0", + "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/finder": "<6.4", "symfony/service-contracts": "<2.5" }, "require-dev": { - "symfony/event-dispatcher": "^6.4|^7.0|^8.0", - "symfony/finder": "^6.4|^7.0|^8.0", - "symfony/messenger": "^6.4|^7.0|^8.0", + "symfony/event-dispatcher": "^7.4|^8.0", + "symfony/finder": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", "symfony/service-contracts": "^2.5|^3", - "symfony/yaml": "^6.4|^7.0|^8.0" + "symfony/yaml": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2219,7 +2215,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v7.4.3" + "source": "https://github.com/symfony/config/tree/v8.0.4" }, "funding": [ { @@ -2239,20 +2235,20 @@ "type": "tidelift" } ], - "time": "2025-12-23T14:24:27+00:00" + "time": "2026-01-13T13:06:50+00:00" }, { "name": "symfony/console", - "version": "v7.4.3", + "version": "v7.4.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "732a9ca6cd9dfd940c639062d5edbde2f6727fb6" + "reference": "41e38717ac1dd7a46b6bda7d6a82af2d98a78894" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/732a9ca6cd9dfd940c639062d5edbde2f6727fb6", - "reference": "732a9ca6cd9dfd940c639062d5edbde2f6727fb6", + "url": "https://api.github.com/repos/symfony/console/zipball/41e38717ac1dd7a46b6bda7d6a82af2d98a78894", + "reference": "41e38717ac1dd7a46b6bda7d6a82af2d98a78894", "shasum": "" }, "require": { @@ -2317,7 +2313,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.4.3" + "source": "https://github.com/symfony/console/tree/v7.4.4" }, "funding": [ { @@ -2337,43 +2333,40 @@ "type": "tidelift" } ], - "time": "2025-12-23T14:50:43+00:00" + "time": "2026-01-13T11:36:38+00:00" }, { "name": "symfony/dependency-injection", - "version": "v7.4.3", + "version": "v8.0.5", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "54122901b6d772e94f1e71a75e0533bc16563499" + "reference": "40a6c455ade7e3bf25900d6b746d40cfa2573e26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/54122901b6d772e94f1e71a75e0533bc16563499", - "reference": "54122901b6d772e94f1e71a75e0533bc16563499", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/40a6c455ade7e3bf25900d6b746d40cfa2573e26", + "reference": "40a6c455ade7e3bf25900d6b746d40cfa2573e26", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4", "psr/container": "^1.1|^2.0", "symfony/deprecation-contracts": "^2.5|^3", "symfony/service-contracts": "^3.6", - "symfony/var-exporter": "^6.4.20|^7.2.5|^8.0" + "symfony/var-exporter": "^7.4|^8.0" }, "conflict": { - "ext-psr": "<1.1|>=2", - "symfony/config": "<6.4", - "symfony/finder": "<6.4", - "symfony/yaml": "<6.4" + "ext-psr": "<1.1|>=2" }, "provide": { "psr/container-implementation": "1.1|2.0", "symfony/service-implementation": "1.1|2.0|3.0" }, "require-dev": { - "symfony/config": "^6.4|^7.0|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", - "symfony/yaml": "^6.4|^7.0|^8.0" + "symfony/config": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/yaml": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2401,7 +2394,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v7.4.3" + "source": "https://github.com/symfony/dependency-injection/tree/v8.0.5" }, "funding": [ { @@ -2421,7 +2414,7 @@ "type": "tidelift" } ], - "time": "2025-12-28T10:55:46+00:00" + "time": "2026-01-27T16:18:07+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2492,24 +2485,24 @@ }, { "name": "symfony/event-dispatcher", - "version": "v7.4.0", + "version": "v8.0.4", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "9dddcddff1ef974ad87b3708e4b442dc38b2261d" + "reference": "99301401da182b6cfaa4700dbe9987bb75474b47" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9dddcddff1ef974ad87b3708e4b442dc38b2261d", - "reference": "9dddcddff1ef974ad87b3708e4b442dc38b2261d", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/99301401da182b6cfaa4700dbe9987bb75474b47", + "reference": "99301401da182b6cfaa4700dbe9987bb75474b47", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4", "symfony/event-dispatcher-contracts": "^2.5|^3" }, "conflict": { - "symfony/dependency-injection": "<6.4", + "symfony/security-http": "<7.4", "symfony/service-contracts": "<2.5" }, "provide": { @@ -2518,14 +2511,14 @@ }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/error-handler": "^6.4|^7.0|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", - "symfony/framework-bundle": "^6.4|^7.0|^8.0", - "symfony/http-foundation": "^6.4|^7.0|^8.0", + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/error-handler": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/framework-bundle": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", "symfony/service-contracts": "^2.5|^3", - "symfony/stopwatch": "^6.4|^7.0|^8.0" + "symfony/stopwatch": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2553,7 +2546,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.4.0" + "source": "https://github.com/symfony/event-dispatcher/tree/v8.0.4" }, "funding": [ { @@ -2573,7 +2566,7 @@ "type": "tidelift" } ], - "time": "2025-10-28T09:38:46+00:00" + "time": "2026-01-05T11:45:55+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -2653,25 +2646,25 @@ }, { "name": "symfony/filesystem", - "version": "v7.4.0", + "version": "v8.0.1", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "d551b38811096d0be9c4691d406991b47c0c630a" + "reference": "d937d400b980523dc9ee946bb69972b5e619058d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/d551b38811096d0be9c4691d406991b47c0c630a", - "reference": "d551b38811096d0be9c4691d406991b47c0c630a", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/d937d400b980523dc9ee946bb69972b5e619058d", + "reference": "d937d400b980523dc9ee946bb69972b5e619058d", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.8" }, "require-dev": { - "symfony/process": "^6.4|^7.0|^8.0" + "symfony/process": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2699,7 +2692,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.4.0" + "source": "https://github.com/symfony/filesystem/tree/v8.0.1" }, "funding": [ { @@ -2719,27 +2712,27 @@ "type": "tidelift" } ], - "time": "2025-11-27T13:27:24+00:00" + "time": "2025-12-01T09:13:36+00:00" }, { "name": "symfony/finder", - "version": "v7.4.3", + "version": "v8.0.5", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "fffe05569336549b20a1be64250b40516d6e8d06" + "reference": "8bd576e97c67d45941365bf824e18dc8538e6eb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/fffe05569336549b20a1be64250b40516d6e8d06", - "reference": "fffe05569336549b20a1be64250b40516d6e8d06", + "url": "https://api.github.com/repos/symfony/finder/zipball/8bd576e97c67d45941365bf824e18dc8538e6eb0", + "reference": "8bd576e97c67d45941365bf824e18dc8538e6eb0", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.4" }, "require-dev": { - "symfony/filesystem": "^6.4|^7.0|^8.0" + "symfony/filesystem": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2767,7 +2760,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.4.3" + "source": "https://github.com/symfony/finder/tree/v8.0.5" }, "funding": [ { @@ -2787,7 +2780,7 @@ "type": "tidelift" } ], - "time": "2025-12-23T14:50:43+00:00" + "time": "2026-01-26T15:08:38+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3450,16 +3443,16 @@ }, { "name": "symfony/process", - "version": "v8.0.3", + "version": "v8.0.5", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "0cbbd88ec836f8757641c651bb995335846abb78" + "reference": "b5f3aa6762e33fd95efbaa2ec4f4bc9fdd16d674" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/0cbbd88ec836f8757641c651bb995335846abb78", - "reference": "0cbbd88ec836f8757641c651bb995335846abb78", + "url": "https://api.github.com/repos/symfony/process/zipball/b5f3aa6762e33fd95efbaa2ec4f4bc9fdd16d674", + "reference": "b5f3aa6762e33fd95efbaa2ec4f4bc9fdd16d674", "shasum": "" }, "require": { @@ -3491,7 +3484,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v8.0.3" + "source": "https://github.com/symfony/process/tree/v8.0.5" }, "funding": [ { @@ -3511,7 +3504,7 @@ "type": "tidelift" } ], - "time": "2025-12-19T10:01:18+00:00" + "time": "2026-01-26T15:08:38+00:00" }, { "name": "symfony/service-contracts", @@ -3602,16 +3595,16 @@ }, { "name": "symfony/string", - "version": "v8.0.1", + "version": "v8.0.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc" + "reference": "758b372d6882506821ed666032e43020c4f57194" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ba65a969ac918ce0cc3edfac6cdde847eba231dc", - "reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc", + "url": "https://api.github.com/repos/symfony/string/zipball/758b372d6882506821ed666032e43020c4f57194", + "reference": "758b372d6882506821ed666032e43020c4f57194", "shasum": "" }, "require": { @@ -3668,7 +3661,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v8.0.1" + "source": "https://github.com/symfony/string/tree/v8.0.4" }, "funding": [ { @@ -3688,7 +3681,7 @@ "type": "tidelift" } ], - "time": "2025-12-01T09:13:36+00:00" + "time": "2026-01-12T12:37:40+00:00" }, { "name": "symfony/var-exporter", @@ -3772,28 +3765,27 @@ }, { "name": "symfony/yaml", - "version": "v7.4.1", + "version": "v8.0.1", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "24dd4de28d2e3988b311751ac49e684d783e2345" + "reference": "7a1a90ba1df6e821a6b53c4cabdc32a56cabfb14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/24dd4de28d2e3988b311751ac49e684d783e2345", - "reference": "24dd4de28d2e3988b311751ac49e684d783e2345", + "url": "https://api.github.com/repos/symfony/yaml/zipball/7a1a90ba1df6e821a6b53c4cabdc32a56cabfb14", + "reference": "7a1a90ba1df6e821a6b53c4cabdc32a56cabfb14", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.4", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<6.4" + "symfony/console": "<7.4" }, "require-dev": { - "symfony/console": "^6.4|^7.0|^8.0" + "symfony/console": "^7.4|^8.0" }, "bin": [ "Resources/bin/yaml-lint" @@ -3824,7 +3816,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v7.4.1" + "source": "https://github.com/symfony/yaml/tree/v8.0.1" }, "funding": [ { @@ -3844,7 +3836,7 @@ "type": "tidelift" } ], - "time": "2025-12-04T18:11:45+00:00" + "time": "2025-12-04T18:17:06+00:00" } ], "packages-dev": [],