diff --git a/composer.json b/composer.json index 66693f0..9b28d74 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "require-dev": { "ghostwriter/coding-standard": "dev-main" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "prefer-stable": true, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 5c6389a..c9b77bd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "73655a8508e94cf17e21a1892203e9cd", + "content-hash": "57388620b1d1a2775c5d2319d431b084", "packages": [], "packages-dev": [ { @@ -746,6 +746,49 @@ }, "time": "2023-02-02T22:02:53+00:00" }, + { + "name": "doctrine/deprecations", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" + }, + "time": "2022-05-02T15:47:09+00:00" + }, { "name": "doctrine/lexer", "version": "3.0.0", @@ -987,16 +1030,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "dev-master", + "version": "v3.15.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "655f3c466d52fb11d527fbb93122cf972b896315" + "reference": "d48755372a113bddb99f749e34805d83f3acfe04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/655f3c466d52fb11d527fbb93122cf972b896315", - "reference": "655f3c466d52fb11d527fbb93122cf972b896315", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/d48755372a113bddb99f749e34805d83f3acfe04", + "reference": "d48755372a113bddb99f749e34805d83f3acfe04", "shasum": "" }, "require": { @@ -1039,7 +1082,6 @@ "ext-dom": "For handling output formats in XML", "ext-mbstring": "For handling non-UTF8 characters." }, - "default-branch": true, "bin": [ "php-cs-fixer" ], @@ -1064,9 +1106,15 @@ } ], "description": "A tool to automatically fix PHP code style", + "keywords": [ + "Static code analysis", + "fixer", + "standards", + "static analysis" + ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/master" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.15.1" }, "funding": [ { @@ -1074,7 +1122,7 @@ "type": "github" } ], - "time": "2023-02-08T17:38:13+00:00" + "time": "2023-03-13T23:26:30+00:00" }, { "name": "ghostwriter/coding-standard", @@ -1082,26 +1130,25 @@ "source": { "type": "git", "url": "https://github.com/ghostwriter/coding-standard.git", - "reference": "252595cada4522856a7ab4d35b6ab3b0b6cbae6d" + "reference": "9316d8d0cf750812b91096dca53c21ecbb4b1ae7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ghostwriter/coding-standard/zipball/252595cada4522856a7ab4d35b6ab3b0b6cbae6d", - "reference": "252595cada4522856a7ab4d35b6ab3b0b6cbae6d", + "url": "https://api.github.com/repos/ghostwriter/coding-standard/zipball/9316d8d0cf750812b91096dca53c21ecbb4b1ae7", + "reference": "9316d8d0cf750812b91096dca53c21ecbb4b1ae7", "shasum": "" }, "require": { - "friendsofphp/php-cs-fixer": "dev-master", - "infection/infection": "~0", + "friendsofphp/php-cs-fixer": "^3.15.1", + "infection/infection": "^0.26.19", "php": ">=8.1,<8.3", - "phpunit/phpunit": "~10", - "psalm/plugin-phpunit": "~0", - "rector/rector": "~0", - "sebastian/diff": "~5", - "slevomat/coding-standard": "~8", - "squizlabs/php_codesniffer": "~3", - "symplify/easy-coding-standard": "~11", - "vimeo/psalm": "~5" + "phpunit/phpunit": "^10.0.17", + "psalm/plugin-phpunit": "^0.18.4", + "rector/rector": "^0.15.21", + "slevomat/coding-standard": "^8.8", + "squizlabs/php_codesniffer": "^3.7.2", + "symplify/easy-coding-standard": "^11.2.10", + "vimeo/psalm": "^5.8.0" }, "default-branch": true, "type": "library", @@ -1136,7 +1183,7 @@ "type": "github" } ], - "time": "2023-02-07T19:20:11+00:00" + "time": "2023-03-21T12:43:14+00:00" }, { "name": "infection/abstract-testframework-adapter", @@ -1515,16 +1562,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -1562,7 +1609,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -1570,7 +1617,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "netresearch/jsonmapper", @@ -1625,16 +1672,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.3", + "version": "v4.15.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", "shasum": "" }, "require": { @@ -1675,9 +1722,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" }, - "time": "2023-01-16T22:05:37+00:00" + "time": "2023-03-05T19:49:14+00:00" }, { "name": "ondram/ci-detector", @@ -1980,24 +2027,27 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.2", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d" + "reference": "1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5", + "reference": "1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5", "shasum": "" }, "require": { + "doctrine/deprecations": "^1.0", "php": "^7.4 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.13" }, "require-dev": { "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", "phpstan/phpstan-phpunit": "^1.1", @@ -2029,9 +2079,9 @@ "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.6.2" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.0" }, - "time": "2022-10-14T12:47:21+00:00" + "time": "2023-03-12T10:13:29+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -2080,16 +2130,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.17", + "version": "1.10.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2" + "reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/204e459e7822f2c586463029f5ecec31bb45a1f2", - "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b10ceb526d9607903c5b2673f1fc8775dbe48975", + "reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975", "shasum": "" }, "require": { @@ -2118,8 +2168,11 @@ "static analysis" ], "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.17" + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" }, "funding": [ { @@ -2135,27 +2188,27 @@ "type": "tidelift" } ], - "time": "2023-02-08T12:25:00+00:00" + "time": "2023-03-16T15:24:20+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "10.0.0", + "version": "10.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "bf4fbc9c13af7da12b3ea807574fb460f255daba" + "reference": "20800e84296ea4732f9a125e08ce86b4004ae3e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/bf4fbc9c13af7da12b3ea807574fb460f255daba", - "reference": "bf4fbc9c13af7da12b3ea807574fb460f255daba", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/20800e84296ea4732f9a125e08ce86b4004ae3e4", + "reference": "20800e84296ea4732f9a125e08ce86b4004ae3e4", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", + "nikic/php-parser": "^4.15", "php": ">=8.1", "phpunit/php-file-iterator": "^4.0", "phpunit/php-text-template": "^3.0", @@ -2170,8 +2223,8 @@ "phpunit/phpunit": "^10.0" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { @@ -2204,7 +2257,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.0.0" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.0.2" }, "funding": [ { @@ -2212,20 +2265,20 @@ "type": "github" } ], - "time": "2023-02-03T07:14:34+00:00" + "time": "2023-03-06T13:00:19+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "4.0.0", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "7d66d4e816d34e90acec9db9d8d94b5cfbfe926f" + "reference": "fd9329ab3368f59fe1fe808a189c51086bd4b6bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/7d66d4e816d34e90acec9db9d8d94b5cfbfe926f", - "reference": "7d66d4e816d34e90acec9db9d8d94b5cfbfe926f", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/fd9329ab3368f59fe1fe808a189c51086bd4b6bd", + "reference": "fd9329ab3368f59fe1fe808a189c51086bd4b6bd", "shasum": "" }, "require": { @@ -2264,7 +2317,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.0.0" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.0.1" }, "funding": [ { @@ -2272,7 +2325,7 @@ "type": "github" } ], - "time": "2023-02-03T06:55:11+00:00" + "time": "2023-02-10T16:53:14+00:00" }, { "name": "phpunit/php-invoker", @@ -2457,16 +2510,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.0.7", + "version": "10.0.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a6f61c5629dd95db79af72f1e94d56702187479a" + "reference": "b75eddcabca052312ae38c8a2bc69ff1a7b89b77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a6f61c5629dd95db79af72f1e94d56702187479a", - "reference": "a6f61c5629dd95db79af72f1e94d56702187479a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b75eddcabca052312ae38c8a2bc69ff1a7b89b77", + "reference": "b75eddcabca052312ae38c8a2bc69ff1a7b89b77", "shasum": "" }, "require": { @@ -2498,7 +2551,7 @@ "sebastian/version": "^4.0" }, "suggest": { - "ext-soap": "*" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -2537,7 +2590,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.0.7" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.0.17" }, "funding": [ { @@ -2553,7 +2607,7 @@ "type": "tidelift" } ], - "time": "2023-02-08T15:16:31+00:00" + "time": "2023-03-20T14:42:33+00:00" }, { "name": "psalm/plugin-phpunit", @@ -2819,26 +2873,25 @@ }, { "name": "rector/rector", - "version": "0.15.13", + "version": "0.15.21", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "05df336f8e29873ed14c0790fbea68fa5de14f50" + "reference": "1cee8cc5d6d836e1bf9a3006d7b062adde3a6022" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/05df336f8e29873ed14c0790fbea68fa5de14f50", - "reference": "05df336f8e29873ed14c0790fbea68fa5de14f50", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/1cee8cc5d6d836e1bf9a3006d7b062adde3a6022", + "reference": "1cee8cc5d6d836e1bf9a3006d7b062adde3a6022", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.9.14" + "phpstan/phpstan": "^1.10.1" }, "conflict": { "rector/rector-doctrine": "*", "rector/rector-downgrade-php": "*", - "rector/rector-php-parser": "*", "rector/rector-phpunit": "*", "rector/rector-symfony": "*" }, @@ -2861,9 +2914,15 @@ "MIT" ], "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.13" + "source": "https://github.com/rectorphp/rector/tree/0.15.21" }, "funding": [ { @@ -2871,7 +2930,7 @@ "type": "github" } ], - "time": "2023-02-07T01:46:29+00:00" + "time": "2023-03-06T11:44:29+00:00" }, { "name": "sanmai/later", @@ -3971,26 +4030,25 @@ }, { "name": "spatie/array-to-xml", - "version": "2.17.1", + "version": "3.1.5", "source": { "type": "git", "url": "https://github.com/spatie/array-to-xml.git", - "reference": "5cbec9c6ab17e320c58a259f0cebe88bde4a7c46" + "reference": "13f76acef5362d15c71ae1ac6350cc3df5e25e43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/5cbec9c6ab17e320c58a259f0cebe88bde4a7c46", - "reference": "5cbec9c6ab17e320c58a259f0cebe88bde4a7c46", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/13f76acef5362d15c71ae1ac6350cc3df5e25e43", + "reference": "13f76acef5362d15c71ae1ac6350cc3df5e25e43", "shasum": "" }, "require": { "ext-dom": "*", - "php": "^7.4|^8.0" + "php": "^8.0" }, "require-dev": { "mockery/mockery": "^1.2", "pestphp/pest": "^1.21", - "phpunit/phpunit": "^9.0", "spatie/pest-plugin-snapshots": "^1.1" }, "type": "library", @@ -4019,7 +4077,7 @@ "xml" ], "support": { - "source": "https://github.com/spatie/array-to-xml/tree/2.17.1" + "source": "https://github.com/spatie/array-to-xml/tree/3.1.5" }, "funding": [ { @@ -4031,20 +4089,20 @@ "type": "github" } ], - "time": "2022-12-26T08:22:07+00:00" + "time": "2022-12-24T13:43:51+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.1", + "version": "3.7.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", "shasum": "" }, "require": { @@ -4080,27 +4138,28 @@ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2022-06-18T07:21:10+00:00" + "time": "2023-02-22T23:07:41+00:00" }, { "name": "symfony/console", - "version": "v6.2.5", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "3e294254f2191762c1d137aed4b94e966965e985" + "reference": "cbad09eb8925b6ad4fb721c7a179344dc4a19d45" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3e294254f2191762c1d137aed4b94e966965e985", - "reference": "3e294254f2191762c1d137aed4b94e966965e985", + "url": "https://api.github.com/repos/symfony/console/zipball/cbad09eb8925b6ad4fb721c7a179344dc4a19d45", + "reference": "cbad09eb8925b6ad4fb721c7a179344dc4a19d45", "shasum": "" }, "require": { @@ -4167,7 +4226,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.2.5" + "source": "https://github.com/symfony/console/tree/v6.2.7" }, "funding": [ { @@ -4183,20 +4242,20 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:38:09+00:00" + "time": "2023-02-25T17:00:03+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.2.0", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3" + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/1ee04c65529dea5d8744774d474e7cbd2f1206d3", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", "shasum": "" }, "require": { @@ -4234,7 +4293,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" }, "funding": [ { @@ -4250,20 +4309,20 @@ "type": "tidelift" } ], - "time": "2022-11-25T10:21:52+00:00" + "time": "2023-03-01T10:25:55+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v6.2.5", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "f02d108b5e9fd4a6245aa73a9d2df2ec060c3e68" + "reference": "404b307de426c1c488e5afad64403e5f145e82a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f02d108b5e9fd4a6245aa73a9d2df2ec060c3e68", - "reference": "f02d108b5e9fd4a6245aa73a9d2df2ec060c3e68", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/404b307de426c1c488e5afad64403e5f145e82a5", + "reference": "404b307de426c1c488e5afad64403e5f145e82a5", "shasum": "" }, "require": { @@ -4317,7 +4376,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/v6.2.5" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.2.7" }, "funding": [ { @@ -4333,20 +4392,20 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:38:09+00:00" + "time": "2023-02-14T08:44:56+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.2.0", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "0782b0b52a737a05b4383d0df35a474303cabdae" + "reference": "0ad3b6f1e4e2da5690fefe075cd53a238646d8dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/0782b0b52a737a05b4383d0df35a474303cabdae", - "reference": "0782b0b52a737a05b4383d0df35a474303cabdae", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/0ad3b6f1e4e2da5690fefe075cd53a238646d8dd", + "reference": "0ad3b6f1e4e2da5690fefe075cd53a238646d8dd", "shasum": "" }, "require": { @@ -4396,7 +4455,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.2.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.2.1" }, "funding": [ { @@ -4412,20 +4471,20 @@ "type": "tidelift" } ], - "time": "2022-11-25T10:21:52+00:00" + "time": "2023-03-01T10:32:47+00:00" }, { "name": "symfony/filesystem", - "version": "v6.2.5", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "e59e8a4006afd7f5654786a83b4fcb8da98f4593" + "reference": "82b6c62b959f642d000456f08c6d219d749215b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/e59e8a4006afd7f5654786a83b4fcb8da98f4593", - "reference": "e59e8a4006afd7f5654786a83b4fcb8da98f4593", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/82b6c62b959f642d000456f08c6d219d749215b3", + "reference": "82b6c62b959f642d000456f08c6d219d749215b3", "shasum": "" }, "require": { @@ -4459,7 +4518,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.2.5" + "source": "https://github.com/symfony/filesystem/tree/v6.2.7" }, "funding": [ { @@ -4475,20 +4534,20 @@ "type": "tidelift" } ], - "time": "2023-01-20T17:45:48+00:00" + "time": "2023-02-14T08:44:56+00:00" }, { "name": "symfony/finder", - "version": "v6.2.5", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "c90dc446976a612e3312a97a6ec0069ab0c2099c" + "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/c90dc446976a612e3312a97a6ec0069ab0c2099c", - "reference": "c90dc446976a612e3312a97a6ec0069ab0c2099c", + "url": "https://api.github.com/repos/symfony/finder/zipball/20808dc6631aecafbe67c186af5dcb370be3a0eb", + "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb", "shasum": "" }, "require": { @@ -4523,7 +4582,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.2.5" + "source": "https://github.com/symfony/finder/tree/v6.2.7" }, "funding": [ { @@ -4539,20 +4598,20 @@ "type": "tidelift" } ], - "time": "2023-01-20T17:45:48+00:00" + "time": "2023-02-16T09:57:23+00:00" }, { "name": "symfony/options-resolver", - "version": "v6.2.5", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "e8324d44f5af99ec2ccec849934a242f64458f86" + "reference": "aa0e85b53bbb2b4951960efd61d295907eacd629" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/e8324d44f5af99ec2ccec849934a242f64458f86", - "reference": "e8324d44f5af99ec2ccec849934a242f64458f86", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/aa0e85b53bbb2b4951960efd61d295907eacd629", + "reference": "aa0e85b53bbb2b4951960efd61d295907eacd629", "shasum": "" }, "require": { @@ -4590,7 +4649,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v6.2.5" + "source": "https://github.com/symfony/options-resolver/tree/v6.2.7" }, "funding": [ { @@ -4606,7 +4665,7 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:38:09+00:00" + "time": "2023-02-14T08:44:56+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5102,16 +5161,16 @@ }, { "name": "symfony/process", - "version": "v6.2.5", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "9ead139f63dfa38c4e4a9049cc64a8b2748c83b7" + "reference": "680e8a2ea6b3f87aecc07a6a65a203ae573d1902" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/9ead139f63dfa38c4e4a9049cc64a8b2748c83b7", - "reference": "9ead139f63dfa38c4e4a9049cc64a8b2748c83b7", + "url": "https://api.github.com/repos/symfony/process/zipball/680e8a2ea6b3f87aecc07a6a65a203ae573d1902", + "reference": "680e8a2ea6b3f87aecc07a6a65a203ae573d1902", "shasum": "" }, "require": { @@ -5143,7 +5202,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.2.5" + "source": "https://github.com/symfony/process/tree/v6.2.7" }, "funding": [ { @@ -5159,20 +5218,20 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:38:09+00:00" + "time": "2023-02-24T10:42:00+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.2.0", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75" + "reference": "a8c9cedf55f314f3a186041d19537303766df09a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/aac98028c69df04ee77eb69b96b86ee51fbf4b75", - "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a8c9cedf55f314f3a186041d19537303766df09a", + "reference": "a8c9cedf55f314f3a186041d19537303766df09a", "shasum": "" }, "require": { @@ -5228,7 +5287,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.2.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.2.1" }, "funding": [ { @@ -5244,20 +5303,20 @@ "type": "tidelift" } ], - "time": "2022-11-25T10:21:52+00:00" + "time": "2023-03-01T10:32:47+00:00" }, { "name": "symfony/stopwatch", - "version": "v6.2.5", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "00b6ac156aacffc53487c930e0ab14587a6607f6" + "reference": "f3adc98c1061875dd2edcd45e5b04e63d0e29f8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/00b6ac156aacffc53487c930e0ab14587a6607f6", - "reference": "00b6ac156aacffc53487c930e0ab14587a6607f6", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/f3adc98c1061875dd2edcd45e5b04e63d0e29f8f", + "reference": "f3adc98c1061875dd2edcd45e5b04e63d0e29f8f", "shasum": "" }, "require": { @@ -5290,7 +5349,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v6.2.5" + "source": "https://github.com/symfony/stopwatch/tree/v6.2.7" }, "funding": [ { @@ -5306,20 +5365,20 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:36:55+00:00" + "time": "2023-02-14T08:44:56+00:00" }, { "name": "symfony/string", - "version": "v6.2.5", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0" + "reference": "67b8c1eec78296b85dc1c7d9743830160218993d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0", - "reference": "b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0", + "url": "https://api.github.com/repos/symfony/string/zipball/67b8c1eec78296b85dc1c7d9743830160218993d", + "reference": "67b8c1eec78296b85dc1c7d9743830160218993d", "shasum": "" }, "require": { @@ -5376,7 +5435,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.2.5" + "source": "https://github.com/symfony/string/tree/v6.2.7" }, "funding": [ { @@ -5392,20 +5451,20 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:38:09+00:00" + "time": "2023-02-24T10:42:00+00:00" }, { "name": "symplify/easy-coding-standard", - "version": "11.2.8", + "version": "11.2.10", "source": { "type": "git", "url": "https://github.com/easy-coding-standard/easy-coding-standard.git", - "reference": "012d68b5cad4a5e3a6ccd99571209142b87491f5" + "reference": "5fc343df9b86e154516ddf506f7fe0b421d7d5ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/012d68b5cad4a5e3a6ccd99571209142b87491f5", - "reference": "012d68b5cad4a5e3a6ccd99571209142b87491f5", + "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/5fc343df9b86e154516ddf506f7fe0b421d7d5ef", + "reference": "5fc343df9b86e154516ddf506f7fe0b421d7d5ef", "shasum": "" }, "require": { @@ -5431,7 +5490,7 @@ "description": "Use Coding Standard with 0-knowledge of PHP-CS-Fixer and PHP_CodeSniffer", "support": { "issues": "https://github.com/easy-coding-standard/easy-coding-standard/issues", - "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/11.2.8" + "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/11.2.10" }, "funding": [ { @@ -5443,7 +5502,7 @@ "type": "github" } ], - "time": "2023-02-05T15:08:01+00:00" + "time": "2023-02-27T10:00:30+00:00" }, { "name": "thecodingmachine/safe", @@ -5636,22 +5695,22 @@ }, { "name": "vimeo/psalm", - "version": "5.6.0", + "version": "5.8.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "e784128902dfe01d489c4123d69918a9f3c1eac5" + "reference": "9cf4f60a333f779ad3bc704a555920e81d4fdcda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/e784128902dfe01d489c4123d69918a9f3c1eac5", - "reference": "e784128902dfe01d489c4123d69918a9f3c1eac5", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/9cf4f60a333f779ad3bc704a555920e81d4fdcda", + "reference": "9cf4f60a333f779ad3bc704a555920e81d4fdcda", "shasum": "" }, "require": { "amphp/amp": "^2.4.2", "amphp/byte-stream": "^1.5", - "composer/package-versions-deprecated": "^1.10.0", + "composer-runtime-api": "^2", "composer/semver": "^1.4 || ^2.0 || ^3.0", "composer/xdebug-handler": "^2.0 || ^3.0", "dnoegel/php-xdg-base-dir": "^0.1.1", @@ -5664,12 +5723,12 @@ "ext-tokenizer": "*", "felixfbecker/advanced-json-rpc": "^3.1", "felixfbecker/language-server-protocol": "^1.5.2", - "fidry/cpu-core-counter": "^0.4.0", + "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "nikic/php-parser": "^4.13", + "nikic/php-parser": "^4.14", "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0", "sebastian/diff": "^4.0 || ^5.0", - "spatie/array-to-xml": "^2.17.0", + "spatie/array-to-xml": "^2.17.0 || ^3.0", "symfony/console": "^4.1.6 || ^5.0 || ^6.0", "symfony/filesystem": "^5.4 || ^6.0" }, @@ -5678,13 +5737,13 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.4", - "brianium/paratest": "^6.0", + "brianium/paratest": "^6.9", "ext-curl": "*", "mockery/mockery": "^1.5", "nunomaduro/mock-final-classes": "^1.1", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/phpdoc-parser": "^1.6", - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^9.6", "psalm/plugin-mockery": "^1.1", "psalm/plugin-phpunit": "^0.18", "slevomat/coding-standard": "^8.4", @@ -5730,13 +5789,14 @@ "keywords": [ "code", "inspection", - "php" + "php", + "static analysis" ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.6.0" + "source": "https://github.com/vimeo/psalm/tree/5.8.0" }, - "time": "2023-01-23T20:32:47+00:00" + "time": "2023-03-09T04:14:35+00:00" }, { "name": "webmozart/assert", @@ -5798,7 +5858,7 @@ } ], "aliases": [], - "minimum-stability": "dev", + "minimum-stability": "stable", "stability-flags": { "ghostwriter/coding-standard": 20 }, diff --git a/psalm-baseline.xml b/psalm-baseline.xml index b60d8c6..2a811d0 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,2 +1,2 @@ - + diff --git a/src/Container.php b/src/Container.php index b8484be..a7d96d1 100644 --- a/src/Container.php +++ b/src/Container.php @@ -31,50 +31,34 @@ */ final class Container implements ContainerInterface { - private const DEFAULT_ALIASES = [ - ContainerInterface::class => self::class, + private const DEFAULT = [ + 'aliases' => [ + ContainerInterface::class => self::class, + ], + 'dependencies' => [], + 'extensions' => [], + 'factories' => [], + 'providers' => [], + 'services' => [ + self::class => 0, + ], + 'tags' => [], ]; - private const DEFAULT_SERVICES = [ - self::class => 0, - ]; - - /** - * @var array - */ - private array $aliases = self::DEFAULT_ALIASES; - - /** - * @var array - */ - private array $dependencies = []; - - /** - * @var array> - */ - private array $extensions = []; - - /** - * @var array - */ - private array $factories = []; - private static ?self $instance = null; /** - * @var array - */ - private array $providers = []; - - /** - * @var array - */ - private array $services = self::DEFAULT_SERVICES; - - /** - * @var array> + * @var array{ + * aliases:array, + * dependencies:array, + * extensions:array>, + * factories:array, + * providers:array, + * services:array, + * tags:array>, + * } */ - private array $tags = []; + private array $vault = self::DEFAULT; private function __construct() { @@ -83,13 +67,7 @@ private function __construct() public function __destruct() { - $this->aliases = self::DEFAULT_ALIASES; - $this->dependencies = []; - $this->extensions = []; - $this->factories = []; - $this->providers = []; - $this->services = self::DEFAULT_SERVICES; - $this->tags = []; + $this->vault = self::DEFAULT; } public function __clone() @@ -125,7 +103,7 @@ public function alias(string $abstract, string $concrete): void throw $this->throwNotFoundException('Service "%s" was not found.', $concrete); } - $this->aliases[$abstract] = $concrete; + $this->vault['aliases'][$abstract] = $concrete; } public function bind(string $abstract, ?string $concrete = null, array $tags = []): void @@ -139,19 +117,19 @@ public function bind(string $abstract, ?string $concrete = null, array $tags = [ throw $this->throwServiceIdMustBeNonEmptyString(); } - if (array_key_exists($abstract, $this->aliases)) { + if (array_key_exists($abstract, $this->vault['aliases'])) { throw $this->throwInvalidArgument('Service AlreadyRegisteredException %s', $abstract); } - if (array_key_exists($abstract, $this->services)) { + if (array_key_exists($abstract, $this->vault['services'])) { throw $this->throwInvalidArgument('Service AlreadyRegisteredException %s', $abstract); } - if (array_key_exists($abstract, $this->factories)) { + if (array_key_exists($abstract, $this->vault['factories'])) { throw $this->throwInvalidArgument('Service AlreadyRegisteredException %s', $abstract); } - $this->factories[$abstract] = + $this->vault['factories'][$abstract] = static fn (ContainerInterface $container): object => $container->build($concrete); if ([] === $tags) { @@ -171,11 +149,11 @@ public function build(string $class, array $arguments = []): object return $this; } - if (array_key_exists($class, $this->providers)) { + if (array_key_exists($class, $this->vault['providers'])) { throw $this->throwInvalidArgument('ServiceProvider "%s" is already registered.', $class); } - $dependencies = $this->dependencies; + $dependencies = $this->vault['dependencies']; if (array_key_exists($class, $dependencies)) { throw $this->throwNotFoundException( @@ -201,25 +179,25 @@ public function build(string $class, array $arguments = []): object $service = new $class(); if ($service instanceof ServiceProviderInterface) { - $this->providers[$class] = true; + $this->vault['providers'][$class] = true; } - return $this->services[$class] = $service; + return $this->vault['services'][$class] = $service; } - $this->dependencies[$class] = $class; + $this->vault['dependencies'][$class] = $class; $parameters = $this->buildParameters($reflectionMethod->getParameters(), $arguments); - unset($this->dependencies[$class]); + unset($this->vault['dependencies'][$class]); $service = new $class(...$parameters); if ($service instanceof ServiceProviderInterface) { - $this->providers[$class] = true; + $this->vault['providers'][$class] = true; } - return $this->services[$class] = $service; + return $this->vault['services'][$class] = $service; } public function call(callable|string $invokable, array $arguments = []): mixed @@ -242,8 +220,8 @@ public function extend(string $class, callable $extension): void throw $this->throwServiceIdMustBeNonEmptyString(); } - $factories = $this->factories; - $extensions = $this->extensions; + $factories = $this->vault['factories']; + $extensions = $this->vault['extensions']; if (! array_key_exists($class, $extensions) && ! array_key_exists($class, $factories) && @@ -252,7 +230,7 @@ public function extend(string $class, callable $extension): void throw $this->throwNotFoundException('Service "%s" was not found.', $class); } - $this->extensions[$class] = array_key_exists($class, $extensions) ? + $this->vault['extensions'][$class] = array_key_exists($class, $extensions) ? static fn ( ContainerInterface $container, object $service @@ -271,11 +249,15 @@ public function get(string $id): mixed return $this; } - if (array_key_exists($id, $this->services)) { - return $this->services[$id]; + if (array_key_exists($id, $this->vault)) { + return $this->vault[$id]; + } + + if (array_key_exists($id, $this->vault['services'])) { + return $this->vault['services'][$id]; } - $factories = $this->factories; + $factories = $this->vault['factories']; if (! array_key_exists($id, $factories) && ! class_exists($id)) { throw $this->throwNotFoundException('Service "%s" was not found.', $id); @@ -283,9 +265,9 @@ public function get(string $id): mixed $serviceFactory = $factories[$id] ?? static fn (Container $container): object => $container->build($id); - $extensions = $this->extensions; + $extensions = $this->vault['extensions']; - return $this->services[$id] = array_key_exists($id, $extensions) ? + return $this->vault['services'][$id] = array_key_exists($id, $extensions) ? $extensions[$id]($this, $serviceFactory($this)) : $serviceFactory($this); } @@ -299,9 +281,9 @@ public function has(string $id): bool { $id = $this->resolve($id); - return array_key_exists($id, $this->services) || - array_key_exists($id, $this->factories) || - array_key_exists($id, $this->aliases); + return array_key_exists($id, $this->vault['services']) || + array_key_exists($id, $this->vault['factories']) || + array_key_exists($id, $this->vault['aliases']); } public function register(string $serviceProvider): void @@ -328,11 +310,11 @@ public function remove(string $id): void } unset( - $this->aliases[$id], - $this->extensions[$id], - $this->factories[$id], - $this->services[$id], - $this->tags[$id] + $this->vault['aliases'][$id], + $this->vault['extensions'][$id], + $this->vault['factories'][$id], + $this->vault['services'][$id], + $this->vault['tags'][$id] ); } @@ -348,8 +330,9 @@ public function resolve(string $id): string throw $this->throwServiceIdMustBeNonEmptyString(); } - while (array_key_exists($id, $this->aliases)) { - $id = $this->aliases[$id]; + $aliases = $this->vault['aliases']; + while (array_key_exists($id, $aliases)) { + $id = $aliases[$id]; } return $id; @@ -361,26 +344,24 @@ public function set(string $id, mixed $value, array $tags = []): void throw $this->throwServiceIdMustBeNonEmptyString(); } - if (array_key_exists($id, $this->services)) { + if (array_key_exists($id, $this->vault['services'])) { throw $this->throwServiceAlreadyRegisteredException($id); } - if (array_key_exists($id, $this->factories)) { + if (array_key_exists($id, $this->vault['factories'])) { throw $this->throwServiceAlreadyRegisteredException($id); } - if (array_key_exists($id, $this->aliases)) { + if (array_key_exists($id, $this->vault['aliases'])) { throw $this->throwServiceAlreadyRegisteredException($id); } - /** @var array $factoryOrService */ - $factoryOrService = &$this->services; if (is_callable($value)) { - $factoryOrService = &$this->factories; + $this->vault['factories'][$id] = $value; + } else { + $this->vault['services'][$id] = $value; } - $factoryOrService[$id] = $value; - if ([] === $tags) { return; } @@ -394,7 +375,7 @@ public function tag(string $id, array $tags): void throw $this->throwServiceIdMustBeNonEmptyString(); } - $serviceTags = $this->tags; + $serviceTags = $this->vault['tags']; foreach ($tags as $tag) { if ('' === trim($tag)) { @@ -404,13 +385,16 @@ public function tag(string $id, array $tags): void $serviceTags[$tag][$id] ??= $id; } - $this->tags = $serviceTags; + $this->vault['tags'] = $serviceTags; } + /** + * @return Generator + */ public function tagged(string $tag): Generator { /** @var class-string|string $service */ - foreach ($this->tags[$tag] ?? [] as $service) { + foreach ($this->vault['tags'][$tag] ?? [] as $service) { yield $this->get($service); } } @@ -457,14 +441,14 @@ private function buildParameters(array $reflectionParameters, array $arguments): /** * @throws ReflectionException * - * @return Generator + * @return Generator, ReflectionParameter, mixed, void> */ private function getParametersForCallable(Closure $closure): Generator { yield from (new ReflectionFunction($closure))->getParameters(); } - private function throwContainerException(string $message, mixed ...$values): ContainerExceptionInterface + private function throwContainerException(string $message, string ...$values): ContainerExceptionInterface { return new class(sprintf( $message, @@ -473,7 +457,7 @@ private function throwContainerException(string $message, mixed ...$values): Con }; } - private function throwInvalidArgument(string $message, mixed ...$values): ContainerExceptionInterface + private function throwInvalidArgument(string $message, string ...$values): ContainerExceptionInterface { return new class(sprintf( $message, @@ -482,7 +466,7 @@ private function throwInvalidArgument(string $message, mixed ...$values): Contai }; } - private function throwNotFoundException(string $message, mixed ...$values): NotFoundExceptionInterface + private function throwNotFoundException(string $message, string ...$values): NotFoundExceptionInterface { return new class(sprintf($message, ...$values)) extends RuntimeException implements NotFoundExceptionInterface { }; diff --git a/tests/Unit/ContainerTest.php b/tests/Unit/ContainerTest.php index b8213ef..a0f9861 100644 --- a/tests/Unit/ContainerTest.php +++ b/tests/Unit/ContainerTest.php @@ -301,7 +301,7 @@ public static function dataProviderServiceIdMustBeNonEmptyString(): Generator ]; } - public function dataProviderServiceNotFoundException(): Generator + public static function dataProviderServiceNotFoundException(): Generator { yield 'ServiceNotFoundException::missingServiceId@get' => [ static fn (Container $container): string => $container->get('dose-not-exist'), @@ -341,7 +341,7 @@ public static function dataProviderServices(): Generator yield 'callable' => ['closure', $closure, 'closure-called']; } - public function dataProviderServiceTagMustBeNonEmptyStringException(): Generator + public static function dataProviderServiceTagMustBeNonEmptyStringException(): Generator { yield 'ServiceTagMustBeNonEmptyStringException@empty' => [ static fn (Container $container) => $container->tag(Container::class, ['']),