From d37700932606a7973557e620da349d6fea15594f Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Mon, 21 Nov 2016 22:28:08 +0100 Subject: [PATCH 1/8] Test on PHP7.0+ on Travis and AppVeyor --- .travis.yml | 10 ---------- appveyor.yml | 6 ------ 2 files changed, 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 721db80..0d27664 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,6 @@ cache: ## PHP versions we test against php: - - 5.5 - - 5.6 - 7.0 - 7.1 - nightly @@ -18,10 +16,6 @@ php: ## Build matrix for lowest and highest possible targets matrix: include: - - php: 5.5 - env: dependencies=lowest - - php: 5.6 - env: dependencies=lowest - php: 7.0 env: dependencies=lowest - php: 7.1 @@ -30,10 +24,6 @@ matrix: env: dependencies=lowest - php: hhvm env: dependencies=lowest - - php: 5.5 - env: dependencies=highest - - php: 5.6 - env: dependencies=highest - php: 7.0 env: dependencies=highest - php: 7.1 diff --git a/appveyor.yml b/appveyor.yml index f58e10e..39404a2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,16 +7,10 @@ clone_folder: c:\projects\php-project-workspace ## Build matrix for lowest and highest possible targets environment: matrix: - - dependencies: lowest - php_ver_target: 5.6 - dependencies: lowest php_ver_target: 7.0 - - dependencies: current - php_ver_target: 5.6 - dependencies: highest php_ver_target: 7.0 - - dependencies: highest - php_ver_target: 5.6 - dependencies: highest php_ver_target: 7.0 From e67598fcac58119c8188293710d670da8ecef53f Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Mon, 21 Nov 2016 22:28:52 +0100 Subject: [PATCH 2/8] Drop support for PHP under 7.0 in composer files --- composer.json | 6 +- composer.lock | 410 +++++++++++++++++++++++++++++++++++++------------- 2 files changed, 307 insertions(+), 109 deletions(-) diff --git a/composer.json b/composer.json index 07a270a..27e97d3 100644 --- a/composer.json +++ b/composer.json @@ -12,13 +12,13 @@ } ], "require": { - "php": "^7.0 || ^5.5", + "php": "^7.0", "psr/http-message": "^1.0" }, "require-dev": { "guzzlehttp/psr7": "^1.3", "humbug/humbug": "1.0.0-alpha2", - "phpunit/phpunit": "^5.5 || ^4.8", + "phpunit/phpunit": "^5.6", "squizlabs/php_codesniffer": "^2.6" }, "autoload": { @@ -34,7 +34,7 @@ "config": { "sort-packages": true, "platform": { - "php": "5.5.9" + "php": "7.0" } }, "scripts": { diff --git a/composer.lock b/composer.lock index 8ba5a59..ff385c5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "05a02e09c122169a0c144a10b41a9d10", - "content-hash": "6c5529cce08faca1e14314a469938f93", + "hash": "382fb64564ae5c7f77ab08980b7bf66d", + "content-hash": "2c6b7086eadbbec43561d1f14ec0e04b", "packages": [ { "name": "psr/http-message", @@ -238,6 +238,48 @@ ], "time": "2016-08-01 10:27:00" }, + { + "name": "myclabs/deep-copy", + "version": "1.5.5", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "399c1f9781e222f6eb6cc238796f5200d1b7f108" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/399c1f9781e222f6eb6cc238796f5200d1b7f108", + "reference": "399c1f9781e222f6eb6cc238796f5200d1b7f108", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2016-10-31 17:19:45" + }, { "name": "padraic/humbug_get_contents", "version": "1.0.4", @@ -600,16 +642,16 @@ }, { "name": "phpspec/prophecy", - "version": "v1.6.1", + "version": "v1.6.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "58a8137754bc24b25740d4281399a4a3596058e0" + "reference": "6c52c2722f8460122f96f86346600e1077ce22cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0", - "reference": "58a8137754bc24b25740d4281399a4a3596058e0", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", + "reference": "6c52c2722f8460122f96f86346600e1077ce22cb", "shasum": "" }, "require": { @@ -617,10 +659,11 @@ "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0" + "sebastian/recursion-context": "^1.0|^2.0" }, "require-dev": { - "phpspec/phpspec": "^2.0" + "phpspec/phpspec": "^2.0", + "phpunit/phpunit": "^4.8 || ^5.6.5" }, "type": "library", "extra": { @@ -658,43 +701,44 @@ "spy", "stub" ], - "time": "2016-06-07 08:13:47" + "time": "2016-11-21 14:58:47" }, { "name": "phpunit/php-code-coverage", - "version": "2.2.4", + "version": "4.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + "reference": "6cba06ff75a1a63a71033e1a01b89056f3af1e8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6cba06ff75a1a63a71033e1a01b89056f3af1e8d", + "reference": "6cba06ff75a1a63a71033e1a01b89056f3af1e8d", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": "^5.6 || ^7.0", "phpunit/php-file-iterator": "~1.3", "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" + "phpunit/php-token-stream": "^1.4.2", + "sebastian/code-unit-reverse-lookup": "~1.0", + "sebastian/environment": "^1.3.2 || ^2.0", + "sebastian/version": "~1.0|~2.0" }, "require-dev": { "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" + "phpunit/phpunit": "^5.4" }, "suggest": { "ext-dom": "*", - "ext-xdebug": ">=2.2.1", + "ext-xdebug": ">=2.4.0", "ext-xmlwriter": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "4.0.x-dev" } }, "autoload": { @@ -720,7 +764,7 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2016-11-01 05:06:24" }, { "name": "phpunit/php-file-iterator", @@ -856,16 +900,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "1.4.8", + "version": "1.4.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b", + "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b", "shasum": "" }, "require": { @@ -901,44 +945,54 @@ "keywords": [ "tokenizer" ], - "time": "2015-09-15 10:49:45" + "time": "2016-11-15 14:06:22" }, { "name": "phpunit/phpunit", - "version": "4.8.27", + "version": "5.6.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c062dddcb68e44b563f66ee319ddae2b5a322a90" + "reference": "875145fabfa261fa9c1aea663dd29ddce92dca8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c062dddcb68e44b563f66ee319ddae2b5a322a90", - "reference": "c062dddcb68e44b563f66ee319ddae2b5a322a90", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/875145fabfa261fa9c1aea663dd29ddce92dca8f", + "reference": "875145fabfa261fa9c1aea663dd29ddce92dca8f", "shasum": "" }, "require": { "ext-dom": "*", "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "~1.3", + "php": "^5.6 || ^7.0", "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", + "phpunit/php-code-coverage": "^4.0.1", "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.1", + "phpunit/phpunit-mock-objects": "^3.2", + "sebastian/comparator": "~1.2.2", "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", + "sebastian/environment": "^1.3 || ^2.0", + "sebastian/exporter": "~2.0", "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", + "sebastian/object-enumerator": "~2.0", + "sebastian/resource-operations": "~1.0", + "sebastian/version": "~1.0|~2.0", "symfony/yaml": "~2.1|~3.0" }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2" + }, + "require-dev": { + "ext-pdo": "*" + }, "suggest": { + "ext-xdebug": "*", "phpunit/php-invoker": "~1.1" }, "bin": [ @@ -947,7 +1001,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.8.x-dev" + "dev-master": "5.6.x-dev" } }, "autoload": { @@ -973,30 +1027,33 @@ "testing", "xunit" ], - "time": "2016-07-21 06:48:14" + "time": "2016-11-21 15:23:34" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", + "version": "3.4.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + "reference": "45026c8383187ad1dcb14fbfec77dced265b9cfc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/45026c8383187ad1dcb14fbfec77dced265b9cfc", + "reference": "45026c8383187ad1dcb14fbfec77dced265b9cfc", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" + "php": "^5.6 || ^7.0", + "phpunit/php-text-template": "^1.2", + "sebastian/exporter": "^1.2 || ^2.0" + }, + "conflict": { + "phpunit/phpunit": "<5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^5.4" }, "suggest": { "ext-soap": "*" @@ -1004,7 +1061,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "3.2.x-dev" } }, "autoload": { @@ -1029,7 +1086,7 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2016-11-19 09:07:46" }, { "name": "psr/log", @@ -1078,24 +1135,69 @@ ], "time": "2016-10-10 12:19:37" }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2016-02-13 06:45:14" + }, { "name": "sebastian/comparator", - "version": "1.2.0", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/6a1ed12e8b2409076ab22e3897126211ff8b1f7f", + "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f", "shasum": "" }, "require": { "php": ">=5.3.3", "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" + "sebastian/exporter": "~1.2 || ~2.0" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -1140,7 +1242,7 @@ "compare", "equality" ], - "time": "2015-07-26 15:48:44" + "time": "2016-11-19 09:18:40" }, { "name": "sebastian/diff", @@ -1246,21 +1348,21 @@ }, { "name": "sebastian/exporter", - "version": "1.2.2", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", "shasum": "" }, "require": { "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" + "sebastian/recursion-context": "~2.0" }, "require-dev": { "ext-mbstring": "*", @@ -1269,7 +1371,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1309,7 +1411,7 @@ "export", "exporter" ], - "time": "2016-06-17 09:04:28" + "time": "2016-11-19 08:54:04" }, { "name": "sebastian/global-state", @@ -1362,18 +1464,64 @@ ], "time": "2015-10-12 03:26:01" }, + { + "name": "sebastian/object-enumerator", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", + "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "sebastian/recursion-context": "~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2016-11-19 07:35:10" + }, { "name": "sebastian/recursion-context", - "version": "1.0.2", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", "shasum": "" }, "require": { @@ -1385,7 +1533,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1413,23 +1561,73 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11 19:50:13" + "time": "2016-11-19 07:33:16" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28 20:34:47" }, { "name": "sebastian/version", - "version": "1.0.6", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", + "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", "shasum": "" }, + "require": { + "php": ">=5.6" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1448,7 +1646,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2016-02-04 12:56:52" }, { "name": "squizlabs/php_codesniffer", @@ -1530,16 +1728,16 @@ }, { "name": "symfony/console", - "version": "v3.1.6", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c99da1119ae61e15de0e4829196b9fba6f73d065" + "reference": "5be36e1f3ac7ecbe7e34fb641480ad8497b83aa6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c99da1119ae61e15de0e4829196b9fba6f73d065", - "reference": "c99da1119ae61e15de0e4829196b9fba6f73d065", + "url": "https://api.github.com/repos/symfony/console/zipball/5be36e1f3ac7ecbe7e34fb641480ad8497b83aa6", + "reference": "5be36e1f3ac7ecbe7e34fb641480ad8497b83aa6", "shasum": "" }, "require": { @@ -1587,20 +1785,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-10-06 01:44:51" + "time": "2016-11-16 22:17:09" }, { "name": "symfony/debug", - "version": "v3.1.6", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "e2b3f74a67fc928adc3c1b9027f73e1bc01190a8" + "reference": "c058661c32f5b462722e36d120905940089cbd9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/e2b3f74a67fc928adc3c1b9027f73e1bc01190a8", - "reference": "e2b3f74a67fc928adc3c1b9027f73e1bc01190a8", + "url": "https://api.github.com/repos/symfony/debug/zipball/c058661c32f5b462722e36d120905940089cbd9a", + "reference": "c058661c32f5b462722e36d120905940089cbd9a", "shasum": "" }, "require": { @@ -1644,11 +1842,11 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-09-06 11:02:40" + "time": "2016-11-15 12:55:20" }, { "name": "symfony/event-dispatcher", - "version": "v3.1.6", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -1708,16 +1906,16 @@ }, { "name": "symfony/finder", - "version": "v3.1.6", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "205b5ffbb518a98ba2ae60a52656c4a31ab00c6f" + "reference": "9925935bf7144f9e4d2b976905881b4face036fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/205b5ffbb518a98ba2ae60a52656c4a31ab00c6f", - "reference": "205b5ffbb518a98ba2ae60a52656c4a31ab00c6f", + "url": "https://api.github.com/repos/symfony/finder/zipball/9925935bf7144f9e4d2b976905881b4face036fb", + "reference": "9925935bf7144f9e4d2b976905881b4face036fb", "shasum": "" }, "require": { @@ -1753,20 +1951,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-09-28 00:11:12" + "time": "2016-11-03 08:04:31" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.2.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "dff51f72b0706335131b00a7f49606168c582594" + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", - "reference": "dff51f72b0706335131b00a7f49606168c582594", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", "shasum": "" }, "require": { @@ -1778,7 +1976,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -1812,11 +2010,11 @@ "portable", "shim" ], - "time": "2016-05-18 14:26:46" + "time": "2016-11-14 01:06:16" }, { "name": "symfony/process", - "version": "v3.1.6", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -1865,16 +2063,16 @@ }, { "name": "symfony/yaml", - "version": "v3.1.6", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "7ff51b06c6c3d5cc6686df69004a42c69df09e27" + "reference": "9da375317228e54f4ea1b013b30fa47417e84943" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/7ff51b06c6c3d5cc6686df69004a42c69df09e27", - "reference": "7ff51b06c6c3d5cc6686df69004a42c69df09e27", + "url": "https://api.github.com/repos/symfony/yaml/zipball/9da375317228e54f4ea1b013b30fa47417e84943", + "reference": "9da375317228e54f4ea1b013b30fa47417e84943", "shasum": "" }, "require": { @@ -1910,7 +2108,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-10-24 18:41:13" + "time": "2016-11-18 21:05:29" }, { "name": "webmozart/assert", @@ -1971,10 +2169,10 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.0 || ^5.5" + "php": "^7.0" }, "platform-dev": [], "platform-overrides": { - "php": "5.5.9" + "php": "7.0" } } From 90f131f5313dbbaab7eebdd2350b23eb00c4349e Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Mon, 21 Nov 2016 22:44:41 +0100 Subject: [PATCH 3/8] Scalar return types and type hints --- src/Definition/AccessToken.php | 6 +++--- src/Definition/ConsumerKey.php | 4 ++-- src/Definition/ConsumerSecret.php | 4 ++-- src/Definition/RequestToken.php | 6 +++--- src/Definition/TokenSecret.php | 4 ++-- src/RequestSigning/RequestSigner.php | 22 ++++++++++----------- src/Signature/HmacMd5Signature.php | 2 +- src/Signature/HmacSha1Signature.php | 2 +- src/Signature/HmacSha256Signature.php | 2 +- src/Signature/HmacSha384Signature.php | 2 +- src/Signature/HmacSha512Signature.php | 2 +- src/Signature/HmacSignature.php | 10 +++++----- src/Signature/Signature.php | 14 ++++++------- tests/Signature/HmacMd5SignatureTest.php | 4 ++-- tests/Signature/HmacSha1SignatureTest.php | 4 ++-- tests/Signature/HmacSha256SignatureTest.php | 4 ++-- tests/Signature/HmacSha384SignatureTest.php | 4 ++-- tests/Signature/HmacSha512SignatureTest.php | 4 ++-- 18 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/Definition/AccessToken.php b/src/Definition/AccessToken.php index d1e9251..93afec1 100644 --- a/src/Definition/AccessToken.php +++ b/src/Definition/AccessToken.php @@ -20,7 +20,7 @@ public function __construct($accessToken) /** * @return string */ - public function getAccessToken() + public function getAccessToken(): string { return $this->accessToken; } @@ -28,7 +28,7 @@ public function getAccessToken() /** * @return string */ - public function getToken() + public function getToken(): string { return (string) $this->accessToken; } @@ -36,7 +36,7 @@ public function getToken() /** * @return string */ - public function __toString() + public function __toString(): string { return (string) $this->accessToken; } diff --git a/src/Definition/ConsumerKey.php b/src/Definition/ConsumerKey.php index 11adff8..037e8ec 100644 --- a/src/Definition/ConsumerKey.php +++ b/src/Definition/ConsumerKey.php @@ -20,7 +20,7 @@ public function __construct($consumerKey) /** * @return string */ - public function getConsumerKey() + public function getConsumerKey(): string { return (string) $this->consumerKey; } @@ -28,7 +28,7 @@ public function getConsumerKey() /** * @return string */ - public function __toString() + public function __toString(): string { return (string) $this->consumerKey; } diff --git a/src/Definition/ConsumerSecret.php b/src/Definition/ConsumerSecret.php index 9cc2f3c..dd92b8a 100644 --- a/src/Definition/ConsumerSecret.php +++ b/src/Definition/ConsumerSecret.php @@ -20,7 +20,7 @@ public function __construct($consumerSecret) /** * @return string */ - public function getConsumerSecret() + public function getConsumerSecret(): string { return (string) $this->consumerSecret; } @@ -28,7 +28,7 @@ public function getConsumerSecret() /** * @return string */ - public function __toString() + public function __toString(): string { return (string) $this->consumerSecret; } diff --git a/src/Definition/RequestToken.php b/src/Definition/RequestToken.php index 16383ad..c99c01b 100644 --- a/src/Definition/RequestToken.php +++ b/src/Definition/RequestToken.php @@ -20,7 +20,7 @@ public function __construct($requestToken) /** * @return string */ - public function getRequestToken() + public function getRequestToken(): string { return $this->requestToken; } @@ -28,7 +28,7 @@ public function getRequestToken() /** * @return string */ - public function getToken() + public function getToken(): string { return (string) $this->requestToken; } @@ -36,7 +36,7 @@ public function getToken() /** * @return string */ - public function __toString() + public function __toString(): string { return (string) $this->requestToken; } diff --git a/src/Definition/TokenSecret.php b/src/Definition/TokenSecret.php index 94919a7..ca953ef 100644 --- a/src/Definition/TokenSecret.php +++ b/src/Definition/TokenSecret.php @@ -20,7 +20,7 @@ public function __construct($tokenSecret) /** * @return string */ - public function getTokenSecret() + public function getTokenSecret(): string { return (string) $this->tokenSecret; } @@ -28,7 +28,7 @@ public function getTokenSecret() /** * @return string */ - public function __toString() + public function __toString(): string { return (string) $this->tokenSecret; } diff --git a/src/RequestSigning/RequestSigner.php b/src/RequestSigning/RequestSigner.php index 6316948..efbe47f 100644 --- a/src/RequestSigning/RequestSigner.php +++ b/src/RequestSigning/RequestSigner.php @@ -52,9 +52,9 @@ public function __construct(ConsumerKey $consumerKey, ConsumerSecret $consumerSe /** * @param AccessToken $accessToken * @param TokenSecret $tokenSecret - * @return static + * @return RequestSigner */ - public function withAccessToken(AccessToken $accessToken, TokenSecret $tokenSecret) + public function withAccessToken(AccessToken $accessToken, TokenSecret $tokenSecret): RequestSigner { $clone = clone $this; $clone->accessToken = $accessToken; @@ -67,9 +67,9 @@ public function withAccessToken(AccessToken $accessToken, TokenSecret $tokenSecr } /** - * @return static + * @return RequestSigner */ - public function withoutAccessToken() + public function withoutAccessToken(): RequestSigner { $clone = clone $this; $clone->accessToken = null; @@ -85,7 +85,7 @@ public function withoutAccessToken() * @param RequestInterface $request * @return RequestInterface */ - public function sign(RequestInterface $request) + public function sign(RequestInterface $request): RequestInterface { $parameters = [ 'oauth_consumer_key' => (string) $this->consumerKey, @@ -106,9 +106,9 @@ public function sign(RequestInterface $request) public function signToRequestAuthorization( RequestInterface $request, - $callbackUri, + string $callbackUri, array $additionalParameters = [] - ) { + ): RequestInterface { $parameters = [ 'oauth_consumer_key' => (string) $this->consumerKey, 'oauth_nonce' => $this->generateNonce(), @@ -130,7 +130,7 @@ public function signToRequestAuthorization( * @param array $parameters * @return array */ - private function mergeSignatureParameter(RequestInterface $request, array $parameters) + private function mergeSignatureParameter(RequestInterface $request, array $parameters): array { $body = []; if ($request->getMethod() === 'POST' && @@ -148,7 +148,7 @@ private function mergeSignatureParameter(RequestInterface $request, array $param /** * @return string */ - private function generateTimestamp() + private function generateTimestamp(): string { $dateTime = new \DateTimeImmutable(); @@ -159,7 +159,7 @@ private function generateTimestamp() * @param int $length * @return string */ - private function generateNonce($length = 32) + private function generateNonce(int $length = 32): string { $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; @@ -170,7 +170,7 @@ private function generateNonce($length = 32) * @param array $parameters * @return string */ - private function generateAuthorizationheader(array $parameters) + private function generateAuthorizationheader(array $parameters): string { array_walk($parameters, function (&$value, $key) { $value = rawurlencode($key).'="'.rawurlencode($value).'"'; diff --git a/src/Signature/HmacMd5Signature.php b/src/Signature/HmacMd5Signature.php index 5d6ca04..79824a8 100644 --- a/src/Signature/HmacMd5Signature.php +++ b/src/Signature/HmacMd5Signature.php @@ -7,7 +7,7 @@ final class HmacMd5Signature extends HmacSignature /** * @return string */ - protected function getHashingAlgorithm() + protected function getHashingAlgorithm(): string { return 'md5'; } diff --git a/src/Signature/HmacSha1Signature.php b/src/Signature/HmacSha1Signature.php index 5d8df0b..e366ec0 100644 --- a/src/Signature/HmacSha1Signature.php +++ b/src/Signature/HmacSha1Signature.php @@ -7,7 +7,7 @@ final class HmacSha1Signature extends HmacSignature /** * @return string */ - protected function getHashingAlgorithm() + protected function getHashingAlgorithm(): string { return 'sha1'; } diff --git a/src/Signature/HmacSha256Signature.php b/src/Signature/HmacSha256Signature.php index dd88299..b739827 100644 --- a/src/Signature/HmacSha256Signature.php +++ b/src/Signature/HmacSha256Signature.php @@ -7,7 +7,7 @@ final class HmacSha256Signature extends HmacSignature /** * @return string */ - protected function getHashingAlgorithm() + protected function getHashingAlgorithm(): string { return 'sha256'; } diff --git a/src/Signature/HmacSha384Signature.php b/src/Signature/HmacSha384Signature.php index b8ff3a2..7d145ea 100644 --- a/src/Signature/HmacSha384Signature.php +++ b/src/Signature/HmacSha384Signature.php @@ -7,7 +7,7 @@ final class HmacSha384Signature extends HmacSignature /** * @return string */ - protected function getHashingAlgorithm() + protected function getHashingAlgorithm(): string { return 'sha384'; } diff --git a/src/Signature/HmacSha512Signature.php b/src/Signature/HmacSha512Signature.php index 6069dc6..5554655 100644 --- a/src/Signature/HmacSha512Signature.php +++ b/src/Signature/HmacSha512Signature.php @@ -7,7 +7,7 @@ final class HmacSha512Signature extends HmacSignature /** * @return string */ - protected function getHashingAlgorithm() + protected function getHashingAlgorithm(): string { return 'sha512'; } diff --git a/src/Signature/HmacSignature.php b/src/Signature/HmacSignature.php index 079f7f2..354c451 100644 --- a/src/Signature/HmacSignature.php +++ b/src/Signature/HmacSignature.php @@ -9,12 +9,12 @@ abstract class HmacSignature extends Signature /** * @return string */ - abstract protected function getHashingAlgorithm(); + abstract protected function getHashingAlgorithm(): string; /** * @return string */ - public function getMethod() + public function getMethod(): string { return sprintf('HMAC-%s', strtoupper($this->getHashingAlgorithm())); } @@ -25,7 +25,7 @@ public function getMethod() * @param string $method * @return string */ - public function sign(UriInterface $uri, array $parameters = [], $method = 'POST') + public function sign(UriInterface $uri, array $parameters = [], string $method = 'POST'): string { $baseString = $this->generateBaseString($uri, $parameters, $method); @@ -38,7 +38,7 @@ public function sign(UriInterface $uri, array $parameters = [], $method = 'POST' * @param string $method * @return string */ - private function generateBaseString(UriInterface $uri, array $parameters = [], $method = 'POST') + private function generateBaseString(UriInterface $uri, array $parameters = [], string $method = 'POST'): string { $baseString = [rawurlencode($method)]; @@ -74,7 +74,7 @@ private function generateBaseString(UriInterface $uri, array $parameters = [], $ * @param $string * @return string */ - private function hash($string) + private function hash(string $string): string { return hash_hmac($this->getHashingAlgorithm(), $string, $this->getKey(), true); } diff --git a/src/Signature/Signature.php b/src/Signature/Signature.php index 51cc9c9..a55ab9b 100644 --- a/src/Signature/Signature.php +++ b/src/Signature/Signature.php @@ -28,9 +28,9 @@ public function __construct(ConsumerSecret $consumerSecret) /** * @param TokenSecret $tokenSecret - * @return static + * @return Signature */ - public function withTokenSecret(TokenSecret $tokenSecret) + public function withTokenSecret(TokenSecret $tokenSecret): Signature { $clone = clone $this; $clone->tokenSecret = $tokenSecret; @@ -39,9 +39,9 @@ public function withTokenSecret(TokenSecret $tokenSecret) } /** - * @return static + * @return Signature */ - public function withoutTokenSecret() + public function withoutTokenSecret(): Signature { $clone = clone $this; $clone->tokenSecret = null; @@ -52,7 +52,7 @@ public function withoutTokenSecret() /** * @return string */ - protected function getKey() + protected function getKey(): string { $key = rawurlencode((string) $this->consumerSecret).'&'; @@ -66,7 +66,7 @@ protected function getKey() /** * @return string */ - abstract public function getMethod(); + abstract public function getMethod(): string; /** * @param UriInterface $uri @@ -74,5 +74,5 @@ abstract public function getMethod(); * @param string $method * @return string */ - abstract public function sign(UriInterface $uri, array $parameters = [], $method = 'POST'); + abstract public function sign(UriInterface $uri, array $parameters = [], string $method = 'POST'): string; } diff --git a/tests/Signature/HmacMd5SignatureTest.php b/tests/Signature/HmacMd5SignatureTest.php index a1c87aa..cd8122d 100644 --- a/tests/Signature/HmacMd5SignatureTest.php +++ b/tests/Signature/HmacMd5SignatureTest.php @@ -15,7 +15,7 @@ public function testGetMethod() $this->assertSame('HMAC-MD5', (new HmacMd5Signature(new ConsumerSecret('secret')))->getMethod()); } - public function provideSign() + public function provideSign(): array { return [ [ @@ -46,7 +46,7 @@ public function provideSign() * @param $signedSignature * @dataProvider provideSign */ - public function testSign(UriInterface $uri, $signedSignature, $signedTokenSecretSignature) + public function testSign(UriInterface $uri, string $signedSignature, string $signedTokenSecretSignature) { $secret = new ConsumerSecret('consumerSecret'); $signature = new HmacMd5Signature($secret); diff --git a/tests/Signature/HmacSha1SignatureTest.php b/tests/Signature/HmacSha1SignatureTest.php index 7f95f26..e5dc158 100644 --- a/tests/Signature/HmacSha1SignatureTest.php +++ b/tests/Signature/HmacSha1SignatureTest.php @@ -15,7 +15,7 @@ public function testGetMethod() $this->assertSame('HMAC-SHA1', (new HmacSha1Signature(new ConsumerSecret('secret')))->getMethod()); } - public function provideSign() + public function provideSign(): array { return [ [ @@ -46,7 +46,7 @@ public function provideSign() * @param $signedSignature * @dataProvider provideSign */ - public function testSign(UriInterface $uri, $signedSignature, $signedTokenSecretSignature) + public function testSign(UriInterface $uri, string $signedSignature, string $signedTokenSecretSignature) { $secret = new ConsumerSecret('consumerSecret'); $signature = new HmacSha1Signature($secret); diff --git a/tests/Signature/HmacSha256SignatureTest.php b/tests/Signature/HmacSha256SignatureTest.php index fde5dcd..c46863b 100644 --- a/tests/Signature/HmacSha256SignatureTest.php +++ b/tests/Signature/HmacSha256SignatureTest.php @@ -15,7 +15,7 @@ public function testGetMethod() $this->assertSame('HMAC-SHA256', (new HmacSha256Signature(new ConsumerSecret('secret')))->getMethod()); } - public function provideSign() + public function provideSign(): array { return [ [ @@ -46,7 +46,7 @@ public function provideSign() * @param $signedSignature * @dataProvider provideSign */ - public function testSign(UriInterface $uri, $signedSignature, $signedTokenSecretSignature) + public function testSign(UriInterface $uri, string $signedSignature, string $signedTokenSecretSignature) { $secret = new ConsumerSecret('consumerSecret'); $signature = new HmacSha256Signature($secret); diff --git a/tests/Signature/HmacSha384SignatureTest.php b/tests/Signature/HmacSha384SignatureTest.php index 5f4621b..c665366 100644 --- a/tests/Signature/HmacSha384SignatureTest.php +++ b/tests/Signature/HmacSha384SignatureTest.php @@ -15,7 +15,7 @@ public function testGetMethod() $this->assertSame('HMAC-SHA384', (new HmacSha384Signature(new ConsumerSecret('secret')))->getMethod()); } - public function provideSign() + public function provideSign(): array { return [ [ @@ -46,7 +46,7 @@ public function provideSign() * @param $signedSignature * @dataProvider provideSign */ - public function testSign(UriInterface $uri, $signedSignature, $signedTokenSecretSignature) + public function testSign(UriInterface $uri, string $signedSignature, string $signedTokenSecretSignature) { $secret = new ConsumerSecret('consumerSecret'); $signature = new HmacSha384Signature($secret); diff --git a/tests/Signature/HmacSha512SignatureTest.php b/tests/Signature/HmacSha512SignatureTest.php index dbb45ae..3423c67 100644 --- a/tests/Signature/HmacSha512SignatureTest.php +++ b/tests/Signature/HmacSha512SignatureTest.php @@ -15,7 +15,7 @@ public function testGetMethod() $this->assertSame('HMAC-SHA512', (new HmacSha512Signature(new ConsumerSecret('secret')))->getMethod()); } - public function provideSign() + public function provideSign(): array { return [ [ @@ -46,7 +46,7 @@ public function provideSign() * @param $signedSignature * @dataProvider provideSign */ - public function testSign(UriInterface $uri, $signedSignature, $signedTokenSecretSignature) + public function testSign(UriInterface $uri, string $signedSignature, string $signedTokenSecretSignature) { $secret = new ConsumerSecret('consumerSecret'); $signature = new HmacSha512Signature($secret); From 96e1c04b8960af175ca3a774f897c2cb741399b7 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Mon, 21 Nov 2016 22:51:02 +0100 Subject: [PATCH 4/8] array => Generator --- tests/Signature/HmacMd5SignatureTest.php | 45 +++++++++++---------- tests/Signature/HmacSha1SignatureTest.php | 45 +++++++++++---------- tests/Signature/HmacSha256SignatureTest.php | 45 +++++++++++---------- tests/Signature/HmacSha384SignatureTest.php | 45 +++++++++++---------- tests/Signature/HmacSha512SignatureTest.php | 45 +++++++++++---------- 5 files changed, 115 insertions(+), 110 deletions(-) diff --git a/tests/Signature/HmacMd5SignatureTest.php b/tests/Signature/HmacMd5SignatureTest.php index cd8122d..0d57d2f 100644 --- a/tests/Signature/HmacMd5SignatureTest.php +++ b/tests/Signature/HmacMd5SignatureTest.php @@ -15,29 +15,30 @@ public function testGetMethod() $this->assertSame('HMAC-MD5', (new HmacMd5Signature(new ConsumerSecret('secret')))->getMethod()); } - public function provideSign(): array + public function provideSign(): \Generator { - return [ - [ - new Uri('https://example.com/'), - 'QtfAAcCdkSRT7ZcsOf0ZMg==', - 'tgO8fZPz5fYTvT2fooRbVw==', - ], - [ - new Uri('https://example.com/thea.pot',[], 'THEAPOT'), - '+ABQ6tWjft6x4qEWj2242A==', - '/z1LDvLoyrM2/2UNr1vMfg==', - ], - [ - new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]), - 'a1zvAGr9rNs+zbSnA4eAqQ==', - 'yVkadb1I3VWMaCpqp5ucYw==', - ], - [ - new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'), - 'QtfAAcCdkSRT7ZcsOf0ZMg==', - 'tgO8fZPz5fYTvT2fooRbVw==', - ], + yield [ + new Uri('https://example.com/'), + 'QtfAAcCdkSRT7ZcsOf0ZMg==', + 'tgO8fZPz5fYTvT2fooRbVw==', + ]; + + yield [ + new Uri('https://example.com/thea.pot',[], 'THEAPOT'), + '+ABQ6tWjft6x4qEWj2242A==', + '/z1LDvLoyrM2/2UNr1vMfg==', + ]; + + yield [ + new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]), + 'a1zvAGr9rNs+zbSnA4eAqQ==', + 'yVkadb1I3VWMaCpqp5ucYw==', + ]; + + yield [ + new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'), + 'QtfAAcCdkSRT7ZcsOf0ZMg==', + 'tgO8fZPz5fYTvT2fooRbVw==', ]; } diff --git a/tests/Signature/HmacSha1SignatureTest.php b/tests/Signature/HmacSha1SignatureTest.php index e5dc158..b606757 100644 --- a/tests/Signature/HmacSha1SignatureTest.php +++ b/tests/Signature/HmacSha1SignatureTest.php @@ -15,29 +15,30 @@ public function testGetMethod() $this->assertSame('HMAC-SHA1', (new HmacSha1Signature(new ConsumerSecret('secret')))->getMethod()); } - public function provideSign(): array + public function provideSign(): \Generator { - return [ - [ - new Uri('https://example.com/'), - 'T7pWk5I7re3JTz5FS3LK8rVbQ0U=', - 'uRcxk5ukl+O0nSa9PgMEoIvOQ+M=', - ], - [ - new Uri('https://example.com/thea.pot',[], 'THEAPOT'), - 'XyTxyDmU2s3iBMBpSX4DbZ47Ltg=', - 'H6aCWT5WcUlqw4/qXVm4tMjE7P0=', - ], - [ - new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]), - 'OXZBqYIhLdj7CT6bYudGqc8OzlU=', - '3oA2qaA8dpQFdB8n0tyjrXLNvsg=', - ], - [ - new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'), - 'T7pWk5I7re3JTz5FS3LK8rVbQ0U=', - 'uRcxk5ukl+O0nSa9PgMEoIvOQ+M=', - ], + yield [ + new Uri('https://example.com/'), + 'T7pWk5I7re3JTz5FS3LK8rVbQ0U=', + 'uRcxk5ukl+O0nSa9PgMEoIvOQ+M=', + ]; + + yield [ + new Uri('https://example.com/thea.pot',[], 'THEAPOT'), + 'XyTxyDmU2s3iBMBpSX4DbZ47Ltg=', + 'H6aCWT5WcUlqw4/qXVm4tMjE7P0=', + ]; + + yield [ + new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]), + 'OXZBqYIhLdj7CT6bYudGqc8OzlU=', + '3oA2qaA8dpQFdB8n0tyjrXLNvsg=', + ]; + + yield [ + new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'), + 'T7pWk5I7re3JTz5FS3LK8rVbQ0U=', + 'uRcxk5ukl+O0nSa9PgMEoIvOQ+M=', ]; } diff --git a/tests/Signature/HmacSha256SignatureTest.php b/tests/Signature/HmacSha256SignatureTest.php index c46863b..444ff46 100644 --- a/tests/Signature/HmacSha256SignatureTest.php +++ b/tests/Signature/HmacSha256SignatureTest.php @@ -15,29 +15,30 @@ public function testGetMethod() $this->assertSame('HMAC-SHA256', (new HmacSha256Signature(new ConsumerSecret('secret')))->getMethod()); } - public function provideSign(): array + public function provideSign(): \Generator { - return [ - [ - new Uri('https://example.com/'), - 'x0e2N4wRpr2UB+rX8mwnY01tp6fnXT5SE36kAvbdSYo=', - 'ovXZ33UaQylAO8L8Ad1f/TwLU1YBXEygau34O7sDSw0=', - ], - [ - new Uri('https://example.com/thea.pot',[], 'THEAPOT'), - 'u5nNam6Cn+fCko38qAgxWUYmRrPPTF5OFOC9wZ4LHRg=', - '8IQ1uD3ZR+b8U0Fd++pGGzqNmKiF94z3psbsa+M0SxQ=', - ], - [ - new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]), - 'SlDm7qfJO/mxl1Ewnewj46jjbuCEKYGNTeew2uMDwPM=', - '5vVeCSAcL52LVGWWQ1pUFUe7cpVwkhreMQMck3PEw+E=', - ], - [ - new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'), - 'x0e2N4wRpr2UB+rX8mwnY01tp6fnXT5SE36kAvbdSYo=', - 'ovXZ33UaQylAO8L8Ad1f/TwLU1YBXEygau34O7sDSw0=', - ], + yield [ + new Uri('https://example.com/'), + 'x0e2N4wRpr2UB+rX8mwnY01tp6fnXT5SE36kAvbdSYo=', + 'ovXZ33UaQylAO8L8Ad1f/TwLU1YBXEygau34O7sDSw0=', + ]; + + yield [ + new Uri('https://example.com/thea.pot',[], 'THEAPOT'), + 'u5nNam6Cn+fCko38qAgxWUYmRrPPTF5OFOC9wZ4LHRg=', + '8IQ1uD3ZR+b8U0Fd++pGGzqNmKiF94z3psbsa+M0SxQ=', + ]; + + yield [ + new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]), + 'SlDm7qfJO/mxl1Ewnewj46jjbuCEKYGNTeew2uMDwPM=', + '5vVeCSAcL52LVGWWQ1pUFUe7cpVwkhreMQMck3PEw+E=', + ]; + + yield [ + new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'), + 'x0e2N4wRpr2UB+rX8mwnY01tp6fnXT5SE36kAvbdSYo=', + 'ovXZ33UaQylAO8L8Ad1f/TwLU1YBXEygau34O7sDSw0=', ]; } diff --git a/tests/Signature/HmacSha384SignatureTest.php b/tests/Signature/HmacSha384SignatureTest.php index c665366..8ea75d4 100644 --- a/tests/Signature/HmacSha384SignatureTest.php +++ b/tests/Signature/HmacSha384SignatureTest.php @@ -15,29 +15,30 @@ public function testGetMethod() $this->assertSame('HMAC-SHA384', (new HmacSha384Signature(new ConsumerSecret('secret')))->getMethod()); } - public function provideSign(): array + public function provideSign(): \Generator { - return [ - [ - new Uri('https://example.com/'), - 'JgaK+ORQ+mkdItwZUJgNI15mgIYHgcqEUIbp6qDbEhYrwwsrOrNxK+cgMMmY0/A7', - '0Eib7qzwodDV6L4UYTOWS9G3UYPOvZCByUn02wrMMV0vNbNLGGFnA8IxnW6v1ZYN', - ], - [ - new Uri('https://example.com/thea.pot',[], 'THEAPOT'), - 'Bm+fK6fVlejPvOcrQJcv+ZwsgQdh9W3Ok/ljmY39vy0MxymzH+I+Hntcxi90/Qfq', - 'mjT2JRgSTEdrMJi6/eJ6mZBh7C2bWT9HVqS1Gq6JpXJHNPze7gy7XdA4sgy3ORwE', - ], - [ - new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]), - '+88Vdw/72CKTOJpUM42FZLkQnBakun9M9lKVzk8a9T9TpmK9Sn6MP4hp7id/VJRj', - 'FKV3k1/PDOZTwMO6fE74NisTlixs1qlLt5IedDWVoIyk9tyNNAUIjwOt7w1GtnHH', - ], - [ - new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'), - 'JgaK+ORQ+mkdItwZUJgNI15mgIYHgcqEUIbp6qDbEhYrwwsrOrNxK+cgMMmY0/A7', - '0Eib7qzwodDV6L4UYTOWS9G3UYPOvZCByUn02wrMMV0vNbNLGGFnA8IxnW6v1ZYN', - ], + yield [ + new Uri('https://example.com/'), + 'JgaK+ORQ+mkdItwZUJgNI15mgIYHgcqEUIbp6qDbEhYrwwsrOrNxK+cgMMmY0/A7', + '0Eib7qzwodDV6L4UYTOWS9G3UYPOvZCByUn02wrMMV0vNbNLGGFnA8IxnW6v1ZYN', + ]; + + yield [ + new Uri('https://example.com/thea.pot',[], 'THEAPOT'), + 'Bm+fK6fVlejPvOcrQJcv+ZwsgQdh9W3Ok/ljmY39vy0MxymzH+I+Hntcxi90/Qfq', + 'mjT2JRgSTEdrMJi6/eJ6mZBh7C2bWT9HVqS1Gq6JpXJHNPze7gy7XdA4sgy3ORwE', + ]; + + yield [ + new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]), + '+88Vdw/72CKTOJpUM42FZLkQnBakun9M9lKVzk8a9T9TpmK9Sn6MP4hp7id/VJRj', + 'FKV3k1/PDOZTwMO6fE74NisTlixs1qlLt5IedDWVoIyk9tyNNAUIjwOt7w1GtnHH', + ]; + + yield [ + new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'), + 'JgaK+ORQ+mkdItwZUJgNI15mgIYHgcqEUIbp6qDbEhYrwwsrOrNxK+cgMMmY0/A7', + '0Eib7qzwodDV6L4UYTOWS9G3UYPOvZCByUn02wrMMV0vNbNLGGFnA8IxnW6v1ZYN', ]; } diff --git a/tests/Signature/HmacSha512SignatureTest.php b/tests/Signature/HmacSha512SignatureTest.php index 3423c67..952db05 100644 --- a/tests/Signature/HmacSha512SignatureTest.php +++ b/tests/Signature/HmacSha512SignatureTest.php @@ -15,29 +15,30 @@ public function testGetMethod() $this->assertSame('HMAC-SHA512', (new HmacSha512Signature(new ConsumerSecret('secret')))->getMethod()); } - public function provideSign(): array + public function provideSign(): \Generator { - return [ - [ - new Uri('https://example.com/'), - 'kWHPexc3goH9/jVh2MTYuAqMg6FLTKwZX63C9WmhuoCEoz1Ye5+kew3uSEg/JuQOWxbtN4jm05eSRuvIWmF0ZA==', - 'laMFvK2JMbORQp79wtajx0ESMG+U6DFlE0LBOacmsXK80dfTscLljseRi4pHeEUn1V+fDTNUIzTYjCK5DgQmRQ==', - ], - [ - new Uri('https://example.com/thea.pot',[], 'THEAPOT'), - '/I2kMebX4xOddQTfJevI6wzFvltybVUTsHlL7h5LcsgySv2Me1+6XC35e79sKFWpw5WTYaOCM7D2MNInA5NKUw==', - 'kG+XGV4utRgXWt3tbJ5361sWHn86plmm1FcLYfjjRL0l1Ogv0D5lMOMWBrCt1pRGhO05he+DPUqZffyBh4M5GA==', - ], - [ - new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]), - 'buNZpqvSzvJI1G1NLVGuiJnm/ZmZ59yfjGhUCXp8E8J98oEQHTMNua3Kawv41ejoj+KPgqw9JMZ/8HKeO7zvgg==', - 'xAllQX+xlZ6bzmthcEDZ9pyC5nyARMPaTuCe34YC9XeFIvAN+QRM1MattDvssurZN8UMPYHeyvbge1rPxygL8A==', - ], - [ - new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'), - 'kWHPexc3goH9/jVh2MTYuAqMg6FLTKwZX63C9WmhuoCEoz1Ye5+kew3uSEg/JuQOWxbtN4jm05eSRuvIWmF0ZA==', - 'laMFvK2JMbORQp79wtajx0ESMG+U6DFlE0LBOacmsXK80dfTscLljseRi4pHeEUn1V+fDTNUIzTYjCK5DgQmRQ==', - ], + yield [ + new Uri('https://example.com/'), + 'kWHPexc3goH9/jVh2MTYuAqMg6FLTKwZX63C9WmhuoCEoz1Ye5+kew3uSEg/JuQOWxbtN4jm05eSRuvIWmF0ZA==', + 'laMFvK2JMbORQp79wtajx0ESMG+U6DFlE0LBOacmsXK80dfTscLljseRi4pHeEUn1V+fDTNUIzTYjCK5DgQmRQ==', + ]; + + yield [ + new Uri('https://example.com/thea.pot',[], 'THEAPOT'), + '/I2kMebX4xOddQTfJevI6wzFvltybVUTsHlL7h5LcsgySv2Me1+6XC35e79sKFWpw5WTYaOCM7D2MNInA5NKUw==', + 'kG+XGV4utRgXWt3tbJ5361sWHn86plmm1FcLYfjjRL0l1Ogv0D5lMOMWBrCt1pRGhO05he+DPUqZffyBh4M5GA==', + ]; + + yield [ + new Uri('https://example.com/?foo=bar', ['foo' => 'bar',]), + 'buNZpqvSzvJI1G1NLVGuiJnm/ZmZ59yfjGhUCXp8E8J98oEQHTMNua3Kawv41ejoj+KPgqw9JMZ/8HKeO7zvgg==', + 'xAllQX+xlZ6bzmthcEDZ9pyC5nyARMPaTuCe34YC9XeFIvAN+QRM1MattDvssurZN8UMPYHeyvbge1rPxygL8A==', + ]; + + yield [ + new Uri('https://example.com/',['foo' => 'bar',], 'HEAD'), + 'kWHPexc3goH9/jVh2MTYuAqMg6FLTKwZX63C9WmhuoCEoz1Ye5+kew3uSEg/JuQOWxbtN4jm05eSRuvIWmF0ZA==', + 'laMFvK2JMbORQp79wtajx0ESMG+U6DFlE0LBOacmsXK80dfTscLljseRi4pHeEUn1V+fDTNUIzTYjCK5DgQmRQ==', ]; } From 66f8b0d0a16e335ae9cdbb3b9585880e6ae30997 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Tue, 22 Nov 2016 13:42:43 +0100 Subject: [PATCH 5/8] Strict typing --- src/Definition/AccessToken.php | 2 +- src/Definition/ConsumerKey.php | 2 +- src/Definition/ConsumerSecret.php | 2 +- src/Definition/RequestToken.php | 2 +- src/Definition/TokenSecret.php | 2 +- src/RequestSigning/RequestSigner.php | 2 +- src/Signature/HmacMd5Signature.php | 2 +- src/Signature/HmacSha1Signature.php | 2 +- src/Signature/HmacSha256Signature.php | 2 +- src/Signature/HmacSha384Signature.php | 2 +- src/Signature/HmacSha512Signature.php | 2 +- src/Signature/HmacSignature.php | 2 +- src/Signature/Signature.php | 2 +- tests/Definition/AccessTokenTest.php | 2 +- tests/Definition/ConsumerKeyTest.php | 2 +- tests/Definition/ConsumerSecretTest.php | 2 +- tests/Definition/RequestTokenTest.php | 2 +- tests/Definition/TokenSecretTest.php | 2 +- tests/RequestSigning/RequestSignerTest.php | 2 +- tests/Signature/HmacMd5SignatureTest.php | 2 +- tests/Signature/HmacSha1SignatureTest.php | 2 +- tests/Signature/HmacSha256SignatureTest.php | 2 +- tests/Signature/HmacSha384SignatureTest.php | 2 +- tests/Signature/HmacSha512SignatureTest.php | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Definition/AccessToken.php b/src/Definition/AccessToken.php index 93afec1..9fceeb7 100644 --- a/src/Definition/AccessToken.php +++ b/src/Definition/AccessToken.php @@ -1,4 +1,4 @@ - Date: Tue, 22 Nov 2016 23:21:37 +0100 Subject: [PATCH 6/8] Added a readme note about 1.0 and 2.0 versions, and the command to allow them both as they're compatible --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 6b92fa5..b743553 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,12 @@ To install via [Composer](http://getcomposer.org/), use the command below, it wi composer require api-clients/psr7-oauth1 ``` +In case you want to support both PHP `7.0+` and `5.5+` in your package, we suggest you use the following command: + +```bash +composer require "api-clients/psr7-oauth1:^2.0 || ^1.0" +``` + # Example ```php From a9f5e7260df19084c212a5ad37799e1efd4fcc65 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Fri, 25 Nov 2016 16:40:27 +0100 Subject: [PATCH 7/8] Clarified PHP 5.5 support and added note about supporting both --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b743553..cf3687b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Client-side PSR-7 Oauth1 request signer +# Client-side PSR-7 Oauth1 request signer for PHP `^7.0` [![Build Status](https://travis-ci.org/php-api-clients/psr7-oauth1.svg?branch=master)](https://travis-ci.org/php-api-clients/psr7-oauth1) [![Latest Stable Version](https://poser.pugx.org/api-clients/psr7-oauth1/v/stable.png)](https://packagist.org/packages/api-clients/psr7-oauth1) @@ -15,7 +15,13 @@ To install via [Composer](http://getcomposer.org/), use the command below, it wi composer require api-clients/psr7-oauth1 ``` -In case you want to support both PHP `7.0+` and `5.5+` in your package, we suggest you use the following command: +In case you need to support `5.5+` as well in your package, we suggest you use the following command: + +```bash +composer require api-clients/psr7-oauth1:^1.0 +``` + +However since `1.0` and `2.0` of this package are 100% compatible, we reccomned you use the following command to support both: ```bash composer require "api-clients/psr7-oauth1:^2.0 || ^1.0" From e5a75ed35e2442678ced24b471874e2bfc4333e0 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Fri, 25 Nov 2016 17:37:42 +0100 Subject: [PATCH 8/8] Typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cf3687b..628d4fa 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ In case you need to support `5.5+` as well in your package, we suggest you use t composer require api-clients/psr7-oauth1:^1.0 ``` -However since `1.0` and `2.0` of this package are 100% compatible, we reccomned you use the following command to support both: +However since `1.0` and `2.0` of this package are 100% compatible, we recommend you use the following command to support both: ```bash composer require "api-clients/psr7-oauth1:^2.0 || ^1.0"