diff --git a/README.md b/README.md index 16ef142..f503c38 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,8 @@ Here's all the code you need to get going: ```php route(); @@ -57,6 +59,10 @@ A controller can be defined by simply giving a class the attribute of `RouteCont ```php =7.0" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -496,7 +428,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -520,9 +452,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0" }, - "time": "2023-08-13T19:53:39+00:00" + "time": "2024-01-07T17:17:35+00:00" }, { "name": "phar-io/manifest", @@ -637,35 +569,35 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.29", + "version": "11.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" + "reference": "5e238e4b982cb272bf9faeee6f33af83d465d0e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", - "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5e238e4b982cb272bf9faeee6f33af83d465d0e2", + "reference": "5e238e4b982cb272bf9faeee6f33af83d465d0e2", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.15", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", + "nikic/php-parser": "^5.0", + "php": ">=8.2", + "phpunit/php-file-iterator": "^5.0", + "phpunit/php-text-template": "^4.0", + "sebastian/code-unit-reverse-lookup": "^4.0", + "sebastian/complexity": "^4.0", + "sebastian/environment": "^7.0", + "sebastian/lines-of-code": "^3.0", + "sebastian/version": "^5.0", "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -674,7 +606,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "11.0-dev" } }, "autoload": { @@ -703,7 +635,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.0" }, "funding": [ { @@ -711,32 +643,32 @@ "type": "github" } ], - "time": "2023-09-19T04:57:46+00:00" + "time": "2024-02-02T06:03:46+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "99e95c94ad9500daca992354fa09d7b99abe2210" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/99e95c94ad9500daca992354fa09d7b99abe2210", + "reference": "99e95c94ad9500daca992354fa09d7b99abe2210", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -763,7 +695,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.0.0" }, "funding": [ { @@ -771,28 +704,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2024-02-02T06:05:04+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "5d8d9355a16d8cc5a1305b0a85342cfa420612be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5d8d9355a16d8cc5a1305b0a85342cfa420612be", + "reference": "5d8d9355a16d8cc5a1305b0a85342cfa420612be", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-pcntl": "*" @@ -800,7 +733,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -826,7 +759,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.0" }, "funding": [ { @@ -834,32 +768,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2024-02-02T06:05:50+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "d38f6cbff1cdb6f40b03c9811421561668cc133e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/d38f6cbff1cdb6f40b03c9811421561668cc133e", + "reference": "d38f6cbff1cdb6f40b03c9811421561668cc133e", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -885,7 +819,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.0" }, "funding": [ { @@ -893,32 +828,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2024-02-02T06:06:56+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "7.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "8a59d9e25720482ee7fcdf296595e08795b84dc5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8a59d9e25720482ee7fcdf296595e08795b84dc5", + "reference": "8a59d9e25720482ee7fcdf296595e08795b84dc5", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -944,7 +879,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "security": "https://github.com/sebastianbergmann/php-timer/security/policy", + "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.0" }, "funding": [ { @@ -952,24 +888,23 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2024-02-02T06:08:01+00:00" }, { "name": "phpunit/phpunit", - "version": "9.6.13", + "version": "11.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be" + "reference": "de24e7e7c67fbf437f7b6cd7bc919f2dc6fd89d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be", - "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/de24e7e7c67fbf437f7b6cd7bc919f2dc6fd89d4", + "reference": "de24e7e7c67fbf437f7b6cd7bc919f2dc6fd89d4", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -979,27 +914,25 @@ "myclabs/deep-copy": "^1.10.1", "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.28", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", - "sebastian/version": "^3.0.2" + "php": ">=8.2", + "phpunit/php-code-coverage": "^11.0", + "phpunit/php-file-iterator": "^5.0", + "phpunit/php-invoker": "^5.0", + "phpunit/php-text-template": "^4.0", + "phpunit/php-timer": "^7.0", + "sebastian/cli-parser": "^3.0", + "sebastian/code-unit": "^3.0", + "sebastian/comparator": "^6.0", + "sebastian/diff": "^6.0", + "sebastian/environment": "^7.0", + "sebastian/exporter": "^6.0", + "sebastian/global-state": "^7.0", + "sebastian/object-enumerator": "^6.0", + "sebastian/type": "^5.0", + "sebastian/version": "^5.0" }, "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -1007,7 +940,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.6-dev" + "dev-main": "11.0-dev" } }, "autoload": { @@ -1039,7 +972,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.0.3" }, "funding": [ { @@ -1055,32 +988,32 @@ "type": "tidelift" } ], - "time": "2023-09-19T05:39:22+00:00" + "time": "2024-02-10T06:31:16+00:00" }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "efd6ce5bb8131fe981e2f879dbd47605fbe0cc6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/efd6ce5bb8131fe981e2f879dbd47605fbe0cc6f", + "reference": "efd6ce5bb8131fe981e2f879dbd47605fbe0cc6f", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1103,7 +1036,8 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.0" }, "funding": [ { @@ -1111,32 +1045,32 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-02-02T05:48:04+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "6634549cb8d702282a04a774e36a7477d2bd9015" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/6634549cb8d702282a04a774e36a7477d2bd9015", + "reference": "6634549cb8d702282a04a774e36a7477d2bd9015", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1159,7 +1093,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + "security": "https://github.com/sebastianbergmann/code-unit/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.0" }, "funding": [ { @@ -1167,32 +1102,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2024-02-02T05:50:41+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "df80c875d3e459b45c6039e4d9b71d4fbccae25d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/df80c875d3e459b45c6039e4d9b71d4fbccae25d", + "reference": "df80c875d3e459b45c6039e4d9b71d4fbccae25d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1214,7 +1149,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.0" }, "funding": [ { @@ -1222,34 +1158,36 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2024-02-02T05:52:17+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "bd0f2fa5b9257c69903537b266ccb80fcf940db8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/bd0f2fa5b9257c69903537b266ccb80fcf940db8", + "reference": "bd0f2fa5b9257c69903537b266ccb80fcf940db8", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/diff": "^6.0", + "sebastian/exporter": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1288,7 +1226,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/6.0.0" }, "funding": [ { @@ -1296,33 +1235,33 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2024-02-02T05:53:45+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "88a434ad86150e11a606ac4866b09130712671f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/88a434ad86150e11a606ac4866b09130712671f0", + "reference": "88a434ad86150e11a606ac4866b09130712671f0", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1345,7 +1284,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.0" }, "funding": [ { @@ -1353,33 +1293,33 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2024-02-02T05:55:19+00:00" }, { "name": "sebastian/diff", - "version": "4.0.5", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + "reference": "3e3f502419518897a923aa1c64d51f9def2e0aff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3e3f502419518897a923aa1c64d51f9def2e0aff", + "reference": "3e3f502419518897a923aa1c64d51f9def2e0aff", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^11.0", "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1411,7 +1351,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.0" }, "funding": [ { @@ -1419,27 +1360,27 @@ "type": "github" } ], - "time": "2023-05-07T05:35:17+00:00" + "time": "2024-02-02T05:56:35+00:00" }, { "name": "sebastian/environment", - "version": "5.1.5", + "version": "7.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + "reference": "100d8b855d7180f79f9a9a5c483f2d960581c3ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/100d8b855d7180f79f9a9a5c483f2d960581c3ea", + "reference": "100d8b855d7180f79f9a9a5c483f2d960581c3ea", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-posix": "*" @@ -1447,7 +1388,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1466,7 +1407,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -1474,7 +1415,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/7.0.0" }, "funding": [ { @@ -1482,34 +1424,34 @@ "type": "github" } ], - "time": "2023-02-03T06:03:51+00:00" + "time": "2024-02-02T05:57:54+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "d0c0a93fc746b0c066037f1e7d09104129e868ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d0c0a93fc746b0c066037f1e7d09104129e868ff", + "reference": "d0c0a93fc746b0c066037f1e7d09104129e868ff", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1551,7 +1493,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/6.0.0" }, "funding": [ { @@ -1559,38 +1502,35 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2024-02-02T05:58:52+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.6", + "version": "7.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bde739e7565280bda77be70044ac1047bc007e34" + "reference": "590e7cbc6565fa2e26c3df4e629a34bb0bc00c17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", - "reference": "bde739e7565280bda77be70044ac1047bc007e34", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/590e7cbc6565fa2e26c3df4e629a34bb0bc00c17", + "reference": "590e7cbc6565fa2e26c3df4e629a34bb0bc00c17", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1609,13 +1549,14 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.0" }, "funding": [ { @@ -1623,33 +1564,33 @@ "type": "github" } ], - "time": "2023-08-02T09:26:13+00:00" + "time": "2024-02-02T05:59:33+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "376c5b3f6b43c78fdc049740bca76a7c846706c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/376c5b3f6b43c78fdc049740bca76a7c846706c0", + "reference": "376c5b3f6b43c78fdc049740bca76a7c846706c0", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1672,7 +1613,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.0" }, "funding": [ { @@ -1680,34 +1622,34 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2024-02-02T06:00:36+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "f75f6c460da0bbd9668f43a3dde0ec0ba7faa678" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f75f6c460da0bbd9668f43a3dde0ec0ba7faa678", + "reference": "f75f6c460da0bbd9668f43a3dde0ec0ba7faa678", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1729,7 +1671,8 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.0" }, "funding": [ { @@ -1737,32 +1680,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2024-02-02T06:01:29+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "bb2a6255d30853425fd38f032eb64ced9f7f132d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/bb2a6255d30853425fd38f032eb64ced9f7f132d", + "reference": "bb2a6255d30853425fd38f032eb64ced9f7f132d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1784,7 +1727,8 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.0" }, "funding": [ { @@ -1792,32 +1736,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2024-02-02T06:02:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "b75224967b5a466925c6d54e68edd0edf8dd4ed4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b75224967b5a466925c6d54e68edd0edf8dd4ed4", + "reference": "b75224967b5a466925c6d54e68edd0edf8dd4ed4", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1847,7 +1791,8 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.0" }, "funding": [ { @@ -1855,87 +1800,32 @@ "type": "github" } ], - "time": "2023-02-03T06:07:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2024-02-02T06:08:48+00:00" }, { "name": "sebastian/type", - "version": "3.2.1", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + "reference": "b8502785eb3523ca0dd4afe9ca62235590020f3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8502785eb3523ca0dd4afe9ca62235590020f3f", + "reference": "b8502785eb3523ca0dd4afe9ca62235590020f3f", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1958,7 +1848,8 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + "security": "https://github.com/sebastianbergmann/type/security/policy", + "source": "https://github.com/sebastianbergmann/type/tree/5.0.0" }, "funding": [ { @@ -1966,29 +1857,29 @@ "type": "github" } ], - "time": "2023-02-03T06:13:03+00:00" + "time": "2024-02-02T06:09:34+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "13999475d2cb1ab33cb73403ba356a814fdbb001" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/13999475d2cb1ab33cb73403ba356a814fdbb001", + "reference": "13999475d2cb1ab33cb73403ba356a814fdbb001", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -2011,7 +1902,8 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "security": "https://github.com/sebastianbergmann/version/security/policy", + "source": "https://github.com/sebastianbergmann/version/tree/5.0.0" }, "funding": [ { @@ -2019,7 +1911,7 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2024-02-02T06:10:47+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -2080,16 +1972,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", "shasum": "" }, "require": { @@ -2118,7 +2010,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.2" }, "funding": [ { @@ -2126,7 +2018,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2023-11-20T00:12:19+00:00" } ], "aliases": [], diff --git a/docs/Attributes/Parameters/HEADER_PARAMETER.MD b/docs/Attributes/Parameters/HEADER_PARAMETER.MD index 9eff4d9..432856e 100644 --- a/docs/Attributes/Parameters/HEADER_PARAMETER.MD +++ b/docs/Attributes/Parameters/HEADER_PARAMETER.MD @@ -21,7 +21,7 @@ Code: #[Method(HttpMethod::GET)] #[Path('/header')] public function headerParameter( - #[FileParameter('header')] string $header + #[HeaderParameter('header')] string $header ): ResponseBuilder { return (new ResponseBuilder()) ->setHttpStatusCode(HttpStatusCode::HTTP_ACCEPTED); diff --git a/docs/Attributes/Parameters/PATH_PARAMETER.MD b/docs/Attributes/Parameters/PATH_PARAMETER.MD index c248a3e..a1fa135 100644 --- a/docs/Attributes/Parameters/PATH_PARAMETER.MD +++ b/docs/Attributes/Parameters/PATH_PARAMETER.MD @@ -21,7 +21,7 @@ Code: #[Method(HttpMethod::GET)] #[Path('/path/{paramId}')] public function pathParameter( - #[FileParameter('paramId')] int $paramId + #[PathParameter('paramId')] int $paramId ): ResponseBuilder { return (new ResponseBuilder()) ->setData($paramId) diff --git a/docs/Attributes/Parameters/POST_PARAMETER.MD b/docs/Attributes/Parameters/POST_PARAMETER.MD index 5ba15f1..3fafcec 100644 --- a/docs/Attributes/Parameters/POST_PARAMETER.MD +++ b/docs/Attributes/Parameters/POST_PARAMETER.MD @@ -21,7 +21,7 @@ Code: #[Method(HttpMethod::POST)] #[Path('/post')] public function postParameter( - #[FileParameter('name')] string $name + #[PostParameter('name')] string $name ): ResponseBuilder { return (new ResponseBuilder()) ->setData($name) diff --git a/docs/Attributes/Parameters/QUERY_PARAMETER.MD b/docs/Attributes/Parameters/QUERY_PARAMETER.MD index e3a3d84..4a7c80a 100644 --- a/docs/Attributes/Parameters/QUERY_PARAMETER.MD +++ b/docs/Attributes/Parameters/QUERY_PARAMETER.MD @@ -21,7 +21,7 @@ Code: #[Method(HttpMethod::GET)] #[Path('/query')] public function queryParameter( - #[FileParameter('age')] int $age + #[QueryParameter('age')] int $age ): ResponseBuilder { return (new ResponseBuilder()) ->setData($age) @@ -32,6 +32,6 @@ Code: cURL: ```shell curl --request GET \ - --location 'http://localhost/path/123' \ + --location 'http://localhost/query' \ --data-urlencode 'age=30' ``` diff --git a/docs/ERROR_CODES.MD b/docs/ERROR_CODES.MD index 56b2f85..caf488d 100644 --- a/docs/ERROR_CODES.MD +++ b/docs/ERROR_CODES.MD @@ -6,8 +6,10 @@ All error codes and corresponding exceptions documented extend the exception `St | Code | Thrown By | Exception | HTTP Status | Description | |--------|-------------------|------------------------------------------------|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| RTB001 | `RouteBuilder` | `ComposerFileDoesNotExistException` | 503 | Cannot find the referenced composer file. | -| RTB002 | `RouteBuilder` | `ComposerFileInvalidFormatException` | 503 | The composer file specified is invalid [JSON](https://www.json.org/json-en.html) or does not have a [PSR-4](https://www.php-fig.org/psr/psr-4/) configuration. | +| RTB001 | `RouteBuilder` | `ComposerFileDoesNotExistException` | 500 | Cannot find the referenced composer file. | +| RTB002 | `RouteBuilder` | `ComposerFileInvalidFormatException` | 500 | Composer file specified is a directory and not a file. | +| RTB003 | `RouteBuilder` | `ComposerFileInvalidFormatException` | 500 | The composer file specified is invalid [JSON](https://www.json.org/json-en.html) or does not have a [PSR-4](https://www.php-fig.org/psr/psr-4/) configuration. | +| RTB004 | `RouteBuilder` | `InvalidApplicationDirectoryException` | 500 | Application path specified is not a directory. | | R001 | `Router` | `InvalidRouteResponseException` | 500 | The route method did not return a valid `ResponseBuilder` object. | | R002 | `Router` | `InvalidContentTypeException` | 415 | Request did match a route path, but did not match the accepted media type. | | R003 | `Router` | `NoValidRouteException` | 404 | Request did not match any route defined. | diff --git a/docs/Setup/APACHE_SETUP.MD b/docs/Setup/APACHE_SETUP.MD index 60c0737..cea19f9 100644 --- a/docs/Setup/APACHE_SETUP.MD +++ b/docs/Setup/APACHE_SETUP.MD @@ -1,3 +1,40 @@ # Apache Setup -TODO \ No newline at end of file +To use streetlamp with Apache you will need to route all PHP requests related to your application to a singular file. +There's multiple ways to approach your configuration, but there's no "right" way to do it, as long as it works then for the most part it's fine. + +## vHost Rewrite + +The approach that's used within the Streetlamp's init is a simple rewrite of all requests into `index.php`. + +```text + + + DocumentRoot /app + + ErrorLog /dev/stderr + CustomLog /dev/stdout combined + + + Options Indexes FollowSymlinks MultiViews + AllowOverride None + Require all granted + RewriteEngine on + RewriteRule ^(.*)$ index.php/$1 [L,QSA] + + + ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://php:9000/app/index.php + + + +``` + +If you want to exclude static files such as `robots.txt` or `css/js` files then you add a `RewriteCond` such as: + +```text +RewriteEngine on +RewriteCond $1 !^(favicon\.ico|favicon\.png|media|robots\.txt|crossdomain\.xml|css|js) +RewriteRule ^(.*)$ index.php/$1 [L,QSA] +``` + +This should allow files to resolve as usual. \ No newline at end of file diff --git a/docs/Setup/NGINX_SETUP.MD b/docs/Setup/NGINX_SETUP.MD index e1f141a..6f934c8 100644 --- a/docs/Setup/NGINX_SETUP.MD +++ b/docs/Setup/NGINX_SETUP.MD @@ -15,7 +15,6 @@ If you do have files that you may need to access directly then this would probab ```text server { listen 80; - server_name localhost; access_log /dev/stdout main; error_log /dev/stderr info; @@ -33,8 +32,6 @@ server { } ``` -___Note: This is the configuration used when running `./vendor/bin/streetlamp init docker`___ - ## vHost rewrite directive The rewrite approach is my personal preference and maintains the constraint of the `index.php` being the sole gateway for the application. @@ -43,7 +40,6 @@ Now, unlike the `try_files` approach of nginx it does mean that even assets have ```text server { listen 80; - server_name localhost; access_log /dev/stdout main; error_log /dev/stderr info; @@ -61,10 +57,17 @@ server { } ``` -If you wanted to allow assets to be accessed outside of PHP you could do so by adding something like this before `location ~* ^/(?!(index\.php))`: +If you wanted to allow assets to be accessed outside of PHP you could do so by adding something like this before the location rewrite: ```text -location ~* \.(js|ico|gif|jpg|png|svg|css|jpeg|eot|woff|ttf)$ {} + location ~* \.(js|ico|gif|jpg|png|svg|css|jpeg|eot|woff|ttf)$ { + } + + location / { + rewrite ^ /index.php$is_args$args; + } ``` This will allow the files to resolve as they usually would. + +___Note: This is the configuration used when running `./vendor/bin/streetlamp init docker`___ diff --git a/phpunit.xml b/phpunit.xml index e7e2dca..a38eebb 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,13 +1,13 @@ - - - - src/ - - + tests + + + src/ + + diff --git a/phpunit.xml.bak b/phpunit.xml.bak new file mode 100644 index 0000000..e7e2dca --- /dev/null +++ b/phpunit.xml.bak @@ -0,0 +1,13 @@ + + + + + src/ + + + + + tests + + + diff --git a/src/Commands/Command.php b/src/Commands/Command.php new file mode 100644 index 0000000..c1fec7a --- /dev/null +++ b/src/Commands/Command.php @@ -0,0 +1,66 @@ +missingArgument( + $errorMessage, + $availableCommands + ); + } + + return array_shift($arguments); + } + + protected function missingArgument(string $message, array $options): void + { + $message .= PHP_EOL . "All available arguments: " . PHP_EOL; + + foreach ($options as $argument => $description) { + $message .= ' ' . str_pad($argument, 10) . ' - ' . $description . PHP_EOL; + } + + throw new Exception($message); + } + + protected function execute( + string $command, + ?array $arguments, + array $availableCommands, + string $errorMessage + ): void { + if (!array_key_exists($command, $availableCommands)) { + $this->missingArgument( + $errorMessage, + $availableCommands + ); + } + + $this->{$command}->command($arguments); + } + + protected function buildRouteBuilderFromArguments(?array $arguments = []): RouteBuilder + { + $routerConfig = new RouterConfigBuilder(); + + if (0 < count($arguments)) { + $routerConfig->setRootDirectory(array_shift($arguments)); + } + + if (0 < count($arguments)) { + $routerConfig->setComposerFile(array_shift($arguments)); + } + + return new RouteBuilder($routerConfig->build()); + } +} diff --git a/src/Commands/CommandInterface.php b/src/Commands/CommandInterface.php new file mode 100644 index 0000000..e5c881d --- /dev/null +++ b/src/Commands/CommandInterface.php @@ -0,0 +1,10 @@ + 'Scaffold a basic docker application.' + ]; + + public function __construct( + protected readonly Docker $docker + ) { + } + + public function command(?array $arguments = []): void + { + $command = $this->popArgument( + $arguments, + self::AVAILABLE_COMMANDS, + self::ERROR_MESSAGE + ); + + $this->execute( + $command, + $arguments, + self::AVAILABLE_COMMANDS, + self::ERROR_MESSAGE + ); + } +} diff --git a/src/Commands/Init/Docker.php b/src/Commands/Init/Docker.php new file mode 100644 index 0000000..81be2e0 --- /dev/null +++ b/src/Commands/Init/Docker.php @@ -0,0 +1,43 @@ + 'Initialise a docker environment with Nginx.', + 'apache' => 'Initialise a docker environment with Apache.' + ]; + + public function __construct( + readonly protected Apache $apache, + readonly protected Nginx $nginx + ) { + } + + public function command(?array $arguments = []): void + { + $command = $this->popArgument( + $arguments, + self::AVAILABLE_COMMANDS, + self::ERROR_MESSAGE + ); + + $this->execute( + $command, + $arguments, + self::AVAILABLE_COMMANDS, + self::ERROR_MESSAGE + ); + + echo "Done. Run `docker compose up` to start your application locally and go to http://localhost once it's finished.", PHP_EOL; + } +} diff --git a/src/Commands/Init/Servers/Apache.php b/src/Commands/Init/Servers/Apache.php new file mode 100644 index 0000000..82194ad --- /dev/null +++ b/src/Commands/Init/Servers/Apache.php @@ -0,0 +1,31 @@ + 'Lists all available routes.', + 'cache' => 'Route cache operations.' + ]; + + public function __construct( + protected readonly Lists $lists, + protected readonly Cache $cache + ) { + } + + public function command(?array $arguments = []): void + { + $command = $this->popArgument( + $arguments, + self::AVAILABLE_COMMANDS, + self::ERROR_MESSAGE + ); + + $this->execute( + $command, + $arguments, + self::AVAILABLE_COMMANDS, + self::ERROR_MESSAGE + ); + } +} diff --git a/src/Commands/Routes/Cache.php b/src/Commands/Routes/Cache.php new file mode 100644 index 0000000..06c6420 --- /dev/null +++ b/src/Commands/Routes/Cache.php @@ -0,0 +1,38 @@ + 'Clear the route cache.' + ]; + + public function __construct( + readonly protected Clear $clear + ) { + } + + public function command(?array $arguments = []): void + { + $command = $this->popArgument( + $arguments, + self::AVAILABLE_COMMANDS, + self::ERROR_MESSAGE + ); + + $this->execute( + $command, + $arguments, + self::AVAILABLE_COMMANDS, + self::ERROR_MESSAGE + ); + } +} diff --git a/src/Commands/Routes/Cache/Clear.php b/src/Commands/Routes/Cache/Clear.php new file mode 100644 index 0000000..3066b72 --- /dev/null +++ b/src/Commands/Routes/Cache/Clear.php @@ -0,0 +1,17 @@ +buildRouteBuilderFromArguments($arguments); + $routeBuilder->clearCachedConfig(); + } +} diff --git a/src/Commands/Routes/Lists.php b/src/Commands/Routes/Lists.php new file mode 100644 index 0000000..4ac1e5b --- /dev/null +++ b/src/Commands/Routes/Lists.php @@ -0,0 +1,72 @@ +buildRouteBuilderFromArguments($arguments); + + $columnHeaders = [ + 'Method', + 'Path', + 'Accepts', + 'Class', + 'Function' + ]; + + $columnBreaksLength = (count($columnHeaders) - 1) * 3 + 4; + $columnLengths = []; + + for ($i = 0; $i < count($columnHeaders); $i++) { + $columnLengths[$i] = strlen($columnHeaders[$i]); + } + + foreach ($routeBuilder->getRoutes() as $route) { + $columnLengths[0] = max(strlen($route->getMethod()), $columnLengths[0]); + $columnLengths[1] = max(strlen($route->getPath()), $columnLengths[1]); + $columnLengths[2] = max(strlen($route->getAccepts() ?? ''), $columnLengths[2]); + $columnLengths[3] = max(strlen($route->getClass()), $columnLengths[3]); + $columnLengths[4] = max(strlen($route->getFunction()), $columnLengths[4]); + } + + $totalLength = array_sum($columnLengths) + $columnBreaksLength; + + $this->printTableBreak($totalLength); + $this->printRow($columnHeaders, $columnLengths); + $this->printTableBreak($totalLength); + + foreach ($routeBuilder->getRoutes() as $route) { + $row = [ + $route->getMethod(), + $route->getPath(), + $route->getAccepts() ?? '', + $route->getClass(), + $route->getFunction() + ]; + $this->printRow($row, $columnLengths); + } + + $this->printTableBreak($totalLength); + } + + private function printRow(array $row, array $columnLengths): void + { + for ($i = 0; $i < count($row); $i++) { + $row[$i] = str_pad($row[$i], $columnLengths[$i]); + } + + echo '| ', implode(' | ', $row), ' |', PHP_EOL; + } + + private function printTableBreak($length): void + { + echo str_repeat('-', $length), PHP_EOL; + } +} diff --git a/src/Exceptions/ComposerFileDoesNotExistException.php b/src/Exceptions/ComposerFileDoesNotExistException.php index 0bc54a5..0397d90 100644 --- a/src/Exceptions/ComposerFileDoesNotExistException.php +++ b/src/Exceptions/ComposerFileDoesNotExistException.php @@ -12,6 +12,6 @@ public function __construct( string $code = "", string $message = "" ) { - parent::__construct($code, $message, HttpStatusCode::HTTP_SERVICE_UNAVAILABLE); + parent::__construct($code, $message, HttpStatusCode::HTTP_INTERNAL_SERVER_ERROR); } } diff --git a/src/Exceptions/ComposerFileInvalidFormatException.php b/src/Exceptions/ComposerFileInvalidFormatException.php index 9d2bb91..b8a0841 100644 --- a/src/Exceptions/ComposerFileInvalidFormatException.php +++ b/src/Exceptions/ComposerFileInvalidFormatException.php @@ -12,6 +12,6 @@ public function __construct( string $code = "", string $message = "" ) { - parent::__construct($code, $message, HttpStatusCode::HTTP_SERVICE_UNAVAILABLE); + parent::__construct($code, $message, HttpStatusCode::HTTP_INTERNAL_SERVER_ERROR); } } diff --git a/src/Exceptions/InvalidApplicationDirectoryException.php b/src/Exceptions/InvalidApplicationDirectoryException.php new file mode 100644 index 0000000..0cb0eea --- /dev/null +++ b/src/Exceptions/InvalidApplicationDirectoryException.php @@ -0,0 +1,15 @@ +routerConfig->getComposerFile())) { - throw new ComposerFileDoesNotExistException("RTB001", "Cannot locate the composer.json file."); + $composerJsonFilePath = $this->routerConfig->getComposerFile(); + + if (!file_exists($composerJsonFilePath)) { + throw new ComposerFileDoesNotExistException( + "RTB001", + "Cannot locate the composer file {$composerJsonFilePath}." + ); + } + + if (is_dir($composerJsonFilePath)) { + throw new ComposerFileDoesNotExistException( + "RTB002", + "Path specified {$composerJsonFilePath} is a directory not a composer file." + ); } - $composerJsonFile = file_get_contents($this->routerConfig->getComposerFile()); + + $composerJsonFile = file_get_contents($composerJsonFilePath); $json = json_decode($composerJsonFile, true); if (empty($json['autoload']['psr-4'])) { throw new ComposerFileInvalidFormatException( - "RTB002", - "composer.json is invalid or missing psr-4 configuration." + "RTB003", + "Composer file specified is invalid or missing psr-4 configuration." ); } @@ -178,9 +193,17 @@ private function isInExcludedDirectory(string $path): bool * @param string $directory * @param array $results * @return array + * @throws InvalidApplicationDirectoryException */ private function getDirectoryContents(string $directory, array &$results = array()): array { + if (!is_dir($directory)) { + throw new InvalidApplicationDirectoryException( + "RTB004", + "{$directory} is not a valid application directory." + ); + } + $files = scandir($directory); foreach ($files as $value) { diff --git a/src/Streetlamp.php b/src/Streetlamp.php index 1ed23b2..e8e0ce4 100644 --- a/src/Streetlamp.php +++ b/src/Streetlamp.php @@ -4,232 +4,39 @@ namespace willitscale\Streetlamp; -use willitscale\Streetlamp\Builders\RouterConfigBuilder; +use willitscale\Streetlamp\Commands\Command; +use willitscale\Streetlamp\Commands\CommandInterface; +use willitscale\Streetlamp\Commands\Init; +use willitscale\Streetlamp\Commands\Routes; -final readonly class Streetlamp +class Streetlamp extends Command implements CommandInterface { - private const ALLOWED_COMMANDS = [ + private const ERROR_MESSAGE = "Expected at least 1 argument in the form of COMMAND ..."; + + private const AVAILABLE_COMMANDS = [ 'init' => 'Initialise a resource.', 'routes' => 'List all available routes for the application.' ]; - private const INIT_ACTIONS = [ - 'docker' => 'Scaffold a basic docker application.' - ]; - - private const ROUTE_ACTIONS = [ - 'list' => 'List all available routes.', - 'cache' => 'Route cache operations.' - ]; - - private const CACHE_OPERATIONS = [ - 'clear' => 'Clear the route cache.' - ]; - - public function __construct(int $argumentCount, array $arguments) - { - if (2 > $argumentCount) { - $this->missingArgument( - "Expected at least 1 argument in the form of COMMAND ...", - self::ALLOWED_COMMANDS - ); - } - - array_shift($arguments); - $command = array_shift($arguments); - - $this->command($command, $arguments); + public function __construct( + readonly protected Init $init, + readonly protected Routes $routes + ) { } - private function command(string $command, ?array $arguments = []): void + public function command(?array $arguments = []): void { - switch ($command) { - case 'init': - $this->init($arguments); - break; - case 'routes': - $this->routes($arguments); - break; - default: - $this->missingArgument( - "Command given of available commands:", - self::ALLOWED_COMMANDS - ); - } - } - - private function init(?array $arguments = []): void - { - if (empty($arguments)) { - $this->missingArgument( - "Missing action for init command:", - self::INIT_ACTIONS - ); - } - - $action = array_shift($arguments); - - switch ($action) { - case 'docker': - $this->docker($arguments); - break; - default: - $this->missingArgument( - "Invalid action for init command:", - self::INIT_ACTIONS - ); - } - } - - private function docker(?array $arguments = []): void - { - echo "Setting up Docker for Streetlamp", PHP_EOL; - - mkdir($_SERVER['PWD'] . '/docker/nginx', 0777, true); - copy(__DIR__ . '/../templates/nginx.conf.tmpl', $_SERVER['PWD'] . '/docker/nginx/default.conf'); - copy(__DIR__ . '/../templates/docker-compose.yml.tmpl', $_SERVER['PWD'] . '/docker-compose.yml'); - - echo "Done. Run `docker compose up` to start your application locally and go to http://localhost once it's finished.", PHP_EOL; - } - - private function routes(?array $arguments = []): void - { - if (empty($arguments)) { - $this->missingArgument( - "Missing action for routes command:", - self::ROUTE_ACTIONS - ); - } - - $action = array_shift($arguments); - - switch ($action) { - case 'list': - $this->listRoutes($arguments); - break; - case 'cache': - $this->listCache($arguments); - break; - default: - $this->missingArgument( - "Invalid action for routes command:", - self::ROUTE_ACTIONS - ); - } - } - - private function listCache(?array $arguments = []): void - { - if (empty($arguments)) { - $this->missingArgument( - "Missing operation for cache action:", - self::CACHE_OPERATIONS - ); - } - - $operation = array_shift($arguments); + $command = $this->popArgument( + $arguments, + self::AVAILABLE_COMMANDS, + self::ERROR_MESSAGE + ); - switch ($operation) { - case 'clear': - $this->cacheClear($arguments); - break; - default: - $this->missingArgument( - "Invalid operation for cache action:", - self::CACHE_OPERATIONS - ); - } - } - - private function cacheClear(?array $arguments = []): void - { - $routeBuilder = $this->buildRouteBuilderFromArguments($arguments); - $routeBuilder->clearCachedConfig(); - } - - private function buildRouteBuilderFromArguments(?array $arguments = []) - { - $routerConfig = new RouterConfigBuilder(); - - if (0 < count($arguments)) { - $routerConfig->setRootDirectory(array_shift($arguments)); - } - - if (0 < count($arguments)) { - $routerConfig->setComposerFile(array_shift($arguments)); - } - - return new RouteBuilder($routerConfig->build()); - } - - private function listRoutes(?array $arguments = []): void - { - $routeBuilder = $this->buildRouteBuilderFromArguments($arguments); - - $methodColumn = 'Method'; - $pathColumn = 'Path'; - $acceptsColumn = 'Accepts'; - $classColumn = 'Class'; - $functionColumn = 'Function'; - - $columnBreaksLength = 16; - - $maxMethodLength = strlen($methodColumn); - $maxPathLength = strlen($pathColumn); - $maxAcceptsLength = strlen($acceptsColumn); - $maxClassLength = strlen($classColumn); - $maxFunctionLength = strlen($functionColumn); - - foreach ($routeBuilder->getRoutes() as $route) { - $maxMethodLength = max(strlen($route->getMethod()), $maxMethodLength); - $maxPathLength = max(strlen($route->getPath()), $maxPathLength); - $maxAcceptsLength = max(strlen($route->getAccepts() ?? ''), $maxAcceptsLength); - $maxClassLength = max(strlen($route->getClass()), $maxClassLength); - $maxFunctionLength = max(strlen($route->getFunction()), $maxFunctionLength); - } - - $totalLength = $maxMethodLength + - $maxPathLength + - $maxAcceptsLength + - $maxClassLength + - $maxFunctionLength + - $columnBreaksLength; - - $this->printTableBreak($totalLength); - - echo '| ', - str_pad($methodColumn, $maxMethodLength), ' | ', - str_pad($pathColumn, $maxPathLength), ' | ', - str_pad($acceptsColumn, $maxAcceptsLength), ' | ', - str_pad($classColumn, $maxClassLength), ' | ', - str_pad($functionColumn, $maxFunctionLength), ' |', PHP_EOL; - - $this->printTableBreak($totalLength); - - foreach ($routeBuilder->getRoutes() as $route) { - echo '| ', - str_pad($route->getMethod(), $maxMethodLength), ' | ', - str_pad($route->getPath(), $maxPathLength), ' | ', - str_pad($route->getAccepts() ?? '', $maxAcceptsLength), ' | ', - str_pad($route->getClass(), $maxClassLength), ' | ', - str_pad($route->getFunction(), $maxFunctionLength), ' |', PHP_EOL; - } - - $this->printTableBreak($totalLength); - } - - private function printTableBreak($length): void - { - echo str_repeat('-', $length), PHP_EOL; - } - - private function missingArgument(string $message, array $options): void - { - echo $message, PHP_EOL, - "All available arguments: ", PHP_EOL; - foreach ($options as $argument => $description) { - echo ' ', str_pad($argument, 10), ' - ', $description, PHP_EOL; - } - exit(1); + $this->execute( + $command, + $arguments, + self::AVAILABLE_COMMANDS, + self::ERROR_MESSAGE, + ); } } diff --git a/streetlamp b/streetlamp index 6518c36..d8464c6 100755 --- a/streetlamp +++ b/streetlamp @@ -3,6 +3,15 @@ require_once('vendor/autoload.php'); +use DI\Container; use willitscale\Streetlamp\Streetlamp; -new Streetlamp($argc, $argv); +try { + array_shift($argv); + (new Container()) + ->make(Streetlamp::class) + ->command($argv); +} catch (Exception $e) { + echo $e->getMessage(), PHP_EOL; + exit(1); +} diff --git a/templates/apache/Dockerfile.tmpl b/templates/apache/Dockerfile.tmpl new file mode 100644 index 0000000..867a7a0 --- /dev/null +++ b/templates/apache/Dockerfile.tmpl @@ -0,0 +1,6 @@ +FROM httpd:2 + +RUN echo "Include conf/vhosts/*.conf" >> /usr/local/apache2/conf/httpd.conf +RUN sed -i '/LoadModule rewrite_module/s/^#//g' /usr/local/apache2/conf/httpd.conf +RUN sed -i '/LoadModule proxy_module/s/^#//g' /usr/local/apache2/conf/httpd.conf +RUN sed -i '/LoadModule proxy_fcgi_module/s/^#//g' /usr/local/apache2/conf/httpd.conf \ No newline at end of file diff --git a/templates/apache/apache.conf.tmpl b/templates/apache/apache.conf.tmpl new file mode 100644 index 0000000..9d8ef13 --- /dev/null +++ b/templates/apache/apache.conf.tmpl @@ -0,0 +1,20 @@ + + + DocumentRoot /app + DirectoryIndex /index.php index.php + + ErrorLog /dev/stderr + CustomLog /dev/stdout combined + + + Options Indexes FollowSymlinks MultiViews + AllowOverride None + Require all granted + RewriteEngine on + RewriteCond $1 !^(favicon\.ico|favicon\.png|media|robots\.txt|crossdomain\.xml|css|js) + RewriteRule ^(.*)$ index.php/$1 [L,QSA] + + + ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://php:9000/app/index.php + + diff --git a/templates/docker-compose.yml.tmpl b/templates/docker-compose.yml.tmpl index 48144b6..6db07b9 100644 --- a/templates/docker-compose.yml.tmpl +++ b/templates/docker-compose.yml.tmpl @@ -1,28 +1,30 @@ -version: "3.9" - -services: - www: - image: nginx:1 - volumes: - - ./:/app - - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf - working_dir: /app - depends_on: - php: - condition: service_started - ports: - - "80:80" - - php: - image: php:8.3-fpm - volumes: - - ./:/app - depends_on: - composer: - condition: service_completed_successfully - - composer: - image: composer:2 - volumes: - - ./:/app - command: [ "composer", "install", "--no-dev" ] +version: "3.9" + +services: + www: +{NGINX} build: docker/nginx{/NGINX} +{APACHE} build: docker/apache{/APACHE} + volumes: + - ./:/app +{NGINX} - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf{/NGINX} +{APACHE} - ./docker/apache/default.conf:/usr/local/apache2/conf/vhosts/default.conf{/APACHE} + working_dir: /app + depends_on: + php: + condition: service_started + ports: + - "80:80" + + php: + image: php:8.3-fpm + volumes: + - ./:/app + depends_on: + composer: + condition: service_completed_successfully + + composer: + image: composer:2 + volumes: + - ./:/app + command: [ "composer", "install", "--no-dev" ] diff --git a/templates/nginx/Dockerfile.tmpl b/templates/nginx/Dockerfile.tmpl new file mode 100644 index 0000000..0071486 --- /dev/null +++ b/templates/nginx/Dockerfile.tmpl @@ -0,0 +1 @@ +FROM nginx \ No newline at end of file diff --git a/templates/nginx.conf.tmpl b/templates/nginx/nginx.conf.tmpl similarity index 88% rename from templates/nginx.conf.tmpl rename to templates/nginx/nginx.conf.tmpl index 6b3d869..c4fb857 100644 --- a/templates/nginx.conf.tmpl +++ b/templates/nginx/nginx.conf.tmpl @@ -1,29 +1,29 @@ -server { - listen 80; - - error_log /dev/stderr; - access_log /dev/stdout main; - - root /app; - index index.php; - - location ~* \.(js|ico|gif|jpg|png|svg|css|jpeg|eot|woff|ttf)$ { - } - - location ~* ^/(?!(index\.php)) { - rewrite ^ /index.php$is_args$args; - } - - location ~ \.php$ { - include fastcgi_params; - - fastcgi_connect_timeout 10s; - fastcgi_read_timeout 10s; - - fastcgi_buffers 16 16k; - fastcgi_buffer_size 32k; - - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_pass php:9000; - } -} +server { + listen 80; + + error_log /dev/stderr; + access_log /dev/stdout main; + + root /app; + index index.php; + + location ~* \.(js|ico|gif|jpg|png|svg|css|jpeg|eot|woff|ttf)$ { + } + + location ~* ^/(?!(index\.php)) { + rewrite ^ /index.php; + } + + location ~ \.php$ { + include fastcgi_params; + + fastcgi_connect_timeout 10s; + fastcgi_read_timeout 10s; + + fastcgi_buffers 16 16k; + fastcgi_buffer_size 32k; + + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_pass php:9000; + } +} diff --git a/tests/Attributes/AcceptsTest.php b/tests/Attributes/AcceptsTest.php index a18b9ba..e8314ba 100644 --- a/tests/Attributes/AcceptsTest.php +++ b/tests/Attributes/AcceptsTest.php @@ -4,6 +4,7 @@ namespace willitscale\StreetlampTests\Attributes; +use PHPUnit\Framework\Attributes\DataProvider; use willitscale\Streetlamp\Attributes\Accepts; use willitscale\Streetlamp\Models\Controller; use willitscale\Streetlamp\Models\Route; @@ -11,12 +12,7 @@ class AcceptsTest extends TestCase { - /** - * @test - * @param string $expected - * @return void - * @dataProvider validAcceptAnnotations - */ + #[DataProvider('validAcceptAnnotations')] public function testProcessRouteAnnotationExtractsValidMediaTypeFromAcceptAnnotationAndBindsItToTheRoute( string $expected ): void { @@ -26,12 +22,7 @@ public function testProcessRouteAnnotationExtractsValidMediaTypeFromAcceptAnnota $this->assertEquals($expected, $route->getAccepts()); } - /** - * @test - * @param string $expected - * @return void - * @dataProvider validAcceptAnnotations - */ + #[DataProvider('validAcceptAnnotations')] public function testProcessControllerAnnotationExtractsValidMediaTypeFromAcceptAnnotationAndBindsItToTheController( string $expected ): void { @@ -41,9 +32,6 @@ public function testProcessControllerAnnotationExtractsValidMediaTypeFromAcceptA $this->assertEquals($expected, $controller->getAccepts()); } - /** - * @return array - */ public static function validAcceptAnnotations(): array { return [ diff --git a/tests/Attributes/Parameter/BodyParameterTest.php b/tests/Attributes/Parameter/BodyParameterTest.php index 8b073ff..d60c140 100644 --- a/tests/Attributes/Parameter/BodyParameterTest.php +++ b/tests/Attributes/Parameter/BodyParameterTest.php @@ -4,19 +4,14 @@ namespace willitscale\StreetlampTests\Attributes\Parameter; +use PHPUnit\Framework\Attributes\DataProvider; use willitscale\Streetlamp\Attributes\Parameter\BodyParameter; use willitscale\Streetlamp\Exceptions\Parameters\MissingRequireBodyException; use PHPUnit\Framework\TestCase; class BodyParameterTest extends TestCase { - /** - * @param bool|int|float|string $expectedValue - * @param string $dataType - * @param string $resourceIdentifier - * @return void - * @dataProvider validValues - */ + #[DataProvider('validValues')] public function testAValueIsExtractedCorrectlyFromTheBody( bool|int|float|string $expectedValue, string $dataType, @@ -32,9 +27,6 @@ public function testAValueIsExtractedCorrectlyFromTheBody( } } - /** - * @return void - */ public function testThatAnExceptionIsThrownWhenThereIsNoOrAnEmptyBody(): void { $this->expectException(MissingRequireBodyException::class); diff --git a/tests/Attributes/Parameter/FileParameterTest.php b/tests/Attributes/Parameter/FileParameterTest.php index 92460ac..1ce0e33 100644 --- a/tests/Attributes/Parameter/FileParameterTest.php +++ b/tests/Attributes/Parameter/FileParameterTest.php @@ -4,23 +4,15 @@ namespace willitscale\StreetlampTests\Attributes\Parameter; +use PHPUnit\Framework\Attributes\DataProvider; use willitscale\Streetlamp\Attributes\Parameter\FileParameter; use willitscale\Streetlamp\Attributes\Validators\FilterVarsValidator; -use willitscale\Streetlamp\Attributes\Validators\ValidatorInterface; use willitscale\Streetlamp\Exceptions\Parameters\MissingRequiredFilesException; use PHPUnit\Framework\TestCase; class FileParameterTest extends TestCase { - /** - * @param string $key - * @param string $inputValue - * @param bool|int|float|string $expectedValue - * @param string $dataType - * @param ValidatorInterface[] $validators - * @return void - * @dataProvider validValues - */ + #[DataProvider('validValues')] public function testAValueIsExtractedCorrectlyFromFiles( string $key, string $inputValue, @@ -36,9 +28,6 @@ public function testAValueIsExtractedCorrectlyFromFiles( unset($_FILES[$key]); } - /** - * @return void - */ public function testThatAnExceptionIsThrownWhenAMissingFileIsSpecified(): void { $this->expectException(MissingRequiredFilesException::class); diff --git a/tests/Attributes/Parameter/HeaderParameterTest.php b/tests/Attributes/Parameter/HeaderParameterTest.php index 035f734..9eb7343 100644 --- a/tests/Attributes/Parameter/HeaderParameterTest.php +++ b/tests/Attributes/Parameter/HeaderParameterTest.php @@ -4,23 +4,15 @@ namespace willitscale\StreetlampTests\Attributes\Parameter; +use PHPUnit\Framework\Attributes\DataProvider; use willitscale\Streetlamp\Attributes\Parameter\HeaderParameter; use willitscale\Streetlamp\Attributes\Validators\FilterVarsValidator; -use willitscale\Streetlamp\Attributes\Validators\ValidatorInterface; use willitscale\Streetlamp\Exceptions\Parameters\MissingRequiredHeaderException; use PHPUnit\Framework\TestCase; class HeaderParameterTest extends TestCase { - /** - * @param string $key - * @param string $inputValue - * @param bool|int|float|string $expectedValue - * @param string $dataType - * @param ValidatorInterface[] $validators - * @return void - * @dataProvider validValues - */ + #[DataProvider('validValues')] public function testAValueIsExtractedCorrectlyFromHeaders( string $key, string $inputValue, @@ -37,9 +29,6 @@ public function testAValueIsExtractedCorrectlyFromHeaders( unset($_SERVER[$serverKey]); } - /** - * @return void - */ public function testThatAnExceptionIsThrownWhenAMissingHeaderIsSpecified(): void { $this->expectException(MissingRequiredHeaderException::class); diff --git a/tests/Attributes/Parameter/PathParameterTest.php b/tests/Attributes/Parameter/PathParameterTest.php index 4486703..1d02ca1 100644 --- a/tests/Attributes/Parameter/PathParameterTest.php +++ b/tests/Attributes/Parameter/PathParameterTest.php @@ -4,23 +4,15 @@ namespace willitscale\StreetlampTests\Attributes\Parameter; +use PHPUnit\Framework\Attributes\DataProvider; use willitscale\Streetlamp\Attributes\Parameter\PathParameter; use willitscale\Streetlamp\Attributes\Validators\FilterVarsValidator; -use willitscale\Streetlamp\Attributes\Validators\ValidatorInterface; use willitscale\Streetlamp\Exceptions\Parameters\MissingRequiredPathException; use PHPUnit\Framework\TestCase; class PathParameterTest extends TestCase { - /** - * @param string $key - * @param string $inputValue - * @param bool|int|float|string $expectedValue - * @param string $dataType - * @param ValidatorInterface[] $validators - * @return void - * @dataProvider validValues - */ + #[DataProvider('validValues')] public function testAValueIsExtractedCorrectlyFromPathParameters( string $key, string $inputValue, @@ -36,9 +28,6 @@ public function testAValueIsExtractedCorrectlyFromPathParameters( $this->assertEquals($expectedValue, $returnedValue); } - /** - * @return void - */ public function testThatAnExceptionIsThrownWhenAMissingPathParameterIsSpecified(): void { $this->expectException(MissingRequiredPathException::class); diff --git a/tests/Attributes/Parameter/PostParameterTest.php b/tests/Attributes/Parameter/PostParameterTest.php index 32b0fb1..b279514 100644 --- a/tests/Attributes/Parameter/PostParameterTest.php +++ b/tests/Attributes/Parameter/PostParameterTest.php @@ -4,23 +4,15 @@ namespace willitscale\StreetlampTests\Attributes\Parameter; +use PHPUnit\Framework\Attributes\DataProvider; use willitscale\Streetlamp\Attributes\Parameter\PostParameter; use willitscale\Streetlamp\Attributes\Validators\FilterVarsValidator; -use willitscale\Streetlamp\Attributes\Validators\ValidatorInterface; use willitscale\Streetlamp\Exceptions\Parameters\MissingRequiredPostException; use PHPUnit\Framework\TestCase; class PostParameterTest extends TestCase { - /** - * @param string $key - * @param string $inputValue - * @param bool|int|float|string $expectedValue - * @param string $dataType - * @param ValidatorInterface[] $validators - * @return void - * @dataProvider validValues - */ + #[DataProvider('validValues')] public function testAValueIsExtractedCorrectlyFromPost( string $key, string $inputValue, @@ -38,9 +30,6 @@ public function testAValueIsExtractedCorrectlyFromPost( unset($_POST[$key]); } - /** - * @return void - */ public function testThatAnExceptionIsThrownWhenAMissingPostIsSpecified(): void { $this->expectException(MissingRequiredPostException::class); diff --git a/tests/Attributes/Parameter/QueryParameterTest.php b/tests/Attributes/Parameter/QueryParameterTest.php index e52bd89..137d12e 100644 --- a/tests/Attributes/Parameter/QueryParameterTest.php +++ b/tests/Attributes/Parameter/QueryParameterTest.php @@ -4,23 +4,15 @@ namespace willitscale\StreetlampTests\Attributes\Parameter; +use PHPUnit\Framework\Attributes\DataProvider; use willitscale\Streetlamp\Attributes\Parameter\QueryParameter; use willitscale\Streetlamp\Attributes\Validators\FilterVarsValidator; -use willitscale\Streetlamp\Attributes\Validators\ValidatorInterface; use willitscale\Streetlamp\Exceptions\Parameters\MissingRequireQueryException; use PHPUnit\Framework\TestCase; class QueryParameterTest extends TestCase { - /** - * @param string $key - * @param string $inputValue - * @param bool|int|float|string $expectedValue - * @param string $dataType - * @param ValidatorInterface[] $validators - * @return void - * @dataProvider validValues - */ + #[DataProvider('validValues')] public function testAValueIsExtractedCorrectlyFromPost( string $key, string $inputValue, @@ -38,9 +30,6 @@ public function testAValueIsExtractedCorrectlyFromPost( unset($_GET[$key]); } - /** - * @return void - */ public function testThatAnExceptionIsThrownWhenAMissingPostIsSpecified(): void { $this->expectException(MissingRequireQueryException::class); diff --git a/tests/Attributes/PathTest.php b/tests/Attributes/PathTest.php index 616f380..1eea82f 100644 --- a/tests/Attributes/PathTest.php +++ b/tests/Attributes/PathTest.php @@ -4,6 +4,7 @@ namespace willitscale\StreetlampTests\Attributes; +use PHPUnit\Framework\Attributes\DataProvider; use willitscale\Streetlamp\Attributes\Path; use willitscale\Streetlamp\Models\Controller; use willitscale\Streetlamp\Models\Route; @@ -11,12 +12,7 @@ class PathTest extends TestCase { - /** - * @test - * @param string $expected - * @return void - * @dataProvider validAcceptAnnotations - */ + #[DataProvider('validAcceptAnnotations')] public function testProcessRouteAnnotationExtractsValidPathFromAnnotationAndBindsItToTheRoute( string $expected ): void { @@ -26,12 +22,7 @@ public function testProcessRouteAnnotationExtractsValidPathFromAnnotationAndBind $this->assertEquals($expected, $route->getPath()); } - /** - * @test - * @param string $expected - * @return void - * @dataProvider validAcceptAnnotations - */ + #[DataProvider('validAcceptAnnotations')] public function testProcessControllerAnnotationExtractsValidMediaTypeFromAcceptAnnotationAndBindsItToTheController( string $expected ): void { diff --git a/tests/Attributes/PostFlightTest.php b/tests/Attributes/PostFlightTest.php index 9a354d6..a21211a 100644 --- a/tests/Attributes/PostFlightTest.php +++ b/tests/Attributes/PostFlightTest.php @@ -4,6 +4,7 @@ namespace willitscale\StreetlampTests\Attributes; +use PHPUnit\Framework\Attributes\DataProvider; use willitscale\Streetlamp\Attributes\PostFlight; use willitscale\Streetlamp\Models\Controller; use willitscale\Streetlamp\Models\Route; @@ -11,12 +12,7 @@ class PostFlightTest extends TestCase { - /** - * @test - * @param array $expectedClasses - * @return void - * @dataProvider validAnnotations - */ + #[DataProvider('validAnnotations')] public function testProcessRouteAnnotationCorrectlyAndExtractThePostFlightClass( array $expectedClasses ): void { @@ -36,12 +32,7 @@ public function testProcessRouteAnnotationCorrectlyAndExtractThePostFlightClass( } } - /** - * @test - * @param array $expectedClasses - * @return void - * @dataProvider validAnnotations - */ + #[DataProvider('validAnnotations')] public function testProcessControllerAnnotationCorrectlyAndExtractThePostFlightClass( array $expectedClasses ): void { diff --git a/tests/Attributes/PreFlightTest.php b/tests/Attributes/PreFlightTest.php index 9edd2a5..bedede2 100644 --- a/tests/Attributes/PreFlightTest.php +++ b/tests/Attributes/PreFlightTest.php @@ -4,6 +4,7 @@ namespace willitscale\StreetlampTests\Attributes; +use PHPUnit\Framework\Attributes\DataProvider; use willitscale\Streetlamp\Attributes\PreFlight; use willitscale\Streetlamp\Models\Controller; use willitscale\Streetlamp\Models\Route; @@ -11,12 +12,7 @@ class PreFlightTest extends TestCase { - /** - * @test - * @param array $expectedClasses - * @return void - * @dataProvider validAnnotations - */ + #[DataProvider('validAnnotations')] public function testProcessRouteAnnotationCorrectlyAndExtractThePreflightClass( array $expectedClasses ): void { @@ -35,12 +31,7 @@ public function testProcessRouteAnnotationCorrectlyAndExtractThePreflightClass( } } - /** - * @test - * @param array $expectedClasses - * @return void - * @dataProvider validAnnotations - */ + #[DataProvider('validAnnotations')] public function testProcessControllerAnnotationCorrectlyAndExtractThePreflightClass( array $expectedClasses ): void { diff --git a/tests/Attributes/Route/MethodTest.php b/tests/Attributes/Route/MethodTest.php index bd433b6..1ba76f1 100644 --- a/tests/Attributes/Route/MethodTest.php +++ b/tests/Attributes/Route/MethodTest.php @@ -4,6 +4,7 @@ namespace Attributes\Route; +use PHPUnit\Framework\Attributes\DataProvider; use willitscale\Streetlamp\Attributes\Route\Method; use willitscale\Streetlamp\Enums\HttpMethod; use willitscale\Streetlamp\Exceptions\Attributes\InvalidAttributeContextException; @@ -13,11 +14,7 @@ class MethodTest extends TestCase { - /** - * @param HttpMethod $expectedMethod - * @return void - * @dataProvider validRouteAnnotations - */ + #[DataProvider('validRouteAnnotations')] public function testMethodIsAssignedToTheRouteCorrectly( HttpMethod $expectedMethod ): void { diff --git a/tests/Attributes/Validators/AlphabeticValidatorTest.php b/tests/Attributes/Validators/AlphabeticValidatorTest.php index 09eb1d9..274649e 100644 --- a/tests/Attributes/Validators/AlphabeticValidatorTest.php +++ b/tests/Attributes/Validators/AlphabeticValidatorTest.php @@ -4,17 +4,13 @@ namespace willitscale\StreetlampTests\Attributes\Validators; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use willitscale\Streetlamp\Attributes\Validators\AlphabeticValidator; class AlphabeticValidatorTest extends TestCase { - /** - * @param string $input - * @param bool $expectedResult - * @return void - * @dataProvider validateScenarios - */ + #[DataProvider('validateScenarios')] public function testThatValidateCorrectlyValidatesTheInput( string $input, bool $expectedResult @@ -24,10 +20,7 @@ public function testThatValidateCorrectlyValidatesTheInput( $this->assertEquals($expectedResult, $response); } - /** - * @return array[] - */ - public function validateScenarios(): array + public static function validateScenarios(): array { return [ "it should validate that a string only contains alphabetic characters" => [ diff --git a/tests/Attributes/Validators/EmailValidatorTest.php b/tests/Attributes/Validators/EmailValidatorTest.php index bb2e98b..c6d45a1 100644 --- a/tests/Attributes/Validators/EmailValidatorTest.php +++ b/tests/Attributes/Validators/EmailValidatorTest.php @@ -4,17 +4,13 @@ namespace willitscale\StreetlampTests\Attributes\Validators; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use willitscale\Streetlamp\Attributes\Validators\EmailValidator; class EmailValidatorTest extends TestCase { - /** - * @param string $input - * @param bool $expectedResult - * @return void - * @dataProvider validateScenarios - */ + #[DataProvider('validateScenarios')] public function testThatValidateCorrectlyValidatesTheInput( string $input, bool $expectedResult @@ -24,10 +20,7 @@ public function testThatValidateCorrectlyValidatesTheInput( $this->assertEquals($expectedResult, $response); } - /** - * @return array[] - */ - public function validateScenarios(): array + public static function validateScenarios(): array { return [ "it should validate that the input is a valid email address" => [ diff --git a/tests/Attributes/Validators/FilterValidatorTest.php b/tests/Attributes/Validators/FilterValidatorTest.php index 9882384..182a8ab 100644 --- a/tests/Attributes/Validators/FilterValidatorTest.php +++ b/tests/Attributes/Validators/FilterValidatorTest.php @@ -4,19 +4,13 @@ namespace willitscale\StreetlampTests\Attributes\Validators; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use willitscale\Streetlamp\Attributes\Validators\FilterVarsValidator; class FilterValidatorTest extends TestCase { - /** - * @param int $filter - * @param string $input - * @param bool $expectedResult - * @param int|array $options - * @return void - * @dataProvider validateScenarios - */ + #[DataProvider('validateScenarios')] public function testThatValidateCorrectlyValidatesTheInput( int $filter, string $input, @@ -28,14 +22,7 @@ public function testThatValidateCorrectlyValidatesTheInput( $this->assertEquals($expectedResult, $response); } - /** - * @param int $filter - * @param string $input - * @param string $expectedResult - * @param int|array $options - * @return void - * @dataProvider sanitizeScenarios - */ + #[DataProvider('sanitizeScenarios')] public function testThatSanitizeCorrectlySanitizesTheInput( int $filter, string $input, @@ -47,10 +34,7 @@ public function testThatSanitizeCorrectlySanitizesTheInput( $this->assertEquals($expectedResult, $response); } - /** - * @return array[] - */ - public function validateScenarios(): array + public static function validateScenarios(): array { return [ "it should validate that a string containing a URL filters correctly" => [ @@ -66,10 +50,7 @@ public function validateScenarios(): array ]; } - /** - * @return array[] - */ - public function sanitizeScenarios(): array + public static function sanitizeScenarios(): array { return [ "it should validate that a date string matches correctly" => [ diff --git a/tests/Attributes/Validators/FloatValidatorTest.php b/tests/Attributes/Validators/FloatValidatorTest.php index 9dcedc8..0ba6ede 100644 --- a/tests/Attributes/Validators/FloatValidatorTest.php +++ b/tests/Attributes/Validators/FloatValidatorTest.php @@ -4,19 +4,13 @@ namespace willitscale\StreetlampTests\Attributes\Validators; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use willitscale\Streetlamp\Attributes\Validators\FloatValidator; class FloatValidatorTest extends TestCase { - /** - * @param string $input - * @param bool $expectedResult - * @param float|null $min - * @param float|null $max - * @return void - * @dataProvider validateScenarios - */ + #[DataProvider('validateScenarios')] public function testThatValidateCorrectlyValidatesTheInput( string $input, bool $expectedResult, @@ -28,12 +22,7 @@ public function testThatValidateCorrectlyValidatesTheInput( $this->assertEquals($expectedResult, $response); } - /** - * @param string $input - * @param float $expectedResult - * @return void - * @dataProvider sanitizeScenarios - */ + #[DataProvider('sanitizeScenarios')] public function testThatSanitizeCorrectlySanitizesTheInput( string $input, float $expectedResult @@ -43,10 +32,7 @@ public function testThatSanitizeCorrectlySanitizesTheInput( $this->assertEquals($expectedResult, $response); } - /** - * @return array[] - */ - public function validateScenarios(): array + public static function validateScenarios(): array { return [ "it should validate that the value passed is a valid float" => [ @@ -72,10 +58,7 @@ public function validateScenarios(): array ]; } - /** - * @return array[] - */ - public function sanitizeScenarios(): array + public static function sanitizeScenarios(): array { return [ "it should validate that a string sanitizes to the float equivalent" => [ diff --git a/tests/Attributes/Validators/IntValidatorTest.php b/tests/Attributes/Validators/IntValidatorTest.php index 36d8193..ad9cec4 100644 --- a/tests/Attributes/Validators/IntValidatorTest.php +++ b/tests/Attributes/Validators/IntValidatorTest.php @@ -4,19 +4,13 @@ namespace willitscale\StreetlampTests\Attributes\Validators; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use willitscale\Streetlamp\Attributes\Validators\IntValidator; class IntValidatorTest extends TestCase { - /** - * @param string $input - * @param bool $expectedResult - * @param int|null $min - * @param int|null $max - * @return void - * @dataProvider validateScenarios - */ + #[DataProvider('validateScenarios')] public function testThatValidateCorrectlyValidatesTheInput( string $input, bool $expectedResult, @@ -28,12 +22,7 @@ public function testThatValidateCorrectlyValidatesTheInput( $this->assertEquals($expectedResult, $response); } - /** - * @param string $input - * @param int $expectedResult - * @return void - * @dataProvider sanitizeScenarios - */ + #[DataProvider('sanitizeScenarios')] public function testThatSanitizeCorrectlySanitizesTheInput( string $input, int $expectedResult @@ -43,10 +32,7 @@ public function testThatSanitizeCorrectlySanitizesTheInput( $this->assertEquals($expectedResult, $response); } - /** - * @return array[] - */ - public function validateScenarios(): array + public static function validateScenarios(): array { return [ "it should validate that the value passed is a valid integer" => [ @@ -72,10 +58,7 @@ public function validateScenarios(): array ]; } - /** - * @return array[] - */ - public function sanitizeScenarios(): array + public static function sanitizeScenarios(): array { return [ "it should validate that a string sanitizes to the integer equivalent" => [ diff --git a/tests/Attributes/Validators/RegExpValidatorTest.php b/tests/Attributes/Validators/RegExpValidatorTest.php index e60a7b2..64965b9 100644 --- a/tests/Attributes/Validators/RegExpValidatorTest.php +++ b/tests/Attributes/Validators/RegExpValidatorTest.php @@ -4,18 +4,13 @@ namespace willitscale\StreetlampTests\Attributes\Validators; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use willitscale\Streetlamp\Attributes\Validators\RegExpValidator; class RegExpValidatorTest extends TestCase { - /** - * @param string $pattern - * @param string $input - * @param bool $expectedResult - * @return void - * @dataProvider validateScenarios - */ + #[DataProvider('validateScenarios')] public function testThatValidateCorrectlyValidatesTheInput( string $pattern, string $input, @@ -26,14 +21,7 @@ public function testThatValidateCorrectlyValidatesTheInput( $this->assertEquals($expectedResult, $response); } - /** - * @param string $pattern - * @param string $replace - * @param string $input - * @param string $expectedResult - * @return void - * @dataProvider sanitizeScenarios - */ + #[DataProvider('sanitizeScenarios')] public function testThatSanitizeCorrectlySanitizesTheInput( string $pattern, string $replace, @@ -45,10 +33,7 @@ public function testThatSanitizeCorrectlySanitizesTheInput( $this->assertEquals($expectedResult, $response); } - /** - * @return array[] - */ - public function validateScenarios(): array + public static function validateScenarios(): array { return [ "it should validate that a date string matches correctly" => [ @@ -64,10 +49,7 @@ public function validateScenarios(): array ]; } - /** - * @return array[] - */ - public function sanitizeScenarios(): array + public static function sanitizeScenarios(): array { return [ "it should sanitize the input by replacing the matched values" => [