From f5e018d431b8e7667ab3a4d23d22887be88f82d6 Mon Sep 17 00:00:00 2001 From: "Chun-Sheng, Li" Date: Tue, 13 Apr 2021 04:56:50 +0800 Subject: [PATCH 01/50] build: Set correct test class namespaces (#139) --- .github/workflows/ci.yml | 4 ++-- test/phpunit/Helper/Helper.php | 2 +- test/phpunit/Helper/Reflection.php | 2 +- test/phpunit/InputData/FileUploadInputDataTest.php | 4 ++-- test/phpunit/InputData/InputDataFactoryTest.php | 4 ++-- test/phpunit/InputData/InputDataTest.php | 4 ++-- test/phpunit/InputTest.php | 2 +- test/phpunit/Trigger/CallbackTest.php | 4 ++-- test/phpunit/Trigger/TriggerTest.php | 4 ++-- test/phpunit/phpunit.xml | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27cc5d8..cb9d96f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: CI -on: [push] +on: [push, pull_request] jobs: composer: @@ -63,4 +63,4 @@ jobs: - name: PHP Static Analysis uses: php-actions/phpstan@v2 with: - path: src/ \ No newline at end of file + path: src/ diff --git a/test/phpunit/Helper/Helper.php b/test/phpunit/Helper/Helper.php index a64d647..138fb72 100644 --- a/test/phpunit/Helper/Helper.php +++ b/test/phpunit/Helper/Helper.php @@ -103,4 +103,4 @@ public static function getTestDirectory() { "test", ]); } -} \ No newline at end of file +} diff --git a/test/phpunit/Helper/Reflection.php b/test/phpunit/Helper/Reflection.php index c04760c..6c98efc 100644 --- a/test/phpunit/Helper/Reflection.php +++ b/test/phpunit/Helper/Reflection.php @@ -11,4 +11,4 @@ public static function getMethod(string $className, string $methodName):Reflecti $method->setAccessible(true); return $method; } -} \ No newline at end of file +} diff --git a/test/phpunit/InputData/FileUploadInputDataTest.php b/test/phpunit/InputData/FileUploadInputDataTest.php index 9af48df..63ea59b 100644 --- a/test/phpunit/InputData/FileUploadInputDataTest.php +++ b/test/phpunit/InputData/FileUploadInputDataTest.php @@ -1,5 +1,5 @@ "AB12 3CD", ]); } -} \ No newline at end of file +} diff --git a/test/phpunit/InputData/InputDataTest.php b/test/phpunit/InputData/InputDataTest.php index 08ac302..4245c29 100644 --- a/test/phpunit/InputData/InputDataTest.php +++ b/test/phpunit/InputData/InputDataTest.php @@ -1,6 +1,6 @@ - \ No newline at end of file + From b14b973715b35cbca3355703d1de9a803df21fae Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Mon, 12 Apr 2021 22:30:27 +0100 Subject: [PATCH 02/50] Update documentation to show use of InputData (#140) * Update badge link * ci: update deps * docs: update readme with InputData and provide example --- README.md | 10 ++-- example/01-posted-form-triggers-function.php | 52 ++++++++++++++++++++ 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 example/01-posted-form-triggers-function.php diff --git a/README.md b/README.md index 7702a89..2c84788 100644 --- a/README.md +++ b/README.md @@ -73,9 +73,13 @@ $input->do("pay") ->with("name", "address") ->call("processShipping"); -function processShipping(string $name, string $address) { - setUsername($name); - storeNameAddress($name, $address); +function processShipping(InputData $data) { + setUsername($data->getString("name")); + + storeNameAddress( + $data->getString("name"), + $data->getString("address") + ); } ``` diff --git a/example/01-posted-form-triggers-function.php b/example/01-posted-form-triggers-function.php new file mode 100644 index 0000000..75db8a4 --- /dev/null +++ b/example/01-posted-form-triggers-function.php @@ -0,0 +1,52 @@ + "Eugene Kaspersky", + "card-number" => "4111011101110111", + "card-expiry" => "23/11", + "card-cvv" => "359", + "address" => "14 Brooke Street", + "do" => "pay", +]; +$_FILES = []; + +$input = new Input($_GET, $_POST, $_FILES); + +$input->do("pay") + ->call("processCard"); + +$input->do("pay") + ->with("name", "address") + ->call("processShipping"); + +function processCard(InputData $data) { + echo "Executing processCard...", PHP_EOL; + foreach($data as $key => $value) { + echo "processCard InputData: $key = $value", PHP_EOL; + } + echo PHP_EOL; +} + +function processShipping(InputData $data) { + echo "Executing processShipping...", PHP_EOL; + echo "Name: ", $data->getString("name"), PHP_EOL; + echo "Address: ", $data->getString("address"), PHP_EOL; + echo "Credit card: ", $data->getString("card-number") ?? "DATA NOT PASSED!", PHP_EOL; +} From a4788d9f3e7b6d4a5b81330a4704ac451c94ad3d Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Mon, 12 Apr 2021 22:54:52 +0100 Subject: [PATCH 03/50] Add sponsor button (#141) * Update badge link * ci: update deps * docs: update readme with InputData and provide example * chore: add sponsor button --- .github/FUNDING.yml | 2 ++ composer.json | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..8ca7d16 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +# These are supported funding model platforms +github: [phpgt] \ No newline at end of file diff --git a/composer.json b/composer.json index 633f36d..b576346 100644 --- a/composer.json +++ b/composer.json @@ -21,5 +21,12 @@ "psr-4": { "Gt\\Input\\Test\\": "./test/phpunit" } - } -} \ No newline at end of file + }, + + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/PhpGt" + } + ] +} From 1393366f80061ffe68860f471e67921c28b15701 Mon Sep 17 00:00:00 2001 From: "Chun-Sheng, Li" Date: Thu, 15 Apr 2021 23:34:19 +0800 Subject: [PATCH 04/50] Using assertSame to improve assertEquals (#142) --- .../InputData/InputDataFactoryTest.php | 18 ++++---- test/phpunit/InputData/InputDataTest.php | 46 +++++++++---------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/test/phpunit/InputData/InputDataFactoryTest.php b/test/phpunit/InputData/InputDataFactoryTest.php index 2924c6f..d074d1a 100644 --- a/test/phpunit/InputData/InputDataFactoryTest.php +++ b/test/phpunit/InputData/InputDataFactoryTest.php @@ -10,34 +10,34 @@ class InputDataFactoryTest extends TestCase { public function testCreateNoCriteria():void { $input = $this->createInput(); $data = InputDataFactory::create($input); - self::assertEquals("Edward", $data["name"]); - self::assertEquals("51", $data["age"]); - self::assertEquals("01234 567890", $data["telephone"]); - self::assertEquals("AB12 3CD", $data["postcode"]); + self::assertSame("Edward", (string)$data["name"]); + self::assertSame("51", (string)$data["age"]); + self::assertSame("01234 567890", (string)$data["telephone"]); + self::assertSame("AB12 3CD", (string)$data["postcode"]); } public function testCreateCriteriaWith():void { $input = $this->createInput(); $data = InputDataFactory::create($input, ["name", "postcode"]); - self::assertEquals("Edward", $data["name"]); + self::assertSame("Edward", (string)$data["name"]); self::assertNull($data["age"]); self::assertNull($data["telephone"]); - self::assertEquals("AB12 3CD", $data["postcode"]); + self::assertSame("AB12 3CD", (string)$data["postcode"]); } public function testCreateCriteriaWithout():void { $input = $this->createInput(); $data = InputDataFactory::create($input, [],["age", "telephone"]); - self::assertEquals("Edward", $data["name"]); + self::assertSame("Edward", (string)$data["name"]); self::assertNull($data["age"]); self::assertNull($data["telephone"]); - self::assertEquals("AB12 3CD", $data["postcode"]); + self::assertSame("AB12 3CD", (string)$data["postcode"]); } public function testCreateCriteriaWithWithoutNoClash():void { $input = $this->createInput(); $data = InputDataFactory::create($input, ["name"], ["postcode"]); - self::assertEquals("Edward", $data["name"]); + self::assertSame("Edward", (string)$data["name"]); self::assertNull($data["age"]); self::assertNull($data["telephone"]); self::assertNull($data["postcode"]); diff --git a/test/phpunit/InputData/InputDataTest.php b/test/phpunit/InputData/InputDataTest.php index 4245c29..9e0d924 100644 --- a/test/phpunit/InputData/InputDataTest.php +++ b/test/phpunit/InputData/InputDataTest.php @@ -11,8 +11,8 @@ public function testSingleSource():void { "name" => "Alice", "gender" => "f", ]); - self::assertEquals("Alice", $data["name"]); - self::assertEquals("f", $data["gender"]); + self::assertSame("Alice", (string)$data["name"]); + self::assertSame("f", (string)$data["gender"]); } public function testMultipleSources():void { @@ -24,24 +24,24 @@ public function testMultipleSources():void { "userAccess" => "admin", ]); - self::assertEquals("Alice", $data["name"]); - self::assertEquals("f", $data["gender"]); - self::assertEquals("save", $data["do"]); - self::assertEquals("admin", $data["userAccess"]); + self::assertSame("Alice", (string)$data["name"]); + self::assertSame("f", (string)$data["gender"]); + self::assertSame("save", (string)$data["do"]); + self::assertSame("admin", (string)$data["userAccess"]); } public function testAddFromEmpty():void { $data = new InputData(); $data->addKeyValue("name", "Bob"); - self::assertEquals("Bob", $data["name"]); + self::assertSame("Bob", (string)$data["name"]); } public function testAddMultipleFromEmpty():void { $data = new InputData(); $data->addKeyValue("name", "Bob"); $data->addKeyValue("gender", "m"); - self::assertEquals("Bob", $data["name"]); - self::assertEquals("m", $data["gender"]); + self::assertSame("Bob", (string)$data["name"]); + self::assertSame("m", (string)$data["gender"]); } public function testAddFromExisting():void { @@ -56,12 +56,12 @@ public function testAddFromExisting():void { $data->addKeyValue("view", "tab1"); $data->addKeyValue("screenSize", "large"); - self::assertEquals("Charles", $data["name"]); - self::assertEquals("m", $data["gender"]); - self::assertEquals("save", $data["do"]); - self::assertEquals("admin", $data["userAccess"]); - self::assertEquals("tab1", $data["view"]); - self::assertEquals("large", $data["screenSize"]); + self::assertSame("Charles", (string)$data["name"]); + self::assertSame("m", (string)$data["gender"]); + self::assertSame("save", (string)$data["do"]); + self::assertSame("admin", (string)$data["userAccess"]); + self::assertSame("tab1", (string)$data["view"]); + self::assertSame("large", (string)$data["screenSize"]); } public function testRemove():void { @@ -70,7 +70,7 @@ public function testRemove():void { "gender" => "f", ]); - self::assertEquals("f", $data["gender"]); + self::assertSame("f", (string)$data["gender"]); $data->remove("gender"); self::assertNull($data["gender"]); } @@ -96,7 +96,7 @@ public function testRemoveExceptSingle():void { $data->removeExcept("userAccess"); self::assertNull($data["name"]); self::assertNull($data["gender"]); - self::assertEquals("sales", $data["userAccess"]); + self::assertSame("sales", (string)$data["userAccess"]); } public function testRemoveExceptMulti():void { @@ -106,8 +106,8 @@ public function testRemoveExceptMulti():void { "userAccess" => "sales", ]); $data->removeExcept("name", "userAccess"); - self::assertEquals("Emma", $data["name"]); - self::assertEquals("sales", $data["userAccess"]); + self::assertSame("Emma", (string)$data["name"]); + self::assertSame("sales", (string)$data["userAccess"]); self::assertNull($data["gender"]); } @@ -128,9 +128,9 @@ public function testSetAsArray():void { "gender" => "f", ]); $data["userAccess"] = "test"; - self::assertEquals("Hannah", $data["name"]); - self::assertEquals("f", $data["gender"]); - self::assertEquals("test", $data["userAccess"]); + self::assertSame("Hannah", (string)$data["name"]); + self::assertSame("f", (string)$data["gender"]); + self::assertSame("test", (string)$data["userAccess"]); } public function testUnsetAsArray():void { @@ -141,7 +141,7 @@ public function testUnsetAsArray():void { self::assertTrue(isset($data["gender"])); unset($data["gender"]); self::assertFalse(isset($data["gender"])); - self::assertEquals("Ian", $data["name"]); + self::assertSame("Ian", (string)$data["name"]); } public function testHas():void { From c09c0fc931aa7d5021fbe1e159685bb24a557f51 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 20 Apr 2021 10:03:43 +0100 Subject: [PATCH 05/50] Bump phpstan/phpstan from 0.12.83 to 0.12.84 (#143) Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.83 to 0.12.84. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Commits](https://github.com/phpstan/phpstan/compare/0.12.83...0.12.84) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index c8a5f89..e43ac90 100644 --- a/composer.lock +++ b/composer.lock @@ -722,16 +722,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.83", + "version": "0.12.84", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "4a967cec6efb46b500dd6d768657336a3ffe699f" + "reference": "9c43f15da8798c8f30a4b099e6a94530a558cfd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/4a967cec6efb46b500dd6d768657336a3ffe699f", - "reference": "4a967cec6efb46b500dd6d768657336a3ffe699f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9c43f15da8798c8f30a4b099e6a94530a558cfd5", + "reference": "9c43f15da8798c8f30a4b099e6a94530a558cfd5", "shasum": "" }, "require": { @@ -762,7 +762,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.83" + "source": "https://github.com/phpstan/phpstan/tree/0.12.84" }, "funding": [ { @@ -778,7 +778,7 @@ "type": "tidelift" } ], - "time": "2021-04-03T15:35:45+00:00" + "time": "2021-04-19T17:10:54+00:00" }, { "name": "phpunit/php-code-coverage", From af37e3a5ceea5a21c2f91b8ef4d0c40c19373caa Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 29 Apr 2021 10:12:35 +0100 Subject: [PATCH 06/50] Upgrade to GitHub-native Dependabot (#145) Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- .github/dependabot.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..2aa4754 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,29 @@ +version: 2 +updates: +- package-ecosystem: composer + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 + ignore: + - dependency-name: phpstan/phpstan + versions: + - 0.12.70 + - 0.12.71 + - 0.12.73 + - 0.12.74 + - 0.12.75 + - 0.12.76 + - 0.12.77 + - 0.12.78 + - 0.12.79 + - 0.12.80 + - 0.12.81 + - 0.12.82 + - 0.12.83 + - dependency-name: phpunit/phpunit + versions: + - 9.5.1 + - 9.5.2 + - 9.5.3 + - 9.5.4 From 5a54f84ec451f2dc3b3a5b9e6e91d5d70fb4e395 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Jun 2021 09:40:16 +0100 Subject: [PATCH 07/50] Bump phpunit/phpunit from 9.5.4 to 9.5.5 (#149) Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.4 to 9.5.5. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.4...9.5.5) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.lock | 52 +++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/composer.lock b/composer.lock index e43ac90..c84e3a8 100644 --- a/composer.lock +++ b/composer.lock @@ -330,16 +330,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.10.4", + "version": "v4.10.5", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" + "reference": "4432ba399e47c66624bc73c8c0f811e5c109576f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4432ba399e47c66624bc73c8c0f811e5c109576f", + "reference": "4432ba399e47c66624bc73c8c0f811e5c109576f", "shasum": "" }, "require": { @@ -380,9 +380,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.5" }, - "time": "2020-12-20T10:01:03+00:00" + "time": "2021-05-03T19:11:20+00:00" }, { "name": "phar-io/manifest", @@ -1100,16 +1100,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.4", + "version": "9.5.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c73c6737305e779771147af66c96ca6a7ed8a741" + "reference": "89ff45ea9d70e35522fb6654a2ebc221158de276" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c73c6737305e779771147af66c96ca6a7ed8a741", - "reference": "c73c6737305e779771147af66c96ca6a7ed8a741", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/89ff45ea9d70e35522fb6654a2ebc221158de276", + "reference": "89ff45ea9d70e35522fb6654a2ebc221158de276", "shasum": "" }, "require": { @@ -1139,7 +1139,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3", + "sebastian/type": "^2.3.2", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -1187,7 +1187,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.4" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.5" }, "funding": [ { @@ -1199,7 +1199,7 @@ "type": "github" } ], - "time": "2021-03-23T07:16:29+00:00" + "time": "2021-06-05T04:49:07+00:00" }, { "name": "sebastian/cli-parser", @@ -2058,16 +2058,16 @@ }, { "name": "sebastian/type", - "version": "2.3.1", + "version": "2.3.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2" + "reference": "0d1c587401514d17e8f9258a27e23527cb1b06c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0d1c587401514d17e8f9258a27e23527cb1b06c1", + "reference": "0d1c587401514d17e8f9258a27e23527cb1b06c1", "shasum": "" }, "require": { @@ -2102,7 +2102,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.1" + "source": "https://github.com/sebastianbergmann/type/tree/2.3.2" }, "funding": [ { @@ -2110,7 +2110,7 @@ "type": "github" } ], - "time": "2020-10-26T13:18:59+00:00" + "time": "2021-06-04T13:02:07+00:00" }, { "name": "sebastian/version", @@ -2167,16 +2167,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.22.1", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", "shasum": "" }, "require": { @@ -2188,7 +2188,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2226,7 +2226,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" }, "funding": [ { @@ -2242,7 +2242,7 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-02-19T12:13:01+00:00" }, { "name": "theseer/tokenizer", From 020b3b7b81eec4a3913ad272c63e58655b5e9bc9 Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Sat, 26 Feb 2022 15:40:35 +0000 Subject: [PATCH 08/50] fix: deprecation notices (#189) --- composer.json | 6 +- composer.lock | 242 +++++++++++---------- src/InputData/Datum/MultipleInputDatum.php | 16 +- src/InputData/KeyValueArrayAccess.php | 7 +- src/InputData/KeyValueIterator.php | 6 +- 5 files changed, 142 insertions(+), 135 deletions(-) diff --git a/composer.json b/composer.json index b576346..78df854 100644 --- a/composer.json +++ b/composer.json @@ -4,12 +4,12 @@ "license": "MIT", "require": { - "phpgt/http": "1.*" + "phpgt/http": "^v1.1" }, "require-dev": { - "phpunit/phpunit": "9.*", - "phpstan/phpstan": ">=0.12.64" + "phpunit/phpunit": "^v9.5", + "phpstan/phpstan": "^v1.4" }, "autoload": { diff --git a/composer.lock b/composer.lock index c84e3a8..ec26b54 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": "63d79b4aa22bd6a8d243e9c69d60bd27", + "content-hash": "d699d19511679c984383019a9d3ca3a4", "packages": [ { "name": "phpgt/cookie", @@ -287,9 +287,6 @@ "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" - }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", @@ -297,12 +294,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -330,16 +327,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.10.5", + "version": "v4.13.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "4432ba399e47c66624bc73c8c0f811e5c109576f" + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4432ba399e47c66624bc73c8c0f811e5c109576f", - "reference": "4432ba399e47c66624bc73c8c0f811e5c109576f", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", "shasum": "" }, "require": { @@ -380,22 +377,22 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.5" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" }, - "time": "2021-05-03T19:11:20+00:00" + "time": "2021-11-30T19:35:32+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.1", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { @@ -440,22 +437,22 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/master" + "source": "https://github.com/phar-io/manifest/tree/2.0.3" }, - "time": "2020-06-27T14:33:11+00:00" + "time": "2021-07-20T11:28:43+00:00" }, { "name": "phar-io/version", - "version": "3.1.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { @@ -491,9 +488,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.0" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2021-02-23T14:00:09+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -550,16 +547,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { @@ -570,7 +567,8 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -600,22 +598,22 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2020-09-03T19:13:55+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", "shasum": "" }, "require": { @@ -623,7 +621,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -649,39 +648,39 @@ "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.4.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" }, - "time": "2020-09-17T18:55:26+00:00" + "time": "2022-01-04T19:58:01+00:00" }, { "name": "phpspec/prophecy", - "version": "1.13.0", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", + "php": "^7.2 || ~8.0, <8.2", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^6.0 || ^7.0", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -716,22 +715,22 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.13.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" }, - "time": "2021-03-17T13:42:18+00:00" + "time": "2021-12-08T12:19:24+00:00" }, { "name": "phpstan/phpstan", - "version": "0.12.84", + "version": "1.4.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9c43f15da8798c8f30a4b099e6a94530a558cfd5" + "reference": "8a7761f1c520e0dad6e04d862fdc697445457cfe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9c43f15da8798c8f30a4b099e6a94530a558cfd5", - "reference": "9c43f15da8798c8f30a4b099e6a94530a558cfd5", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8a7761f1c520e0dad6e04d862fdc697445457cfe", + "reference": "8a7761f1c520e0dad6e04d862fdc697445457cfe", "shasum": "" }, "require": { @@ -747,7 +746,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "0.12-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -762,13 +761,17 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.84" + "source": "https://github.com/phpstan/phpstan/tree/1.4.6" }, "funding": [ { "url": "https://github.com/ondrejmirtes", "type": "github" }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, { "url": "https://www.patreon.com/phpstan", "type": "patreon" @@ -778,27 +781,27 @@ "type": "tidelift" } ], - "time": "2021-04-19T17:10:54+00:00" + "time": "2022-02-06T12:56:13+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.6", + "version": "9.2.13", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f6293e1b30a2354e8428e004689671b83871edde" + "reference": "deac8540cb7bd40b2b8cfa679b76202834fd04e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f6293e1b30a2354e8428e004689671b83871edde", - "reference": "f6293e1b30a2354e8428e004689671b83871edde", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/deac8540cb7bd40b2b8cfa679b76202834fd04e8", + "reference": "deac8540cb7bd40b2b8cfa679b76202834fd04e8", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.10.2", + "nikic/php-parser": "^4.13.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -847,7 +850,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.6" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.13" }, "funding": [ { @@ -855,20 +858,20 @@ "type": "github" } ], - "time": "2021-03-28T07:26:59+00:00" + "time": "2022-02-23T17:02:38+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { @@ -907,7 +910,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, "funding": [ { @@ -915,7 +918,7 @@ "type": "github" } ], - "time": "2020-09-28T05:57:25+00:00" + "time": "2021-12-02T12:48:52+00:00" }, { "name": "phpunit/php-invoker", @@ -1100,16 +1103,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.5", + "version": "9.5.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "89ff45ea9d70e35522fb6654a2ebc221158de276" + "reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/89ff45ea9d70e35522fb6654a2ebc221158de276", - "reference": "89ff45ea9d70e35522fb6654a2ebc221158de276", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5ff8c545a50226c569310a35f4fa89d79f1ddfdc", + "reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc", "shasum": "" }, "require": { @@ -1121,11 +1124,11 @@ "ext-xml": "*", "ext-xmlwriter": "*", "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.1", + "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -1139,7 +1142,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.2", + "sebastian/type": "^2.3.4", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -1160,11 +1163,11 @@ } }, "autoload": { - "classmap": [ - "src/" - ], "files": [ "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1187,11 +1190,11 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.5" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.16" }, "funding": [ { - "url": "https://phpunit.de/donate.html", + "url": "https://phpunit.de/sponsors.html", "type": "custom" }, { @@ -1199,7 +1202,7 @@ "type": "github" } ], - "time": "2021-06-05T04:49:07+00:00" + "time": "2022-02-23T17:10:58+00:00" }, { "name": "sebastian/cli-parser", @@ -1630,16 +1633,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", "shasum": "" }, "require": { @@ -1688,14 +1691,14 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" }, "funding": [ { @@ -1703,20 +1706,20 @@ "type": "github" } ], - "time": "2020-09-28T05:24:23+00:00" + "time": "2021-11-11T14:18:36+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.2", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { @@ -1759,7 +1762,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" }, "funding": [ { @@ -1767,7 +1770,7 @@ "type": "github" } ], - "time": "2020-10-26T15:55:19+00:00" + "time": "2022-02-14T08:28:10+00:00" }, { "name": "sebastian/lines-of-code", @@ -2058,16 +2061,16 @@ }, { "name": "sebastian/type", - "version": "2.3.2", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "0d1c587401514d17e8f9258a27e23527cb1b06c1" + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0d1c587401514d17e8f9258a27e23527cb1b06c1", - "reference": "0d1c587401514d17e8f9258a27e23527cb1b06c1", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", "shasum": "" }, "require": { @@ -2102,7 +2105,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.2" + "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" }, "funding": [ { @@ -2110,7 +2113,7 @@ "type": "github" } ], - "time": "2021-06-04T13:02:07+00:00" + "time": "2021-06-15T12:49:02+00:00" }, { "name": "sebastian/version", @@ -2167,21 +2170,24 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, @@ -2196,12 +2202,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2226,7 +2232,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" }, "funding": [ { @@ -2242,20 +2248,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "75a63c33a8577608444246075ea0af0d052e452a" + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", - "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { @@ -2284,7 +2290,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/master" + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" }, "funding": [ { @@ -2292,7 +2298,7 @@ "type": "github" } ], - "time": "2020-07-12T23:59:07+00:00" + "time": "2021-07-28T10:34:58+00:00" }, { "name": "webmozart/assert", @@ -2360,5 +2366,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.2.0" } diff --git a/src/InputData/Datum/MultipleInputDatum.php b/src/InputData/Datum/MultipleInputDatum.php index c676509..0205605 100644 --- a/src/InputData/Datum/MultipleInputDatum.php +++ b/src/InputData/Datum/MultipleInputDatum.php @@ -31,7 +31,7 @@ public function toArray():array { /** * @link http://php.net/manual/en/iterator.current.php */ - public function current() { + public function current():mixed { return $this->offsetGet($this->iteratorKey); } @@ -63,22 +63,24 @@ public function rewind():void { $this->iteratorKey = 0; } - /** - * @link http://php.net/manual/en/arrayaccess.offsetexists.php + /** @link http://php.net/manual/en/arrayaccess.offsetexists.php + * @param string $offset */ public function offsetExists($offset):bool { return isset($this->value[$offset]); } - /** - * @link http://php.net/manual/en/arrayaccess.offsetget.php + /** @link http://php.net/manual/en/arrayaccess.offsetget.php + * @param string $offset */ - public function offsetGet($offset) { + public function offsetGet($offset):mixed { return $this->value[$offset]; } /** * @link http://php.net/manual/en/arrayaccess.offsetset.php + * @param string $offset + * @param string $value */ public function offsetSet($offset, $value):void { throw new ImmutableObjectModificationException(); @@ -90,4 +92,4 @@ public function offsetSet($offset, $value):void { public function offsetUnset($offset):void { throw new ImmutableObjectModificationException(); } -} \ No newline at end of file +} diff --git a/src/InputData/KeyValueArrayAccess.php b/src/InputData/KeyValueArrayAccess.php index df353cc..78c7e8c 100644 --- a/src/InputData/KeyValueArrayAccess.php +++ b/src/InputData/KeyValueArrayAccess.php @@ -9,8 +9,7 @@ public function offsetExists($offset):bool { return isset($this->parameters[$offset]); } - /** @return mixed|null */ - public function offsetGet($offset) { + public function offsetGet($offset):mixed { if($this instanceof FileUploadInputData) { return $this->getFile($offset); } @@ -42,7 +41,7 @@ public function offsetSet($offset, $value):void { } } - public function offsetUnset($offset) { + public function offsetUnset($offset):void { if($this->parameters instanceof InputData) { $this->parameters->remove($offset); } @@ -50,4 +49,4 @@ public function offsetUnset($offset) { unset($this->parameters[$offset]); } } -} \ No newline at end of file +} diff --git a/src/InputData/KeyValueIterator.php b/src/InputData/KeyValueIterator.php index a9ac334..ac052c7 100644 --- a/src/InputData/KeyValueIterator.php +++ b/src/InputData/KeyValueIterator.php @@ -19,11 +19,11 @@ public function key():string { return $this->getIteratorDataKey(); } - public function valid() { + public function valid():bool { return !empty($this->getIteratorDataKey()); } - public function rewind() { + public function rewind():void { $this->iteratorKey = 0; } @@ -39,4 +39,4 @@ protected function getIteratorDataKey():?string { return $keys[$this->iteratorKey] ?? null; } -} \ No newline at end of file +} From d2d27019e7fcf6438e1f54bdfb8322de7edb2ffd Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Sat, 26 Feb 2022 15:42:23 +0000 Subject: [PATCH 09/50] Type improvements (#190) * fix: deprecation notices * stan: type improvements --- src/Input.php | 27 +++++++++------ src/InputData/AbstractInputData.php | 10 ++++-- src/InputData/Datum/FailedFileUpload.php | 4 +-- src/InputData/Datum/FileUpload.php | 4 +-- src/InputData/Datum/InputDatum.php | 6 ++-- src/InputData/Datum/MultipleInputDatum.php | 16 ++++++--- src/InputData/FileUploadInputData.php | 28 ++++++++++++---- src/InputData/InputData.php | 5 ++- src/InputData/InputDataFactory.php | 6 +++- src/InputData/KeyValueArrayAccess.php | 6 +++- src/InputValueGetter.php | 15 +++------ src/Trigger/Callback.php | 7 ++-- src/Trigger/Trigger.php | 39 +++++++++++++--------- 13 files changed, 110 insertions(+), 63 deletions(-) diff --git a/src/Input.php b/src/Input.php index 266fa7f..6fe3b04 100644 --- a/src/Input.php +++ b/src/Input.php @@ -16,6 +16,10 @@ use Gt\Input\InputData\FileUploadInputData; use Gt\Input\InputData\QueryStringInputData; +/** + * @implements ArrayAccess + * @implements Iterator + */ class Input implements ArrayAccess, Countable, Iterator { use InputValueGetter; use KeyValueArrayAccess; @@ -27,14 +31,16 @@ class Input implements ArrayAccess, Countable, Iterator { const DATA_FILES = "files"; const DATA_COMBINED = "combined"; - /** @var BodyStream */ - protected $bodyStream; - - /** @var QueryStringInputData */ - protected $queryStringParameters; - /** @var BodyInputData */ - protected $bodyParameters; + protected BodyStream $bodyStream; + protected QueryStringInputData $queryStringParameters; + protected BodyInputData $bodyParameters; + /** + * @param array $get + * @param array $post + * @param array> $files + * @param string $bodyPath + */ public function __construct( array $get = [], array $post = [], @@ -89,7 +95,6 @@ public function add(string $key, InputDatum $datum, string $method):void { default: throw new InvalidInputMethodException($method); - break; } $this->parameters = new CombinedInputData( @@ -217,8 +222,10 @@ public function do(string $match):Trigger { * * $matches is an associative array, where the key is a request variable's name and the * value is the request variable's value to match. + * + * @param array|string $matches */ - public function when(...$matches):Trigger { + public function when(array|string...$matches):Trigger { $trigger = new Trigger($this); $trigger->when($matches); return $trigger; @@ -251,7 +258,7 @@ public function withAll():Trigger { return $this->newTrigger("withAll"); } - protected function newTrigger(string $functionName, ...$args):Trigger { + protected function newTrigger(string $functionName, string...$args):Trigger { $trigger = new Trigger($this); return $trigger->$functionName(...$args); } diff --git a/src/InputData/AbstractInputData.php b/src/InputData/AbstractInputData.php index 6e31ecf..fd6e610 100644 --- a/src/InputData/AbstractInputData.php +++ b/src/InputData/AbstractInputData.php @@ -7,6 +7,10 @@ use Iterator; use Gt\Input\InputData\Datum\InputDatum; +/** + * @implements ArrayAccess + * @implements Iterator + */ abstract class AbstractInputData implements ArrayAccess, Countable, Iterator { use InputValueGetter; use KeyValueArrayAccess; @@ -33,12 +37,12 @@ public function hasValue(string $key):bool { } protected function set(string $key, InputDatum $value):void { - $this->parameters[$key] = $value; + $this->parameters[$key] = (string)$value; } - public function withKeyValue(string $key, InputDatum $value):self { + public function withKeyValue(string $key, InputDatum $value):static { $clone = clone($this); - $clone->parameters[$key] = $value; + $clone->parameters[$key] = (string)$value; return $clone; } } diff --git a/src/InputData/Datum/FailedFileUpload.php b/src/InputData/Datum/FailedFileUpload.php index a3dfe1d..213b025 100644 --- a/src/InputData/Datum/FailedFileUpload.php +++ b/src/InputData/Datum/FailedFileUpload.php @@ -2,7 +2,7 @@ namespace Gt\Input\InputData\Datum; class FailedFileUpload extends FileUpload { - protected $errorCode; + protected int $errorCode; public function __construct( string $originalFilename, @@ -68,4 +68,4 @@ public function getErrorMessage():string { return $msg; } -} \ No newline at end of file +} diff --git a/src/InputData/Datum/FileUpload.php b/src/InputData/Datum/FileUpload.php index 4816643..25aeacd 100644 --- a/src/InputData/Datum/FileUpload.php +++ b/src/InputData/Datum/FileUpload.php @@ -111,7 +111,7 @@ public function getStream():StreamInterface { * @throws \RuntimeException on any error during the move operation, or on * the second or subsequent call to the method. */ - public function moveTo($targetPath) { + public function moveTo($targetPath):void { if(!is_uploaded_file($this->tempFilePath)) { throw new UploadedFileSecurityException($this->tempFilePath); } @@ -195,4 +195,4 @@ public function getClientFilename() { public function getClientMediaType() { return $this->getMimeType(); } -} \ No newline at end of file +} diff --git a/src/InputData/Datum/InputDatum.php b/src/InputData/Datum/InputDatum.php index b0d44e0..18d7d38 100644 --- a/src/InputData/Datum/InputDatum.php +++ b/src/InputData/Datum/InputDatum.php @@ -2,13 +2,13 @@ namespace Gt\Input\InputData\Datum; class InputDatum { - protected $value; + protected mixed $value; - public function __construct($value) { + public function __construct(mixed $value) { $this->value = $value; } public function __toString():string { return $this->value; } -} \ No newline at end of file +} diff --git a/src/InputData/Datum/MultipleInputDatum.php b/src/InputData/Datum/MultipleInputDatum.php index 0205605..c9cb638 100644 --- a/src/InputData/Datum/MultipleInputDatum.php +++ b/src/InputData/Datum/MultipleInputDatum.php @@ -5,10 +5,14 @@ use Gt\Input\ImmutableObjectModificationException; use Iterator; +/** + * @implements ArrayAccess + * @implements Iterator + */ class MultipleInputDatum extends InputDatum implements ArrayAccess, Iterator { - protected $iteratorKey; + protected int $iteratorKey; - public function __construct($value) { + public function __construct(mixed $value) { parent::__construct($value); $this->iteratorKey = 0; @@ -18,6 +22,7 @@ public function __toString():string { return implode(", ", $this->value); } + /** @return array */ public function toArray():array { $array = []; @@ -64,14 +69,14 @@ public function rewind():void { } /** @link http://php.net/manual/en/arrayaccess.offsetexists.php - * @param string $offset + * @param string|int $offset */ public function offsetExists($offset):bool { return isset($this->value[$offset]); } /** @link http://php.net/manual/en/arrayaccess.offsetget.php - * @param string $offset + * @param string|int $offset */ public function offsetGet($offset):mixed { return $this->value[$offset]; @@ -79,7 +84,7 @@ public function offsetGet($offset):mixed { /** * @link http://php.net/manual/en/arrayaccess.offsetset.php - * @param string $offset + * @param string|int $offset * @param string $value */ public function offsetSet($offset, $value):void { @@ -88,6 +93,7 @@ public function offsetSet($offset, $value):void { /** * @link http://php.net/manual/en/arrayaccess.offsetunset.php + * @param string|int $offset */ public function offsetUnset($offset):void { throw new ImmutableObjectModificationException(); diff --git a/src/InputData/FileUploadInputData.php b/src/InputData/FileUploadInputData.php index 87736d9..84f39ac 100644 --- a/src/InputData/FileUploadInputData.php +++ b/src/InputData/FileUploadInputData.php @@ -5,7 +5,9 @@ use Gt\Input\InputData\Datum\FileUpload; class FileUploadInputData extends InputData { - + /** + * @param array> $files + */ public function __construct(array $files) { $files = $this->normalizeArray($files); $data = $this->createData($files); @@ -22,8 +24,11 @@ public function __construct(array $files) { * + size * Each key's value is string, unless the request parameter name ends with [], in which case * each value is another array. This function normalises the array to the latter. + * + * @param array> $files + * @return array>> */ - protected function normalizeArray($files):array { + protected function normalizeArray(array $files):array { foreach($files as $parameterName => $fileDetailArray) { foreach($fileDetailArray as $key => $value) { if(!is_array($value)) { @@ -35,6 +40,10 @@ protected function normalizeArray($files):array { return $files; } + /** + * @param array>> $files + * @return array> + */ protected function createData(array $files):array { $datumList = []; @@ -49,15 +58,22 @@ protected function createData(array $files):array { $details["tmp_name"][$i], ]; - if($details["error"][$i] === UPLOAD_ERR_OK) { - $datumList[$inputName] []= new FileUpload(...$params); + if($details["error"][$i] == UPLOAD_ERR_OK) { + array_push( + $datumList[$inputName], + new FileUpload(...$params) + ); } else { $params []= (int)$details["error"][$i]; - $datumList[$inputName] []= new FailedFileUpload(...$params); + array_push( + $datumList[$inputName], + new FailedFileUpload(...$params) + ); } } } + return $datumList; } -} \ No newline at end of file +} diff --git a/src/InputData/InputData.php b/src/InputData/InputData.php index 7ad7135..b33017d 100644 --- a/src/InputData/InputData.php +++ b/src/InputData/InputData.php @@ -6,6 +6,7 @@ use Gt\Input\InputValueGetter; class InputData extends AbstractInputData { + /** @param iterable|iterable>|iterable...$sources */ public function __construct(iterable...$sources) { $this->parameters = []; @@ -15,7 +16,7 @@ public function __construct(iterable...$sources) { && isset($value[0])) { $value = new MultipleInputDatum($value); } - else if(!$value instanceof InputDatum) { + else { $value = new InputDatum($value); } $this->add($key, $value); @@ -53,10 +54,12 @@ public function removeExcept(string...$keys):self { return $this; } + /** @return array */ public function getKeys():array { return array_keys($this->parameters); } + /** @return array> */ public function asArray():array { $array = []; diff --git a/src/InputData/InputDataFactory.php b/src/InputData/InputDataFactory.php index 6d8720f..c337d02 100644 --- a/src/InputData/InputDataFactory.php +++ b/src/InputData/InputDataFactory.php @@ -5,6 +5,10 @@ use Gt\Input\WithWithoutClashingException; class InputDataFactory { + /** + * @param array|array $with + * @param array|array $without + */ public static function create(Input $input, array $with = [], array $without = []):InputData { $data = $input->getAll(); @@ -34,4 +38,4 @@ public static function create(Input $input, array $with = [], array $without = [ return $data; } -} \ No newline at end of file +} diff --git a/src/InputData/KeyValueArrayAccess.php b/src/InputData/KeyValueArrayAccess.php index 78c7e8c..7102f83 100644 --- a/src/InputData/KeyValueArrayAccess.php +++ b/src/InputData/KeyValueArrayAccess.php @@ -13,7 +13,7 @@ public function offsetGet($offset):mixed { if($this instanceof FileUploadInputData) { return $this->getFile($offset); } - elseif($this instanceof Input || $this instanceof InputData) { + elseif(is_a($this, Input::class) || is_a($this, InputData::class)) { if($this->contains($offset)) { return $this->get($offset); } @@ -22,6 +22,10 @@ public function offsetGet($offset):mixed { return null; } + /** + * @param string $offset + * @param string|InputDatum $value + */ public function offsetSet($offset, $value):void { if($this->parameters instanceof InputData) { if(is_string($value)) { diff --git a/src/InputValueGetter.php b/src/InputValueGetter.php index a6fe3f2..c399505 100644 --- a/src/InputValueGetter.php +++ b/src/InputValueGetter.php @@ -13,10 +13,9 @@ use TypeError; trait InputValueGetter { - /** @var FileUploadInputData */ - protected $fileUploadParameters; - /** @var CombinedInputData */ - protected $parameters; + protected FileUploadInputData $fileUploadParameters; + /** @var array|CombinedInputData */ + protected array|CombinedInputData $parameters; public function getString(string $key):?string { return $this->get($key); @@ -69,9 +68,7 @@ public function getFile(string $key):FileUpload { } } - /** - * @return FileUpload[] - */ + /** @return MultipleInputDatum */ public function getMultipleFile(string $key):MultipleInputDatum { return $this->get($key); } @@ -104,9 +101,7 @@ public function getDateTime( return $dateTime; } - /** - * @return DateTime[] - */ + /** @return MultipleInputDatum */ public function getMultipleDateTime(string $key):MultipleInputDatum { return $this->get($key); } diff --git a/src/Trigger/Callback.php b/src/Trigger/Callback.php index 5ff3e7b..1d95134 100644 --- a/src/Trigger/Callback.php +++ b/src/Trigger/Callback.php @@ -6,9 +6,10 @@ class Callback { /** @var callable */ private $callback; - private $args; + /** @var array */ + private array $args; - public function __construct(callable $callback, ...$args) { + public function __construct(callable $callback, string...$args) { $this->callback = $callback; $this->args = $args; } @@ -23,4 +24,4 @@ public function call(InputData $data):void { call_user_func_array($this->callback, $parameters); } -} \ No newline at end of file +} diff --git a/src/Trigger/Trigger.php b/src/Trigger/Trigger.php index 466e8bd..3112270 100644 --- a/src/Trigger/Trigger.php +++ b/src/Trigger/Trigger.php @@ -6,17 +6,19 @@ use Gt\Input\InputData\InputDataFactory; class Trigger { - /** @var Input */ - protected $input; - - protected $matches; - protected $keyMatches; - protected $with; - protected $without; - /** @var Callback[] */ - protected $callbacks; - /** @var ?bool */ - protected $hasFired; + protected Input $input; + + /** @var array> */ + protected array $matches; + /** @var array */ + protected array $keyMatches; + /** @var array */ + protected array $with; + /** @var array */ + protected array $without; + /** @var array */ + protected array $callbacks; + protected ?bool $hasFired; public function __construct(Input $input) { $this->input = $input; @@ -29,7 +31,8 @@ public function __construct(Input $input) { $this->hasFired = null; } - public function when(...$matches):self { + /** @param string|array...$matches */ + public function when(string|array...$matches):self { $matches = $this->flattenArray($matches); foreach($matches as $key => $match) { @@ -85,13 +88,13 @@ protected function setKeyTrigger(string $key):self { return $this; } - public function call(callable $callback, ...$args):self { + public function call(callable $callback, string...$args):self { $this->callbacks []= new Callback($callback, ...$args); $this->hasFired = $this->fire(); return $this; } - public function or(callable $callback, ...$args):self { + public function or(callable $callback, string...$args):self { if(is_null($this->hasFired)) { throw new CallOrOutOfSequenceException(); } @@ -134,7 +137,7 @@ public function fire():bool { return $fired; } - protected function callCallbacks() { + protected function callCallbacks():void { $fields = InputDataFactory::create( $this->input, $this->with, @@ -147,6 +150,10 @@ protected function callCallbacks() { } } + /** + * @param array>> $array + * @return array + */ protected function flattenArray(array $array):array { $result = []; @@ -179,4 +186,4 @@ protected function flattenArray(array $array):array { return $result; } -} \ No newline at end of file +} From 680430c212a2414079e23d13046ccf326485ff4a Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Fri, 18 Mar 2022 14:53:25 +0000 Subject: [PATCH 10/50] Update README.md (#199) * Update README.md * Update README.md --- README.md | 96 ++++++++++++++++++------------------------------------- 1 file changed, 31 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index 2c84788..4faa106 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -Encapsulated and secured user input. +Encapsulated and type-safe user input. ==================================== -By default, PHP stores all user input in global variables, available for reading and _modification_ in any code, including third party libraries. +By default, PHP stores all user input in global arrays (`$_GET`, `$_POST`, and `$_FILES`) available for reading and _modification_ in any code, including third party libraries. This library wraps user input in objects that promote encapsulation, allowing functions to be passed only the user input they require, rather than having unmitigated read/write access to everything. -User input is automatically secured using openssl ([coming in v2][v2]), preventing unauthorised access to user input from areas of code that shouldn't have it. +Type-safe functions allow more predictable functionality, such as `$input->getFileUpload("photo")` and `$input->getDateTime("date-of-birth")`. *** @@ -31,85 +31,51 @@ Example usage ```html
-

Buy this amazing product

+

User Profile

- - - - - +
``` ```php do("pay") - ->call([$payment, "processCard"]); - -// Storing user's shipping data doesn't need to know credit card information: -$input->do("pay") - ->with("name", "address") - ->call("processShipping"); - -function processShipping(InputData $data) { - setUsername($data->getString("name")); - - storeNameAddress( - $data->getString("name"), - $data->getString("address") - ); +$profile->update( + $profileId, +// Use type-safe getters to help write maintainable code. + $input->getString("name"), + $input->getInt("age"), +); + +// Handle file uploads with a FileUpload object. +$photoUpload = $input->getFile("photo"); +if($photoUpload instanceof FailedFileUpload) { + // Handle a failed upload here. } -``` -Why? ----- - -This library's primary objective is to provide automatic application security, so only the code that has authorisation to read sensitive user input can do so. - -The encapsulation of user input promotes the benefits of object oriented programming. Rather than having all user input available in global scope, the developer must decide which code receives the user input. - -The purpose is to enhance security, and prevent bad coding patterns such as changing the flow of logic depending on whether a particular query string parameter is set. - -How? ----- - -Once an instance of Input is created, all global variables can be unset completely, preventing ad-hoc usage and possible alteration from unknown sources. This is done using `Gt\Input\Globals::unset()`. - -Note that the automatic security feature is being released as [version 2][v2] and is not currently available in the library, but will be released when ready with no backwards breaking changes. - -The page can be secured by injecting the public key into the page. If your application uses a [DOM document][dom], the forms can be injected for you with `Gt\Input\Security\Injector`, otherwise generate your own using `Gt\Input\Security\Key` to create [secure data fields][secure-data-fields]. - -A small amount of JavaScript is used to secure user input before being sent by the browser. The JavaScript is within the `src/JavaScript` directory. - -If JavaScript fails to execute or is forgotten, PHP execution will halt to prevent unsecured input being available. +$photoUpload->moveTo("data/upload/$profileId.jpg"); +``` -What about `php://input`? -------------------------- +Features at a glance +-------------------- -The PHP input stream can be accessed to read raw post data, and this isn't changed by this library. However, when using [secure data fields][secure-data-fields] the user input is encrypted with your application's secret key before it is sent from the user's web browser. The fields are still available to code that reads the input stream, but will be encrypted. ++ Type-safe getters, implementing the [TypeSafeGetter][tsg] interface. ++ Typed `multiple` getters, for working with checkboxes, multi-select elements or multiple file uploads. ++ "do" callback functions - hook up callbacks to button presses (implemented automatically in WebEngine applications). ++ "when" triggers - execute callbacks when certain user input is present. ++ `FileUploadInputData` class for easy file uploads, including functions such as `moveTo()`, `getOriginalName()`, etc. -[v2]: https://github.com/PhpGt/Input/issues?q=is%3Aopen+is%3Aissue+milestone%3Av2 -[dom]: https://php.gt/dom -[secure-data-fields]: https://php.gt/input/security +[tsg]: https://php.gt/typesafegetter From 58134fe91fdc170ae92779f5e75cf2877ae80d88 Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Fri, 18 Mar 2022 14:59:47 +0000 Subject: [PATCH 11/50] Update README.md (#200) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4faa106..cc60639 100644 --- a/README.md +++ b/README.md @@ -77,5 +77,6 @@ Features at a glance + "do" callback functions - hook up callbacks to button presses (implemented automatically in WebEngine applications). + "when" triggers - execute callbacks when certain user input is present. + `FileUploadInputData` class for easy file uploads, including functions such as `moveTo()`, `getOriginalName()`, etc. ++ Coming soon: working with huge files by streaming them to PHP, efficiently managing memory in the process. [tsg]: https://php.gt/typesafegetter From ccdc22b1e2167b7de2a6cf07a1597af89c1aacff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 18 Mar 2022 15:07:30 +0000 Subject: [PATCH 12/50] Bump phpunit/phpunit from 9.5.16 to 9.5.19 (#198) Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.16 to 9.5.19. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.16...9.5.19) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Greg Bowler --- composer.lock | 91 +++++++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 43 deletions(-) diff --git a/composer.lock b/composer.lock index ec26b54..8ba677c 100644 --- a/composer.lock +++ b/composer.lock @@ -203,29 +203,30 @@ "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", "autoload": { @@ -252,7 +253,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" }, "funding": [ { @@ -268,29 +269,33 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-03-03T08:28:38+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { @@ -315,7 +320,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" }, "funding": [ { @@ -323,7 +328,7 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2022-03-03T13:19:32+00:00" }, { "name": "nikic/php-parser", @@ -785,16 +790,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.13", + "version": "9.2.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "deac8540cb7bd40b2b8cfa679b76202834fd04e8" + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/deac8540cb7bd40b2b8cfa679b76202834fd04e8", - "reference": "deac8540cb7bd40b2b8cfa679b76202834fd04e8", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", "shasum": "" }, "require": { @@ -850,7 +855,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.13" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" }, "funding": [ { @@ -858,7 +863,7 @@ "type": "github" } ], - "time": "2022-02-23T17:02:38+00:00" + "time": "2022-03-07T09:28:20+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1103,16 +1108,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.16", + "version": "9.5.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc" + "reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5ff8c545a50226c569310a35f4fa89d79f1ddfdc", - "reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/35ea4b7f3acabb26f4bb640f8c30866c401da807", + "reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807", "shasum": "" }, "require": { @@ -1142,7 +1147,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.4", + "sebastian/type": "^3.0", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -1190,7 +1195,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.16" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.19" }, "funding": [ { @@ -1202,7 +1207,7 @@ "type": "github" } ], - "time": "2022-02-23T17:10:58+00:00" + "time": "2022-03-15T09:57:31+00:00" }, { "name": "sebastian/cli-parser", @@ -2061,28 +2066,28 @@ }, { "name": "sebastian/type", - "version": "2.3.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", "shasum": "" }, "require": { "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2105,7 +2110,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" }, "funding": [ { @@ -2113,7 +2118,7 @@ "type": "github" } ], - "time": "2021-06-15T12:49:02+00:00" + "time": "2022-03-15T09:54:48+00:00" }, { "name": "sebastian/version", @@ -2170,7 +2175,7 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -2232,7 +2237,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" }, "funding": [ { From 2970a231c12b59b23a3b44260262afee68a5d282 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 18 Mar 2022 15:11:12 +0000 Subject: [PATCH 13/50] Bump phpstan/phpstan from 1.4.6 to 1.4.10 (#197) Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.4.6 to 1.4.10. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.5.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.4.6...1.4.10) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.lock | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index 8ba677c..6525628 100644 --- a/composer.lock +++ b/composer.lock @@ -726,16 +726,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.4.6", + "version": "1.4.10", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "8a7761f1c520e0dad6e04d862fdc697445457cfe" + "reference": "898c479c39caa727bedf4311dd294a8f4e250e72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8a7761f1c520e0dad6e04d862fdc697445457cfe", - "reference": "8a7761f1c520e0dad6e04d862fdc697445457cfe", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/898c479c39caa727bedf4311dd294a8f4e250e72", + "reference": "898c479c39caa727bedf4311dd294a8f4e250e72", "shasum": "" }, "require": { @@ -749,11 +749,6 @@ "phpstan.phar" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, "autoload": { "files": [ "bootstrap.php" @@ -766,7 +761,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.4.6" + "source": "https://github.com/phpstan/phpstan/tree/1.4.10" }, "funding": [ { @@ -786,7 +781,7 @@ "type": "tidelift" } ], - "time": "2022-02-06T12:56:13+00:00" + "time": "2022-03-14T10:25:45+00:00" }, { "name": "phpunit/php-code-coverage", From 95136bcbe1c50c3d8db90eb3b1944d049ec2b2a0 Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Fri, 18 Mar 2022 19:03:02 +0000 Subject: [PATCH 14/50] Input::getMultipleFile() (#201) * Isolate bug #195 * feature: implement type-safe multiple file uploads for #195, for #185 --- composer.json | 1 + composer.lock | 6 +- example/02-multiple-inputs.php | 107 +++++++++++++++++++++++++++ example/www/multiple-file-upload.php | 47 ++++++++++++ src/Input.php | 7 +- src/InputData/Datum/InputDatum.php | 4 + src/InputValueGetter.php | 69 +++++++++++++++-- test/phpunit/InputTest.php | 26 +++++++ 8 files changed, 254 insertions(+), 13 deletions(-) create mode 100644 example/02-multiple-inputs.php create mode 100644 example/www/multiple-file-upload.php diff --git a/composer.json b/composer.json index 78df854..da8749a 100644 --- a/composer.json +++ b/composer.json @@ -4,6 +4,7 @@ "license": "MIT", "require": { + "php": ">=8.0", "phpgt/http": "^v1.1" }, diff --git a/composer.lock b/composer.lock index 6525628..6f26469 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": "d699d19511679c984383019a9d3ca3a4", + "content-hash": "d2206c48be8ef3c502284e560cdbfd52", "packages": [ { "name": "phpgt/cookie", @@ -2364,7 +2364,9 @@ "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, - "platform": [], + "platform": { + "php": ">=8.0" + }, "platform-dev": [], "plugin-api-version": "2.2.0" } diff --git a/example/02-multiple-inputs.php b/example/02-multiple-inputs.php new file mode 100644 index 0000000..d2045da --- /dev/null +++ b/example/02-multiple-inputs.php @@ -0,0 +1,107 @@ + + *
+ *
+ *
+ *
+ *
+ * + * + *
+ */ +use Gt\Input\Input; +use Gt\Input\InputData\Datum\FailedFileUpload; + +require(__DIR__ . "/../vendor/autoload.php"); + +$_GET = []; +$_POST = [ + "do" => "upload", + "name" => "Greg", + "colour" => [ + "red", + "blue", + ], +]; +$_FILES = [ + "upload" => [ + "name" => [ + "front.jpg", + "back.jpg", + "description.txt", + ], + "full_path" => [ + "front.jpg", + "back.jpg", + "description.txt", + ], + "type" => [ + "image/jpeg", + "image/jpeg", + "text/plain", + ], + "tmp_name" => [ + "/tmp/phpkLgfwE", + "/tmp/phpiZKQf6", + "/tmp/php9UtO5A", + ], + "error" => [ + 0, + 0, + 0, + ], + "size" => [ + 123891, + 165103, + 915, + ], + ] +]; + +$input = new Input($_GET, $_POST, $_FILES); + +echo "Your name: " . $input->getString("name"), PHP_EOL; + +if(!$input->contains("colour")) { + echo "No colours chosen...", PHP_EOL; + exit; +} +foreach($input->getMultipleString("colour") as $colour) { + echo "Colour chosen: $colour", PHP_EOL; +} + +if(!$input->contains("upload")) { + echo "Nothing uploaded...", PHP_EOL; + exit; +} + +foreach($input->getMultipleFile("upload") as $fileName => $upload) { + if($upload instanceof FailedFileUpload) { + echo "Error uploading $fileName!", PHP_EOL; + continue; + } + + $newPath = "data/upload/$fileName"; + $size = $upload->getSize(); + echo "Uploaded to $newPath (size $size)", PHP_EOL; +} diff --git a/example/www/multiple-file-upload.php b/example/www/multiple-file-upload.php new file mode 100644 index 0000000..d3052de --- /dev/null +++ b/example/www/multiple-file-upload.php @@ -0,0 +1,47 @@ +"; +echo "Your name is: ", $input->getString("name"), PHP_EOL; + +$colourString = implode(", ", $input->getMultipleString("colour")); +echo "Colours chosen: ", $colourString, PHP_EOL; + +echo "Files uploaded: ", PHP_EOL; +foreach($input->getMultipleFile("upload") as $fileName => $upload) { + echo "$fileName is size: ", $upload->getSize(), PHP_EOL; +} + +website:?> + +
+
+
+
+
+ + +
diff --git a/src/Input.php b/src/Input.php index 6fe3b04..7eada4b 100644 --- a/src/Input.php +++ b/src/Input.php @@ -38,7 +38,7 @@ class Input implements ArrayAccess, Countable, Iterator { /** * @param array $get * @param array $post - * @param array> $files + * @param array>> $files * @param string $bodyPath */ public function __construct( @@ -108,9 +108,8 @@ public function add(string $key, InputDatum $datum, string $method):void { * Get a particular input value by its key. To specify either GET or POST variables, pass * Input::METHOD_GET or Input::METHOD_POST as the second parameter (defaults to * Input::METHOD_BOTH). - * @return mixed|null */ - public function get(string $key, string $method = null) { + public function get(string $key, string $method = null):null|InputDatum|string { if(is_null($method)) { $method = self::DATA_COMBINED; } @@ -138,7 +137,7 @@ public function get(string $key, string $method = null) { throw new InvalidInputMethodException($method); } - return $data; + return $data?->getValue(); } /** diff --git a/src/InputData/Datum/InputDatum.php b/src/InputData/Datum/InputDatum.php index 18d7d38..f1405e7 100644 --- a/src/InputData/Datum/InputDatum.php +++ b/src/InputData/Datum/InputDatum.php @@ -11,4 +11,8 @@ public function __construct(mixed $value) { public function __toString():string { return $this->value; } + + public function getValue():mixed { + return $this->value; + } } diff --git a/src/InputValueGetter.php b/src/InputValueGetter.php index c399505..29d828b 100644 --- a/src/InputValueGetter.php +++ b/src/InputValueGetter.php @@ -21,6 +21,11 @@ public function getString(string $key):?string { return $this->get($key); } + /** @return array */ + public function getMultipleString(string $key):array { + return $this->getTypedArray($key, "string"); + } + public function getInt(string $key):?int { $value = $this->getString($key); if(is_null($value) || strlen($value) === 0) { @@ -30,6 +35,11 @@ public function getInt(string $key):?int { return (int)$value; } + /** @return array */ + public function getMultipleInt(string $key):array { + return $this->getTypedArray($key, "int"); + } + public function getFloat(string $key):?float { $value = $this->getString($key); if(is_null($value) || strlen($value) === 0) { @@ -39,6 +49,11 @@ public function getFloat(string $key):?float { return (float)$value; } + /** @return array */ + public function getMultipleFloat(string $key):array { + return $this->getTypedArray($key, "float"); + } + public function getBool(string $key):?bool { $value = $this->getString($key); if(is_null($value) || strlen($value) === 0) { @@ -48,12 +63,17 @@ public function getBool(string $key):?bool { return (bool)$value; } + /** @return array */ + public function getMultipleBool(string $key):array { + return $this->getTypedArray($key, "bool"); + } + + public function getFile(string $key):FileUpload { /** @var FileUploadInputData|InputDatum[] $params */ $params = $this->fileUploadParameters ?? $this->parameters; try { - /** @var MultipleInputDatum|FileUpload $file */ $file = $params[$key]; @@ -63,14 +83,27 @@ public function getFile(string $key):FileUpload { return $file; } - catch(TypeError $exception) { + catch(TypeError) { throw new DataNotFileUploadException($key); } } - /** @return MultipleInputDatum */ - public function getMultipleFile(string $key):MultipleInputDatum { - return $this->get($key); + /** @return array */ + public function getMultipleFile(string $key):array { + $multipleFileUpload = $this->get($key); + if(!$multipleFileUpload instanceof MultipleInputDatum) { + throw new InputException("Parameter '$key' is not a multiple file input."); + } + + $array = []; + + /** @var FileUpload $file */ + foreach($multipleFileUpload as $file) { + $name = $file->getClientFilename(); + $array[$name] = $file; + } + + return $array; } public function getDateTime( @@ -101,8 +134,30 @@ public function getDateTime( return $dateTime; } - /** @return MultipleInputDatum */ - public function getMultipleDateTime(string $key):MultipleInputDatum { + /** @return array */ + public function getMultipleDateTime(string $key):array { return $this->get($key); } + + private function getTypedArray(string $key, string $typeName):array { + $array = []; + $datum = $this->get($key); + + if(is_null($datum)) { + return []; + } + + foreach($datum as $item) { + $cast = match($typeName) { + "int" => (int)$item, + "float" => (float)$item, + "bool" => (bool)$item, + default => (string)$item, + }; + + array_push($array, $cast); + } + + return $array; + } } diff --git a/test/phpunit/InputTest.php b/test/phpunit/InputTest.php index e49a5ec..9a1ddd6 100644 --- a/test/phpunit/InputTest.php +++ b/test/phpunit/InputTest.php @@ -5,6 +5,7 @@ use Gt\Input\DataNotCompatibleFormatException; use Gt\Input\Input; use Gt\Input\InputData\Datum\FileUpload; +use Gt\Input\InputData\Datum\InputDatum; use Gt\Input\InputData\InputData; use Gt\Input\InvalidInputMethodException; use Gt\Input\MissingInputParameterException; @@ -632,6 +633,31 @@ public function testContainsThrowsExceptionOnIncorrectType($get, $post) { $input->contains("anything", "invalid-method"); } + public function testGetMultipleFile():void { + $get = []; + $post = ["do" => "upload"]; + $files = [ + "uploads" => [ + "name" => ["one.txt", "two.txt"], + "type" => ["plain/text", "plain/text"], + "size" => [123, 321], + "tmp_name" => ["/tmp/aaaaa", "/tmp/bbbbb"], + "error" => [0, 0], + "full_path" => ["one.txt", "two.txt"], + ] + ]; + $sut = new Input($get, $post, $files); + $multipleFiles = $sut->getMultipleFile("uploads"); + self::assertCount(count($files["uploads"]["name"]), $multipleFiles); + + $i = 0; + foreach($multipleFiles as $fileName => $file) { + self::assertSame($files["uploads"]["name"][$i], $fileName); + self::assertSame($files["uploads"]["tmp_name"][$i], $file->getRealPath()); + $i++; + } + } + public function dataRandomGetPost():array { $data = []; From 2395e1ff6a65a9b8f1e0d3319f277cb13f874b3c Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Fri, 1 Jul 2022 12:44:32 +0100 Subject: [PATCH 15/50] build: hard dependencies (#235) --- composer.json | 4 +- composer.lock | 163 +++++++++++++------------------------------------- 2 files changed, 42 insertions(+), 125 deletions(-) diff --git a/composer.json b/composer.json index da8749a..ed2f34b 100644 --- a/composer.json +++ b/composer.json @@ -9,8 +9,8 @@ }, "require-dev": { - "phpunit/phpunit": "^v9.5", - "phpstan/phpstan": "^v1.4" + "phpstan/phpstan": "v1.8.0", + "phpunit/phpunit": "v9.5.21" }, "autoload": { diff --git a/composer.lock b/composer.lock index 6f26469..e8f5844 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": "d2206c48be8ef3c502284e560cdbfd52", + "content-hash": "8011fe524de4ee77b67dfc5b229c2fa5", "packages": [ { "name": "phpgt/cookie", @@ -332,16 +332,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.13.2", + "version": "v4.14.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077" + "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1", + "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1", "shasum": "" }, "require": { @@ -382,9 +382,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0" }, - "time": "2021-11-30T19:35:32+00:00" + "time": "2022-05-31T20:59:12+00:00" }, { "name": "phar-io/manifest", @@ -609,16 +609,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" + "reference": "77a32518733312af16a44300404e945338981de3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", + "reference": "77a32518733312af16a44300404e945338981de3", "shasum": "" }, "require": { @@ -653,9 +653,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.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" }, - "time": "2022-01-04T19:58:01+00:00" + "time": "2022-03-15T21:29:03+00:00" }, { "name": "phpspec/prophecy", @@ -726,20 +726,20 @@ }, { "name": "phpstan/phpstan", - "version": "1.4.10", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "898c479c39caa727bedf4311dd294a8f4e250e72" + "reference": "b7648d4ee9321665acaf112e49da9fd93df8fbd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/898c479c39caa727bedf4311dd294a8f4e250e72", - "reference": "898c479c39caa727bedf4311dd294a8f4e250e72", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b7648d4ee9321665acaf112e49da9fd93df8fbd5", + "reference": "b7648d4ee9321665acaf112e49da9fd93df8fbd5", "shasum": "" }, "require": { - "php": "^7.1|^8.0" + "php": "^7.2|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -761,7 +761,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.4.10" + "source": "https://github.com/phpstan/phpstan/tree/1.8.0" }, "funding": [ { @@ -781,7 +781,7 @@ "type": "tidelift" } ], - "time": "2022-03-14T10:25:45+00:00" + "time": "2022-06-29T08:53:31+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1103,16 +1103,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.19", + "version": "9.5.21", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807" + "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/35ea4b7f3acabb26f4bb640f8c30866c401da807", - "reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0e32b76be457de00e83213528f6bb37e2a38fcb1", + "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1", "shasum": "" }, "require": { @@ -1146,7 +1146,6 @@ "sebastian/version": "^3.0.2" }, "require-dev": { - "ext-pdo": "*", "phpspec/prophecy-phpunit": "^2.0.1" }, "suggest": { @@ -1190,7 +1189,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.19" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.21" }, "funding": [ { @@ -1202,7 +1201,7 @@ "type": "github" } ], - "time": "2022-03-15T09:57:31+00:00" + "time": "2022-06-19T12:14:25+00:00" }, { "name": "sebastian/cli-parser", @@ -1570,16 +1569,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.3", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", "shasum": "" }, "require": { @@ -1621,7 +1620,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" }, "funding": [ { @@ -1629,7 +1628,7 @@ "type": "github" } ], - "time": "2020-09-28T05:52:38+00:00" + "time": "2022-04-03T09:37:03+00:00" }, { "name": "sebastian/exporter", @@ -2168,88 +2167,6 @@ ], "time": "2020-09-28T06:39:44+00:00" }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.25.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "30885182c981ab175d4d034db0f6f469898070ab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", - "reference": "30885182c981ab175d4d034db0f6f469898070ab", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com/", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-10-20T20:35:02+00:00" - }, { "name": "theseer/tokenizer", "version": "1.2.1", @@ -2302,21 +2219,21 @@ }, { "name": "webmozart/assert", - "version": "1.10.0", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" + "ext-ctype": "*", + "php": "^7.2 || ^8.0" }, "conflict": { "phpstan/phpstan": "<0.12.20", @@ -2354,9 +2271,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" + "source": "https://github.com/webmozarts/assert/tree/1.11.0" }, - "time": "2021-03-09T10:59:23+00:00" + "time": "2022-06-03T18:03:27+00:00" } ], "aliases": [], From 607a35363e416f5aa1a9c9568059f696d394bec5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Jul 2022 11:00:57 +0100 Subject: [PATCH 16/50] Bump phpstan/phpstan from 1.8.0 to 1.8.1 (#236) Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.8.0 to 1.8.1. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.8.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.8.0...1.8.1) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.json | 2 +- composer.lock | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index ed2f34b..d5b2ed2 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ }, "require-dev": { - "phpstan/phpstan": "v1.8.0", + "phpstan/phpstan": "v1.8.1", "phpunit/phpunit": "v9.5.21" }, diff --git a/composer.lock b/composer.lock index e8f5844..fc0820d 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": "8011fe524de4ee77b67dfc5b229c2fa5", + "content-hash": "add6d3ae6da3fc5b6afe2ab0eabd877b", "packages": [ { "name": "phpgt/cookie", @@ -726,16 +726,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.0", + "version": "1.8.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "b7648d4ee9321665acaf112e49da9fd93df8fbd5" + "reference": "8dbba631fa32f4b289404469c2afd6122fd61d67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b7648d4ee9321665acaf112e49da9fd93df8fbd5", - "reference": "b7648d4ee9321665acaf112e49da9fd93df8fbd5", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8dbba631fa32f4b289404469c2afd6122fd61d67", + "reference": "8dbba631fa32f4b289404469c2afd6122fd61d67", "shasum": "" }, "require": { @@ -761,7 +761,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.0" + "source": "https://github.com/phpstan/phpstan/tree/1.8.1" }, "funding": [ { @@ -781,7 +781,7 @@ "type": "tidelift" } ], - "time": "2022-06-29T08:53:31+00:00" + "time": "2022-07-12T16:08:06+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2285,5 +2285,5 @@ "php": ">=8.0" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } From 819844af0cd98d9b2c83ab34583a9575b4affb58 Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Wed, 14 Sep 2022 11:29:42 +0100 Subject: [PATCH 17/50] maintenance: dependabot (#247) closes #145 --- .github/dependabot.yml | 37 ++--- composer.json | 4 +- composer.lock | 367 +++++------------------------------------ 3 files changed, 51 insertions(+), 357 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2aa4754..307abf3 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,29 +1,12 @@ version: 2 updates: -- package-ecosystem: composer - directory: "/" - schedule: - interval: daily - open-pull-requests-limit: 10 - ignore: - - dependency-name: phpstan/phpstan - versions: - - 0.12.70 - - 0.12.71 - - 0.12.73 - - 0.12.74 - - 0.12.75 - - 0.12.76 - - 0.12.77 - - 0.12.78 - - 0.12.79 - - 0.12.80 - - 0.12.81 - - 0.12.82 - - 0.12.83 - - dependency-name: phpunit/phpunit - versions: - - 9.5.1 - - 9.5.2 - - 9.5.3 - - 9.5.4 + - package-ecosystem: composer + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 + ignore: + - dependency-name: phpunit/phpunit + update-types: ["version-update:semver-patch"] + - dependency-name: phpstan/phpstan + update-types: ["version-update:semver-patch"] diff --git a/composer.json b/composer.json index d5b2ed2..d20dcb1 100644 --- a/composer.json +++ b/composer.json @@ -9,8 +9,8 @@ }, "require-dev": { - "phpstan/phpstan": "v1.8.1", - "phpunit/phpunit": "v9.5.21" + "phpstan/phpstan": "^v1.8", + "phpunit/phpunit": "^v9.5" }, "autoload": { diff --git a/composer.lock b/composer.lock index fc0820d..e0c8901 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": "add6d3ae6da3fc5b6afe2ab0eabd877b", + "content-hash": "ed6d7075c3e3210ac67dc745d1477568", "packages": [ { "name": "phpgt/cookie", @@ -332,16 +332,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.14.0", + "version": "v4.15.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1" + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", "shasum": "" }, "require": { @@ -382,9 +382,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" }, - "time": "2022-05-31T20:59:12+00:00" + "time": "2022-09-04T07:30:47+00:00" }, { "name": "phar-io/manifest", @@ -497,245 +497,18 @@ }, "time": "2022-02-21T01:04:05+00:00" }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org/", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" - }, - "time": "2021-10-19T17:43:47+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.6.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "77a32518733312af16a44300404e945338981de3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", - "reference": "77a32518733312af16a44300404e945338981de3", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "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.1" - }, - "time": "2022-03-15T21:29:03+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com/" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" - }, - "time": "2021-12-08T12:19:24+00:00" - }, { "name": "phpstan/phpstan", - "version": "1.8.1", + "version": "1.8.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "8dbba631fa32f4b289404469c2afd6122fd61d67" + "reference": "eed4c9da531f6ebb4787235b6fb486e2c20f34e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8dbba631fa32f4b289404469c2afd6122fd61d67", - "reference": "8dbba631fa32f4b289404469c2afd6122fd61d67", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/eed4c9da531f6ebb4787235b6fb486e2c20f34e5", + "reference": "eed4c9da531f6ebb4787235b6fb486e2c20f34e5", "shasum": "" }, "require": { @@ -759,9 +532,13 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.1" + "source": "https://github.com/phpstan/phpstan/tree/1.8.4" }, "funding": [ { @@ -772,36 +549,32 @@ "url": "https://github.com/phpstan", "type": "github" }, - { - "url": "https://www.patreon.com/phpstan", - "type": "patreon" - }, { "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", "type": "tidelift" } ], - "time": "2022-07-12T16:08:06+00:00" + "time": "2022-09-03T13:08:04+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.15", + "version": "9.2.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.13.0", + "nikic/php-parser": "^4.14", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -850,7 +623,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" }, "funding": [ { @@ -858,7 +631,7 @@ "type": "github" } ], - "time": "2022-03-07T09:28:20+00:00" + "time": "2022-08-30T12:24:04+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1103,16 +876,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.21", + "version": "9.5.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1" + "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0e32b76be457de00e83213528f6bb37e2a38fcb1", - "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", + "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", "shasum": "" }, "require": { @@ -1127,7 +900,6 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpspec/prophecy": "^1.12.1", "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", @@ -1142,12 +914,9 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.0", + "sebastian/type": "^3.1", "sebastian/version": "^3.0.2" }, - "require-dev": { - "phpspec/prophecy-phpunit": "^2.0.1" - }, "suggest": { "ext-soap": "*", "ext-xdebug": "*" @@ -1189,7 +958,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.21" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.24" }, "funding": [ { @@ -1201,7 +970,7 @@ "type": "github" } ], - "time": "2022-06-19T12:14:25+00:00" + "time": "2022-08-30T07:42:16+00:00" }, { "name": "sebastian/cli-parser", @@ -2060,16 +1829,16 @@ }, { "name": "sebastian/type", - "version": "3.0.0", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" + "reference": "fb44e1cc6e557418387ad815780360057e40753e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb44e1cc6e557418387ad815780360057e40753e", + "reference": "fb44e1cc6e557418387ad815780360057e40753e", "shasum": "" }, "require": { @@ -2081,7 +1850,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -2104,7 +1873,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.1.0" }, "funding": [ { @@ -2112,7 +1881,7 @@ "type": "github" } ], - "time": "2022-03-15T09:54:48+00:00" + "time": "2022-08-29T06:55:37+00:00" }, { "name": "sebastian/version", @@ -2216,64 +1985,6 @@ } ], "time": "2021-07-28T10:34:58+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.11.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", - "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "php": "^7.2 || ^8.0" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.11.0" - }, - "time": "2022-06-03T18:03:27+00:00" } ], "aliases": [], @@ -2285,5 +1996,5 @@ "php": ">=8.0" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } From 9c8a973cc73b9a7b21c2db61f9da7cb65822b8fd Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Tue, 27 Sep 2022 11:34:29 +0100 Subject: [PATCH 18/50] ci: upgrade workflow (#249) --- .github/workflows/ci.yml | 21 ++++++----- composer.json | 2 +- composer.lock | 76 +++++++++++++++++++++------------------- 3 files changed, 53 insertions(+), 46 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb9d96f..23ba1df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,21 +7,24 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Cache Composer dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: /tmp/composer-cache key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} - - uses: php-actions/composer@v5 + - name: Composer + uses: php-actions/composer@v6 + with: + php_version: '8.1' - name: Archive build run: mkdir /tmp/github-actions/ && tar -cvf /tmp/github-actions/build.tar ./ - name: Upload build archive for test runners - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: build-artifact path: /tmp/github-actions @@ -31,7 +34,7 @@ jobs: needs: [composer] steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: build-artifact path: /tmp/github-actions @@ -40,9 +43,9 @@ jobs: run: tar -xvf /tmp/github-actions/build.tar ./ - name: PHP Unit tests - uses: php-actions/phpunit@v2 + uses: php-actions/phpunit@v3 with: - php_version: 8.0 + php_version: 8.1 php_extensions: xdebug configuration: test/phpunit/phpunit.xml bootstrap: vendor/autoload.php @@ -52,7 +55,7 @@ jobs: needs: [composer] steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: build-artifact path: /tmp/github-actions @@ -61,6 +64,6 @@ jobs: run: tar -xvf /tmp/github-actions/build.tar ./ - name: PHP Static Analysis - uses: php-actions/phpstan@v2 + uses: php-actions/phpstan@v3 with: path: src/ diff --git a/composer.json b/composer.json index d20dcb1..705feec 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "license": "MIT", "require": { - "php": ">=8.0", + "php": ">=8.1", "phpgt/http": "^v1.1" }, diff --git a/composer.lock b/composer.lock index e0c8901..cc2da08 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": "ed6d7075c3e3210ac67dc745d1477568", + "content-hash": "c72632239a7c0e8cfd812164338c23db", "packages": [ { "name": "phpgt/cookie", @@ -499,16 +499,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.4", + "version": "1.8.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "eed4c9da531f6ebb4787235b6fb486e2c20f34e5" + "reference": "c386ab2741e64cc9e21729f891b28b2b10fe6618" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/eed4c9da531f6ebb4787235b6fb486e2c20f34e5", - "reference": "eed4c9da531f6ebb4787235b6fb486e2c20f34e5", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c386ab2741e64cc9e21729f891b28b2b10fe6618", + "reference": "c386ab2741e64cc9e21729f891b28b2b10fe6618", "shasum": "" }, "require": { @@ -538,7 +538,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.4" + "source": "https://github.com/phpstan/phpstan/tree/1.8.6" }, "funding": [ { @@ -554,7 +554,7 @@ "type": "tidelift" } ], - "time": "2022-09-03T13:08:04+00:00" + "time": "2022-09-23T09:54:39+00:00" }, { "name": "phpunit/php-code-coverage", @@ -876,16 +876,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.24", + "version": "9.5.25", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5" + "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", - "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", + "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", "shasum": "" }, "require": { @@ -907,14 +907,14 @@ "phpunit/php-timer": "^5.0.2", "sebastian/cli-parser": "^1.0.1", "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.5", + "sebastian/comparator": "^4.0.8", "sebastian/diff": "^4.0.3", "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.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.1", + "sebastian/type": "^3.2", "sebastian/version": "^3.0.2" }, "suggest": { @@ -958,7 +958,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.24" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.25" }, "funding": [ { @@ -968,9 +968,13 @@ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "time": "2022-08-30T07:42:16+00:00" + "time": "2022-09-25T03:44:45+00:00" }, { "name": "sebastian/cli-parser", @@ -1141,16 +1145,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.6", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { @@ -1203,7 +1207,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" }, "funding": [ { @@ -1211,7 +1215,7 @@ "type": "github" } ], - "time": "2020-10-26T15:49:45+00:00" + "time": "2022-09-14T12:41:17+00:00" }, { "name": "sebastian/complexity", @@ -1401,16 +1405,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "shasum": "" }, "require": { @@ -1466,7 +1470,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" }, "funding": [ { @@ -1474,7 +1478,7 @@ "type": "github" } ], - "time": "2021-11-11T14:18:36+00:00" + "time": "2022-09-14T06:03:37+00:00" }, { "name": "sebastian/global-state", @@ -1829,16 +1833,16 @@ }, { "name": "sebastian/type", - "version": "3.1.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb44e1cc6e557418387ad815780360057e40753e" + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb44e1cc6e557418387ad815780360057e40753e", - "reference": "fb44e1cc6e557418387ad815780360057e40753e", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", "shasum": "" }, "require": { @@ -1850,7 +1854,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1873,7 +1877,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.1.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" }, "funding": [ { @@ -1881,7 +1885,7 @@ "type": "github" } ], - "time": "2022-08-29T06:55:37+00:00" + "time": "2022-09-12T14:47:03+00:00" }, { "name": "sebastian/version", @@ -1993,7 +1997,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=8.0" + "php": ">=8.1" }, "platform-dev": [], "plugin-api-version": "2.2.0" From fbcd56090e6b69050ebf585e31aa3b8decbbfa0a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Sep 2022 11:37:03 +0100 Subject: [PATCH 19/50] Bump phpgt/http from 1.1.2 to 1.1.6 (#248) Bumps [phpgt/http](https://github.com/PhpGt/Http) from 1.1.2 to 1.1.6. - [Release notes](https://github.com/PhpGt/Http/releases) - [Commits](https://github.com/PhpGt/Http/compare/v1.1.2...v1.1.6) --- updated-dependencies: - dependency-name: phpgt/http dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Greg Bowler --- composer.lock | 93 ++++++++++++++++----------------------------------- 1 file changed, 28 insertions(+), 65 deletions(-) diff --git a/composer.lock b/composer.lock index cc2da08..fb4bb30 100644 --- a/composer.lock +++ b/composer.lock @@ -6,72 +6,29 @@ ], "content-hash": "c72632239a7c0e8cfd812164338c23db", "packages": [ - { - "name": "phpgt/cookie", - "version": "v1.0.2", - "source": { - "type": "git", - "url": "https://github.com/PhpGt/Cookie.git", - "reference": "dd811b6f04becc7c1f8524d84ad02e4635f4a94e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PhpGt/Cookie/zipball/dd811b6f04becc7c1f8524d84ad02e4635f4a94e", - "reference": "dd811b6f04becc7c1f8524d84ad02e4635f4a94e", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "require-dev": { - "phpunit/phpunit": "8.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "Gt\\Cookie\\": "./src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Greg Bowler", - "email": "greg.bowler@g105b.com" - } - ], - "description": "Object oriented cookie handler.", - "support": { - "issues": "https://github.com/PhpGt/Cookie/issues", - "source": "https://github.com/PhpGt/Cookie/tree/v1.0.2" - }, - "time": "2019-07-17T20:11:11+00:00" - }, { "name": "phpgt/http", - "version": "v1.1.2", + "version": "v1.1.6", "source": { "type": "git", "url": "https://github.com/PhpGt/Http.git", - "reference": "80683cebb3c9490f0f7eb71fa5f25cc85a9eb5ed" + "reference": "ec7a74dd32bd2f105684937b7650097a8f2d843b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PhpGt/Http/zipball/80683cebb3c9490f0f7eb71fa5f25cc85a9eb5ed", - "reference": "80683cebb3c9490f0f7eb71fa5f25cc85a9eb5ed", + "url": "https://api.github.com/repos/PhpGt/Http/zipball/ec7a74dd32bd2f105684937b7650097a8f2d843b", + "reference": "ec7a74dd32bd2f105684937b7650097a8f2d843b", "shasum": "" }, "require": { - "php": ">=7.2", - "phpgt/cookie": "*", - "phpgt/input": "*", - "psr/http-message": "^1.0.1", - "willdurand/negotiation": "^2.3" + "php": ">=8.0", + "phpgt/input": "^v1", + "psr/http-message": "^v1.0.1", + "willdurand/negotiation": "v3.1.0" }, "require-dev": { - "phpunit/phpunit": "8.*" + "phpstan/phpstan": "^v1.8", + "phpunit/phpunit": "^v9.5" }, "type": "library", "autoload": { @@ -86,9 +43,15 @@ "description": "PSR-7 HTTP message implementation.", "support": { "issues": "https://github.com/PhpGt/Http/issues", - "source": "https://github.com/PhpGt/Http/tree/v1.1.2" + "source": "https://github.com/PhpGt/Http/tree/v1.1.6" }, - "time": "2020-06-16T13:13:25+00:00" + "funding": [ + { + "url": "https://github.com/sponsors/PhpGt", + "type": "github" + } + ], + "time": "2022-09-26T19:55:44+00:00" }, { "name": "psr/http-message", @@ -145,28 +108,28 @@ }, { "name": "willdurand/negotiation", - "version": "v2.3.1", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/willdurand/Negotiation.git", - "reference": "03436ededa67c6e83b9b12defac15384cb399dc9" + "reference": "68e9ea0553ef6e2ee8db5c1d98829f111e623ec2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/willdurand/Negotiation/zipball/03436ededa67c6e83b9b12defac15384cb399dc9", - "reference": "03436ededa67c6e83b9b12defac15384cb399dc9", + "url": "https://api.github.com/repos/willdurand/Negotiation/zipball/68e9ea0553ef6e2ee8db5c1d98829f111e623ec2", + "reference": "68e9ea0553ef6e2ee8db5c1d98829f111e623ec2", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=7.1.0" }, "require-dev": { - "phpunit/phpunit": "~4.5" + "symfony/phpunit-bridge": "^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -195,9 +158,9 @@ ], "support": { "issues": "https://github.com/willdurand/Negotiation/issues", - "source": "https://github.com/willdurand/Negotiation/tree/2.x" + "source": "https://github.com/willdurand/Negotiation/tree/3.1.0" }, - "time": "2017-05-14T17:21:12+00:00" + "time": "2022-01-30T20:08:53+00:00" } ], "packages-dev": [ @@ -2000,5 +1963,5 @@ "php": ">=8.1" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } From e348ebdddea96be945318781b070a5c52b46f90b Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Wed, 1 Mar 2023 13:33:51 +0000 Subject: [PATCH 20/50] feature: implement asArray on Input (#284) * feature: implement asArray on Input closes #283 * wip: typed function tests for working with arrays * maintenance: harden type system * maintenance: improve after static analysis * ci: upgrade to matrix runner * build: phpcs and phpmd * test: action codesniffer tests * fix: inherit return type * fix: action mess detector tests * docs: update badges * test: check multiple float usage --- .github/workflows/ci.yml | 115 +- .scrutinizer.yml | 32 - README.md | 27 +- composer.json | 8 +- composer.lock | 1632 +++++++++++++---- phpcs.xml | 66 + phpmd.xml | 61 + src/BodyStream.php | 2 +- src/CallOrOutOfSequenceException.php | 2 +- src/DataNotCompatibleFormatException.php | 2 +- src/DataNotFileUploadException.php | 2 +- src/ImmutableObjectModificationException.php | 2 +- src/Input.php | 89 +- src/InputData/AbstractInputData.php | 10 +- src/InputData/BodyInputData.php | 2 +- src/InputData/CombinedInputData.php | 2 +- src/InputData/Datum/FailedFileUpload.php | 2 +- src/InputData/Datum/FileUpload.php | 19 +- src/InputData/Datum/MultipleInputDatum.php | 4 +- .../Datum/StreamNotAvailableException.php | 2 +- src/InputData/FileUploadInputData.php | 2 +- src/InputData/InputData.php | 2 +- src/InputData/InputDataFactory.php | 6 +- src/InputData/KeyValueCountable.php | 2 +- src/InputData/QueryStringInputData.php | 2 +- src/InputException.php | 2 +- src/InputValueGetter.php | 23 +- src/InvalidInputMethodException.php | 2 +- src/MissingInputParameterException.php | 2 +- src/Trigger/Callback.php | 5 +- src/Trigger/Trigger.php | 5 +- src/UploadedFileMoveException.php | 2 +- src/UploadedFileSecurityException.php | 2 +- src/WithWithoutClashingException.php | 2 +- test/phpunit/Helper/Helper.php | 7 + test/phpunit/InputData/BodyInputDataTest.php | 18 + .../InputData/InputDataFactoryTest.php | 35 +- test/phpunit/InputTest.php | 38 + test/phpunit/Trigger/TriggerTest.php | 5 +- test/phpunit/phpunit.xml | 19 +- 40 files changed, 1753 insertions(+), 509 deletions(-) delete mode 100644 .scrutinizer.yml create mode 100644 phpcs.xml create mode 100644 phpmd.xml create mode 100644 test/phpunit/InputData/BodyInputDataTest.php diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23ba1df..cbe6308 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,13 @@ name: CI -on: [push, pull_request] +on: [push] jobs: composer: runs-on: ubuntu-latest + strategy: + matrix: + php: [ 8.1, 8.2 ] steps: - uses: actions/checkout@v3 @@ -15,10 +18,10 @@ jobs: path: /tmp/composer-cache key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} - - name: Composer + - name: Composer install uses: php-actions/composer@v6 with: - php_version: '8.1' + php_version: ${{ matrix.php }} - name: Archive build run: mkdir /tmp/github-actions/ && tar -cvf /tmp/github-actions/build.tar ./ @@ -31,7 +34,13 @@ jobs: phpunit: runs-on: ubuntu-latest - needs: [composer] + needs: [ composer ] + strategy: + matrix: + php: [ 8.1, 8.2 ] + + outputs: + coverage: ${{ steps.store-coverage.outputs.coverage_text }} steps: - uses: actions/download-artifact@v3 @@ -44,15 +53,46 @@ jobs: - name: PHP Unit tests uses: php-actions/phpunit@v3 + env: + XDEBUG_MODE: cover with: - php_version: 8.1 + php_version: ${{ matrix.php }} php_extensions: xdebug configuration: test/phpunit/phpunit.xml bootstrap: vendor/autoload.php + coverage_text: _coverage/coverage.txt + coverage_clover: _coverage/clover.xml + + - name: Store coverage data + uses: actions/upload-artifact@v3 + with: + name: code-coverage + path: _coverage + + coverage: + runs-on: ubuntu-latest + needs: [ phpunit ] + + steps: + - uses: actions/checkout@v3 + + - uses: actions/download-artifact@v3 + with: + name: code-coverage + path: _coverage + + - name: Output coverage + run: cat "_coverage/coverage.txt" + + - name: Upload to Codecov + uses: codecov/codecov-action@v3 phpstan: runs-on: ubuntu-latest - needs: [composer] + needs: [ composer ] + strategy: + matrix: + php: [ 8.1, 8.2 ] steps: - uses: actions/download-artifact@v3 @@ -66,4 +106,67 @@ jobs: - name: PHP Static Analysis uses: php-actions/phpstan@v3 with: + php_version: ${{ matrix.php }} + path: src/ + + phpmd: + runs-on: ubuntu-latest + needs: [ composer ] + strategy: + matrix: + php: [ 8.1, 8.2 ] + + steps: + - uses: actions/download-artifact@v3 + with: + name: build-artifact + path: /tmp/github-actions + + - name: Extract build archive + run: tar -xvf /tmp/github-actions/build.tar ./ + + - name: PHP Mess Detector + uses: php-actions/phpmd@v1 + with: + php_version: ${{ matrix.php }} path: src/ + output: text + ruleset: phpmd.xml + + phpcs: + runs-on: ubuntu-latest + needs: [ composer ] + strategy: + matrix: + php: [ 8.1, 8.2 ] + + steps: + - uses: actions/download-artifact@v3 + with: + name: build-artifact + path: /tmp/github-actions + + - name: Extract build archive + run: tar -xvf /tmp/github-actions/build.tar ./ + + - name: PHP Code Sniffer + uses: php-actions/phpcs@v1 + with: + php_version: ${{ matrix.php }} + path: src/ + standard: phpcs.xml + + remove_old_artifacts: + runs-on: ubuntu-latest + + steps: + - name: Remove old artifacts for prior workflow runs on this repository + env: + GH_TOKEN: ${{ github.token }} + run: | + gh api "/repos/${{ github.repository }}/actions/artifacts?name=build-artifact" | jq ".artifacts[] | select(.name == \"build-artifact\") | .id" > artifact-id-list.txt + while read id + do + echo -n "Deleting artifact ID $id ... " + gh api --method DELETE /repos/${{ github.repository }}/actions/artifacts/$id && echo "Done" + done getFileUpload("photo")` and `$input->getDateTime("date-of-birth")`. +Type-safe functions allow more predictable functionality, such as `$input->getFileUpload("photo")`, `$input->getDateTime("date-of-birth")`, and `$input->getMultipleString("pizza-topping")`. *** PHP.Gt/Input build status - + PHP.Gt/Input code quality - + PHP.Gt/Input code coverage @@ -36,10 +36,20 @@ Example usage Your name - + + +