From ae8d49a3203ccf7a1e39aaf7fae9f08bfbc454a2 Mon Sep 17 00:00:00 2001 From: Ignace Nyamagana Butera Date: Wed, 14 Mar 2018 17:25:27 +0100 Subject: [PATCH] Prepare 1.5.0 release - resolve issue #3 - adding PHPStan - update league\uri-components requirement - update package settings (travis,scrutinizr) --- .scrutinizer.yml | 27 ++- .travis.yml | 13 +- CHANGELOG.md | 21 ++ README.md | 9 +- composer.json | 29 ++- phpstan.src.neon | 2 + phpstan.tests.neon | 12 + src/Modifiers/AddBasePath.php | 2 +- src/Modifiers/AddLeadingSlash.php | 2 +- src/Modifiers/AddRootLabel.php | 2 +- src/Modifiers/AddTrailingSlash.php | 2 +- src/Modifiers/AppendLabel.php | 2 +- src/Modifiers/AppendQuery.php | 2 +- src/Modifiers/AppendSegment.php | 2 +- src/Modifiers/Basename.php | 2 +- src/Modifiers/CallableAdapter.php | 2 +- src/Modifiers/DataUriParameters.php | 2 +- src/Modifiers/DataUriToAscii.php | 2 +- src/Modifiers/DataUriToBinary.php | 2 +- src/Modifiers/DecodeUnreservedCharacters.php | 2 +- src/Modifiers/Dirname.php | 2 +- src/Modifiers/Exception.php | 2 +- src/Modifiers/Extension.php | 2 +- src/Modifiers/Formatter.php | 12 +- src/Modifiers/HostMiddlewareTrait.php | 2 +- src/Modifiers/HostToAscii.php | 2 +- src/Modifiers/HostToUnicode.php | 2 +- src/Modifiers/KsortQuery.php | 2 +- src/Modifiers/MergeQuery.php | 2 +- src/Modifiers/Normalize.php | 2 +- src/Modifiers/PathMiddlewareTrait.php | 2 +- src/Modifiers/Pipeline.php | 2 +- src/Modifiers/PrependLabel.php | 2 +- src/Modifiers/PrependSegment.php | 2 +- src/Modifiers/PublicSuffix.php | 2 +- src/Modifiers/QueryMiddlewareTrait.php | 2 +- src/Modifiers/RegisterableDomain.php | 2 +- src/Modifiers/Relativize.php | 2 +- src/Modifiers/RemoveBasePath.php | 2 +- src/Modifiers/RemoveDotSegments.php | 2 +- src/Modifiers/RemoveEmptySegments.php | 2 +- src/Modifiers/RemoveLabels.php | 2 +- src/Modifiers/RemoveLeadingSlash.php | 2 +- src/Modifiers/RemoveQueryKeys.php | 2 +- src/Modifiers/RemoveQueryParams.php | 2 +- src/Modifiers/RemoveRootLabel.php | 2 +- src/Modifiers/RemoveSegments.php | 2 +- src/Modifiers/RemoveTrailingSlash.php | 2 +- src/Modifiers/RemoveZoneIdentifier.php | 2 +- src/Modifiers/ReplaceLabel.php | 2 +- src/Modifiers/ReplaceSegment.php | 2 +- src/Modifiers/Resolve.php | 2 +- src/Modifiers/Subdomain.php | 4 +- src/Modifiers/UriMiddlewareInterface.php | 2 +- src/Modifiers/UriMiddlewareTrait.php | 2 +- src/functions.php | 230 +++++++++---------- tests/HostModifierTest.php | 16 +- tests/PathModifierTest.php | 6 +- 58 files changed, 272 insertions(+), 201 deletions(-) create mode 100644 phpstan.src.neon create mode 100644 phpstan.tests.neon diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 01162324..dc476e93 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,17 +1,32 @@ +build: + nodes: + analysis: + project_setup: + override: true + tests: + override: + - php-scrutinizer-run --enable-security-analysis filter: - paths: [src/*] - excluded_paths: [tests/*] + paths: + - src/ + excluded_paths: + - tests/ checks: php: code_rating: true + duplication: true tools: external_code_coverage: - timeout: 600 + timeout: 3600 runs: 2 php_code_coverage: false php_loc: enabled: true - excluded_dirs: [tests, vendor] - php_cpd: + excluded_dirs: + - tests/ + - vendor/ + php_cpd: false + php_sim: enabled: true - excluded_dirs: [tests, vendor] + filter: + paths: ['src/'] \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index b393c0a1..c1575601 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,13 @@ sudo: false matrix: include: - php: 7.0 - env: COLLECT_COVERAGE=true VALIDATE_CODING_STYLE=true IGNORE_PLATFORMS=false + env: COLLECT_COVERAGE=true VALIDATE_CODING_STYLE=true RUN_PHPSTAN=false IGNORE_PLATFORMS=false - php: 7.1 - env: COLLECT_COVERAGE=true VALIDATE_CODING_STYLE=true IGNORE_PLATFORMS=false + env: COLLECT_COVERAGE=true VALIDATE_CODING_STYLE=true RUN_PHPSTAN=true IGNORE_PLATFORMS=false - php: 7.2 - env: COLLECT_COVERAGE=false VALIDATE_CODING_STYLE=false IGNORE_PLATFORMS=true + env: COLLECT_COVERAGE=false VALIDATE_CODING_STYLE=false RUN_PHPSTAN=false IGNORE_PLATFORMS=false - php: nightly - env: COLLECT_COVERAGE=false VALIDATE_CODING_STYLE=false IGNORE_PLATFORMS=true + env: COLLECT_COVERAGE=false VALIDATE_CODING_STYLE=false RUN_PHPSTAN=false IGNORE_PLATFORMS=true allow_failures: - php: nightly fast_finish: true @@ -29,7 +29,8 @@ install: script: - composer phpunit + - if [ "$VALIDATE_CODING_STYLE" == "true" ]; then composer phpcs; fi + - if [ "$RUN_PHPSTAN" == "true" ]; then composer phpstan; fi after_script: - - if [ "$COLLECT_COVERAGE" == "true" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/clover.xml; fi - - if [ "$VALIDATE_CODING_STYLE" == "true" ]; then composer phpcs; fi \ No newline at end of file + - if [ "$COLLECT_COVERAGE" == "true" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/clover.xml; fi diff --git a/CHANGELOG.md b/CHANGELOG.md index d4e2e36e..7af33339 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,27 @@ - All Notable changes to `uri-manipulations` will be documented in this file +## 1.5.0 - 2018-03-14 + +### Added + +- None + +### Fixed + +- `League\Uri\Modifiers\Formatter::format` with Opaque URI. +- the library now requires `League\Uri\Components` 1.8.x +- Using PHPStan +- bug fix issue [#3](https://github.com/thephpleague/uri-manipulations/issues/3) + +### Deprecated + +- None + +### Removed + +- `mbstring` extension requirement + ## 1.4.0 - 2018-02-06 ### Added diff --git a/README.md b/README.md index 2e900f13..c78395f3 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ System Requirements You need: - **PHP >= 7.0** but the latest stable version of PHP is recommended -- the `mbstring` extension - the `intl` extension Dependencies @@ -42,7 +41,13 @@ Full documentation can be found at [uri.thephpleague.com](http://uri.thephpleagu Testing ------- -`League URI Manipulation` has a [PHPUnit](https://phpunit.de) test suite and a coding style compliance test suite using [PHP CS Fixer](http://cs.sensiolabs.org/). To run the tests, run the following command from the project folder. +`League Uri Manipulations` has a : + +- a [PHPUnit](https://phpunit.de) test suite +- a coding style compliance test suite using [PHP CS Fixer](http://cs.sensiolabs.org/). +- a code analysis compliance test suite using [PHPStan](https://github.com/phpstan/phpstan). + +To run the tests, run the following command from the project folder. ``` bash $ composer test diff --git a/composer.json b/composer.json index a0006046..11968d07 100644 --- a/composer.json +++ b/composer.json @@ -30,16 +30,20 @@ }, "minimun-stability" : "dev", "require": { - "league/uri-components": "^1.7.0", - "league/uri-interfaces": "^1.0", "php" : ">=7.0", + "ext-intl" : "*", + "league/uri-components": "^1.8.0", + "league/uri-interfaces": "^1.0", "psr/http-message": "^1.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.0", "guzzlehttp/psr7": "^1.2", - "league/uri-schemes": "^1.0", + "league/uri-schemes": "^1.2", "phpunit/phpunit": "^6.0", + "phpstan/phpstan": "^0.9.2", + "phpstan/phpstan-strict-rules": "^0.9.0", + "phpstan/phpstan-phpunit": "^0.9.4", "zendframework/zend-diactoros": "1.4.0" }, "autoload": { @@ -57,15 +61,26 @@ "league/uri-schemes": "Allow manipulating URI objects" }, "scripts": { + "phpcs": "php-cs-fixer fix -v --diff --dry-run --allow-risky=yes;", + "phpstan-src": "phpstan analyse -l 7 -c phpstan.src.neon src", + "phpstan-tests": "phpstan analyse -l 7 -c phpstan.tests.neon tests", + "phpstan": [ + "@phpstan-src", + "@phpstan-tests" + ], + "phpunit": "phpunit --coverage-text", "post-install-cmd": "\\League\\Uri\\Installer\\ICANNSection::update", "post-update-cmd": "\\League\\Uri\\Installer\\ICANNSection::update", - "test": "phpunit --coverage-text; php-cs-fixer fix -v --diff --dry-run --allow-risky=yes;", - "phpunit": "phpunit --coverage-text", - "phpcs": "php-cs-fixer fix -v --diff --dry-run --allow-risky=yes;" + "test": [ + "@phpunit", + "@phpcs", + "@phpstan-src", + "@phpstan-tests" + ] }, "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.x-dev" } }, "config": { diff --git a/phpstan.src.neon b/phpstan.src.neon new file mode 100644 index 00000000..ee6abb0e --- /dev/null +++ b/phpstan.src.neon @@ -0,0 +1,2 @@ +includes: +- vendor/phpstan/phpstan-strict-rules/rules.neon \ No newline at end of file diff --git a/phpstan.tests.neon b/phpstan.tests.neon new file mode 100644 index 00000000..7caeaa1f --- /dev/null +++ b/phpstan.tests.neon @@ -0,0 +1,12 @@ +includes: + - vendor/phpstan/phpstan-strict-rules/rules.neon + - vendor/phpstan/phpstan-phpunit/extension.neon + - vendor/phpstan/phpstan-phpunit/rules.neon + - vendor/phpstan/phpstan-phpunit/strictRules.neon +parameters: + ignoreErrors: + - '#Parameter \#1 \$uri of function League\\Uri\\resolve expects League\\Uri\\Interfaces\\Uri|Psr\\Http\\Message\\UriInterface, string given.#' + - '#Access to an undefined property League\\Uri\\Components\\Query::\$unknownProperty.#' + - '#Parameter \#1 \$offsets of method League\\Uri\\Components\\HierarchicalPath::withoutSegments\(\) expects array, array given.#' + - '#Parameter \#2 \$sort of function League\\Uri\\sort_query expects callable|int, array given.#' + reportUnmatchedIgnoredErrors: false \ No newline at end of file diff --git a/src/Modifiers/AddBasePath.php b/src/Modifiers/AddBasePath.php index 9491db39..c97c44ee 100644 --- a/src/Modifiers/AddBasePath.php +++ b/src/Modifiers/AddBasePath.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/AddLeadingSlash.php b/src/Modifiers/AddLeadingSlash.php index afa5ed54..066239ff 100644 --- a/src/Modifiers/AddLeadingSlash.php +++ b/src/Modifiers/AddLeadingSlash.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/AddRootLabel.php b/src/Modifiers/AddRootLabel.php index 23ffd8d7..51a0d127 100644 --- a/src/Modifiers/AddRootLabel.php +++ b/src/Modifiers/AddRootLabel.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/AddTrailingSlash.php b/src/Modifiers/AddTrailingSlash.php index ddba1bc2..7dabc3ca 100644 --- a/src/Modifiers/AddTrailingSlash.php +++ b/src/Modifiers/AddTrailingSlash.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/AppendLabel.php b/src/Modifiers/AppendLabel.php index b2d05236..ab761399 100644 --- a/src/Modifiers/AppendLabel.php +++ b/src/Modifiers/AppendLabel.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/AppendQuery.php b/src/Modifiers/AppendQuery.php index 6097495a..967b797c 100644 --- a/src/Modifiers/AppendQuery.php +++ b/src/Modifiers/AppendQuery.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/AppendSegment.php b/src/Modifiers/AppendSegment.php index 09d39926..a850174a 100644 --- a/src/Modifiers/AppendSegment.php +++ b/src/Modifiers/AppendSegment.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/Basename.php b/src/Modifiers/Basename.php index faaca295..b85c6c45 100644 --- a/src/Modifiers/Basename.php +++ b/src/Modifiers/Basename.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/CallableAdapter.php b/src/Modifiers/CallableAdapter.php index 76de14d3..ea08c70c 100644 --- a/src/Modifiers/CallableAdapter.php +++ b/src/Modifiers/CallableAdapter.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/DataUriParameters.php b/src/Modifiers/DataUriParameters.php index f8c89d3d..c4dd854f 100644 --- a/src/Modifiers/DataUriParameters.php +++ b/src/Modifiers/DataUriParameters.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/DataUriToAscii.php b/src/Modifiers/DataUriToAscii.php index a4827a1c..fc40b0d9 100644 --- a/src/Modifiers/DataUriToAscii.php +++ b/src/Modifiers/DataUriToAscii.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/DataUriToBinary.php b/src/Modifiers/DataUriToBinary.php index 98c3b4ab..c7ca4b3e 100644 --- a/src/Modifiers/DataUriToBinary.php +++ b/src/Modifiers/DataUriToBinary.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/DecodeUnreservedCharacters.php b/src/Modifiers/DecodeUnreservedCharacters.php index 8f2634ce..c398f38e 100644 --- a/src/Modifiers/DecodeUnreservedCharacters.php +++ b/src/Modifiers/DecodeUnreservedCharacters.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/Dirname.php b/src/Modifiers/Dirname.php index aa7231b5..bc9105e6 100644 --- a/src/Modifiers/Dirname.php +++ b/src/Modifiers/Dirname.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/Exception.php b/src/Modifiers/Exception.php index 01a8fa64..7450645f 100644 --- a/src/Modifiers/Exception.php +++ b/src/Modifiers/Exception.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/Extension.php b/src/Modifiers/Extension.php index ea2ffb1d..004141fc 100644 --- a/src/Modifiers/Extension.php +++ b/src/Modifiers/Extension.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/Formatter.php b/src/Modifiers/Formatter.php index 3794b3aa..a0717a5b 100644 --- a/src/Modifiers/Formatter.php +++ b/src/Modifiers/Formatter.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); @@ -139,7 +139,7 @@ public function preserveFragment(bool $status) *
  • Psr\Http\Message\UriInterface * * - * @param Component|Uri|UriInterface $input + * @param mixed $input * * @return string */ @@ -165,7 +165,7 @@ public function __invoke($input) * * @see __invoke() * - * @param Component|Uri|UriInterface $input + * @param mixed $input * * @return string */ @@ -177,7 +177,7 @@ public function format($input) /** * Format an Uri according to the Formatter properties * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * * @return string */ @@ -207,13 +207,13 @@ protected function formatUri($uri): string } $path = (new Path($uri->getPath()))->getContent($this->enc_type); - if (!in_array('', [$authority, $path]) && '/' != $path[0]) { + if (null !== $authority && '' !== $path && '/' !== $path[0]) { $path = '/'.$path; } $query = $uri->getQuery(); if ('' != $query || $this->preserve_query) { - $query = '?'.Uri\build_query(Uri\parse_query((string) $query), $this->query_separator, $this->enc_type); + $query = '?'.Uri\build_query(Uri\parse_query($query), $this->query_separator, $this->enc_type); } $fragment = $uri->getFragment(); diff --git a/src/Modifiers/HostMiddlewareTrait.php b/src/Modifiers/HostMiddlewareTrait.php index 0afc6bfd..1158200a 100644 --- a/src/Modifiers/HostMiddlewareTrait.php +++ b/src/Modifiers/HostMiddlewareTrait.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ diff --git a/src/Modifiers/HostToAscii.php b/src/Modifiers/HostToAscii.php index 3bb09dc6..70c9f16c 100644 --- a/src/Modifiers/HostToAscii.php +++ b/src/Modifiers/HostToAscii.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/HostToUnicode.php b/src/Modifiers/HostToUnicode.php index 0cf6b2ee..5831c516 100644 --- a/src/Modifiers/HostToUnicode.php +++ b/src/Modifiers/HostToUnicode.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/KsortQuery.php b/src/Modifiers/KsortQuery.php index f31dc945..7a5c437e 100644 --- a/src/Modifiers/KsortQuery.php +++ b/src/Modifiers/KsortQuery.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/MergeQuery.php b/src/Modifiers/MergeQuery.php index 688f4754..eb0ab4e5 100644 --- a/src/Modifiers/MergeQuery.php +++ b/src/Modifiers/MergeQuery.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/Normalize.php b/src/Modifiers/Normalize.php index 803789d6..82caa550 100644 --- a/src/Modifiers/Normalize.php +++ b/src/Modifiers/Normalize.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/PathMiddlewareTrait.php b/src/Modifiers/PathMiddlewareTrait.php index d2ecb521..a1c7b114 100644 --- a/src/Modifiers/PathMiddlewareTrait.php +++ b/src/Modifiers/PathMiddlewareTrait.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ diff --git a/src/Modifiers/Pipeline.php b/src/Modifiers/Pipeline.php index 4e4e18cf..1bcc4543 100644 --- a/src/Modifiers/Pipeline.php +++ b/src/Modifiers/Pipeline.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/PrependLabel.php b/src/Modifiers/PrependLabel.php index ff8e173e..37d5ba22 100644 --- a/src/Modifiers/PrependLabel.php +++ b/src/Modifiers/PrependLabel.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/PrependSegment.php b/src/Modifiers/PrependSegment.php index 2c2158e2..850c7264 100644 --- a/src/Modifiers/PrependSegment.php +++ b/src/Modifiers/PrependSegment.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/PublicSuffix.php b/src/Modifiers/PublicSuffix.php index eeb49a33..dd0489b6 100644 --- a/src/Modifiers/PublicSuffix.php +++ b/src/Modifiers/PublicSuffix.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/QueryMiddlewareTrait.php b/src/Modifiers/QueryMiddlewareTrait.php index 52246a6f..4dcee146 100644 --- a/src/Modifiers/QueryMiddlewareTrait.php +++ b/src/Modifiers/QueryMiddlewareTrait.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ diff --git a/src/Modifiers/RegisterableDomain.php b/src/Modifiers/RegisterableDomain.php index 716e6074..14284fd5 100644 --- a/src/Modifiers/RegisterableDomain.php +++ b/src/Modifiers/RegisterableDomain.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/Relativize.php b/src/Modifiers/Relativize.php index dcca84a9..feea8c1e 100644 --- a/src/Modifiers/Relativize.php +++ b/src/Modifiers/Relativize.php @@ -160,7 +160,7 @@ protected function formatPath(string $path): string { if ('' === $path) { $base_path = $this->base_uri->getPath(); - return in_array($base_path, ['', '/']) ? $base_path : './'; + return in_array($base_path, ['', '/'], true) ? $base_path : './'; } if (false === ($colon_pos = strpos($path, ':'))) { diff --git a/src/Modifiers/RemoveBasePath.php b/src/Modifiers/RemoveBasePath.php index 28da261f..ee60ef15 100644 --- a/src/Modifiers/RemoveBasePath.php +++ b/src/Modifiers/RemoveBasePath.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/RemoveDotSegments.php b/src/Modifiers/RemoveDotSegments.php index fde4455d..6d6aec9b 100644 --- a/src/Modifiers/RemoveDotSegments.php +++ b/src/Modifiers/RemoveDotSegments.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/RemoveEmptySegments.php b/src/Modifiers/RemoveEmptySegments.php index d6e0b28d..09b684fc 100644 --- a/src/Modifiers/RemoveEmptySegments.php +++ b/src/Modifiers/RemoveEmptySegments.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/RemoveLabels.php b/src/Modifiers/RemoveLabels.php index b3e6dabb..0f5859d6 100644 --- a/src/Modifiers/RemoveLabels.php +++ b/src/Modifiers/RemoveLabels.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/RemoveLeadingSlash.php b/src/Modifiers/RemoveLeadingSlash.php index c8ab41d0..fd345292 100644 --- a/src/Modifiers/RemoveLeadingSlash.php +++ b/src/Modifiers/RemoveLeadingSlash.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/RemoveQueryKeys.php b/src/Modifiers/RemoveQueryKeys.php index a23ee37d..5424b93d 100644 --- a/src/Modifiers/RemoveQueryKeys.php +++ b/src/Modifiers/RemoveQueryKeys.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/RemoveQueryParams.php b/src/Modifiers/RemoveQueryParams.php index 60cdf70c..c0a6d331 100644 --- a/src/Modifiers/RemoveQueryParams.php +++ b/src/Modifiers/RemoveQueryParams.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/RemoveRootLabel.php b/src/Modifiers/RemoveRootLabel.php index 0999fdb5..a2c3041f 100644 --- a/src/Modifiers/RemoveRootLabel.php +++ b/src/Modifiers/RemoveRootLabel.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/RemoveSegments.php b/src/Modifiers/RemoveSegments.php index a1de4fa9..97af9f46 100644 --- a/src/Modifiers/RemoveSegments.php +++ b/src/Modifiers/RemoveSegments.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/RemoveTrailingSlash.php b/src/Modifiers/RemoveTrailingSlash.php index df5098f7..0426535b 100644 --- a/src/Modifiers/RemoveTrailingSlash.php +++ b/src/Modifiers/RemoveTrailingSlash.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/RemoveZoneIdentifier.php b/src/Modifiers/RemoveZoneIdentifier.php index 6981ba02..a164d55f 100644 --- a/src/Modifiers/RemoveZoneIdentifier.php +++ b/src/Modifiers/RemoveZoneIdentifier.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/ReplaceLabel.php b/src/Modifiers/ReplaceLabel.php index 6319319e..fb3d7f80 100644 --- a/src/Modifiers/ReplaceLabel.php +++ b/src/Modifiers/ReplaceLabel.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/ReplaceSegment.php b/src/Modifiers/ReplaceSegment.php index ccf8ee51..d24b75ea 100644 --- a/src/Modifiers/ReplaceSegment.php +++ b/src/Modifiers/ReplaceSegment.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/Resolve.php b/src/Modifiers/Resolve.php index 6597e91d..5e25266a 100644 --- a/src/Modifiers/Resolve.php +++ b/src/Modifiers/Resolve.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); diff --git a/src/Modifiers/Subdomain.php b/src/Modifiers/Subdomain.php index efb56e28..28e12ad2 100644 --- a/src/Modifiers/Subdomain.php +++ b/src/Modifiers/Subdomain.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); @@ -68,6 +68,6 @@ public function __construct(string $label, Rules $resolver = null) */ protected function modifyHost(string $str): string { - return (string) $this->filterHost($str, $this->resolver)->withSubdomain($this->label); + return (string) $this->filterHost($str, $this->resolver)->withSubDomain($this->label); } } diff --git a/src/Modifiers/UriMiddlewareInterface.php b/src/Modifiers/UriMiddlewareInterface.php index 87328559..6c27218f 100644 --- a/src/Modifiers/UriMiddlewareInterface.php +++ b/src/Modifiers/UriMiddlewareInterface.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ diff --git a/src/Modifiers/UriMiddlewareTrait.php b/src/Modifiers/UriMiddlewareTrait.php index f1458587..17f3906b 100644 --- a/src/Modifiers/UriMiddlewareTrait.php +++ b/src/Modifiers/UriMiddlewareTrait.php @@ -7,7 +7,7 @@ * @author Ignace Nyamagana Butera * @copyright 2016 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ diff --git a/src/functions.php b/src/functions.php index 3a05ca0e..a6b48805 100644 --- a/src/functions.php +++ b/src/functions.php @@ -7,14 +7,14 @@ * @author Ignace Nyamagana Butera * @copyright 2017 Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-manipulations/blob/master/LICENSE (MIT License) - * @version 1.4.0 + * @version 1.5.0 * @link https://github.com/thephpleague/uri-manipulations */ declare(strict_types=1); namespace League\Uri; -use League\Uri\Interfaces\Uri; +use League\Uri\Interfaces\Uri as LeagueUriInterface; use League\Uri\PublicSuffix\Rules; use Psr\Http\Message\UriInterface; @@ -23,10 +23,10 @@ * * @see Modifiers\AddBasePath::modifyPath() * - * @param Uri|UriInterface $uri - * @param string $path + * @param LeagueUriInterface|UriInterface $uri + * @param string $path * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function add_basepath($uri, string $path) { @@ -38,9 +38,9 @@ function add_basepath($uri, string $path) * * @see Modifiers\AddLeadingSlash::modifyPath() * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function add_leading_slash($uri) { @@ -56,9 +56,9 @@ function add_leading_slash($uri) * * @see Modifiers\AddRootLabel::modifyHost() * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function add_root_label($uri) { @@ -74,9 +74,9 @@ function add_root_label($uri) * * @see Modifiers\AddTrailingSlash::modifyPath() * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function add_trailing_slash($uri) { @@ -88,10 +88,10 @@ function add_trailing_slash($uri) * * @see Modifiers\AppendLabel::modifyHost() * - * @param Uri|UriInterface $uri - * @param string $host + * @param LeagueUriInterface|UriInterface $uri + * @param string $host * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function append_host($uri, string $host) { @@ -103,10 +103,10 @@ function append_host($uri, string $host) * * @see Modifiers\AppendSegment::modifyPath() * - * @param Uri|UriInterface $uri - * @param string $path + * @param LeagueUriInterface|UriInterface $uri + * @param string $path * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function append_path($uri, string $path) { @@ -118,10 +118,10 @@ function append_path($uri, string $path) * * @see Modifiers\AppendQuery::modifyQuery() * - * @param Uri|UriInterface $uri - * @param string $query + * @param LeagueUriInterface|UriInterface $uri + * @param string $query * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function append_query($uri, string $query) { @@ -133,9 +133,9 @@ function append_query($uri, string $query) * * @see Modifiers\HostToAscii::modifyHost() * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function host_to_ascii($uri) { @@ -151,9 +151,9 @@ function host_to_ascii($uri) * * @see Modifiers\HostToUnicode::modifyHost() * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function host_to_unicode($uri) { @@ -167,7 +167,7 @@ function host_to_unicode($uri) /** * Tell whether the URI represents an absolute URI * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * * @return bool */ @@ -179,7 +179,7 @@ function is_absolute($uri): bool /** * Tell whether the URI represents an absolute path * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * * @return bool */ @@ -195,7 +195,7 @@ function is_absolute_path($uri): bool /** * Tell whether the URI represents a network path * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * * @return bool */ @@ -210,7 +210,7 @@ function is_network_path($uri): bool /** * Tell whether the URI represents a relative path * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * * @return bool */ @@ -226,8 +226,8 @@ function is_relative_path($uri): bool /** * Tell whether both URI refers to the same document * - * @param Uri|UriInterface $uri - * @param Uri|UriInterface $base_uri + * @param LeagueUriInterface|UriInterface $uri + * @param LeagueUriInterface|UriInterface $base_uri * * @return bool */ @@ -242,10 +242,10 @@ function is_same_document($uri, $base_uri): bool * * @see Modifiers\MergeQuery::modifyQuery() * - * @param Uri|UriInterface $uri - * @param string $query + * @param LeagueUriInterface|UriInterface $uri + * @param string $query * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function merge_query($uri, string $query) { @@ -255,9 +255,9 @@ function merge_query($uri, string $query) /** * Normalize an URI for comparison * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function normalize($uri) { @@ -273,9 +273,9 @@ function normalize($uri) * * @see Modifiers\DataUriToAscii::modifyPath() * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function path_to_ascii($uri) { @@ -291,9 +291,9 @@ function path_to_ascii($uri) * * @see Modifiers\DataUriToBinary::modifyPath() * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function path_to_binary($uri) { @@ -309,10 +309,10 @@ function path_to_binary($uri) * * @see Modifiers\PrependLabel::modifyHost() * - * @param Uri|UriInterface $uri - * @param string $host + * @param LeagueUriInterface|UriInterface $uri + * @param string $host * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function prepend_host($uri, string $host) { @@ -324,10 +324,10 @@ function prepend_host($uri, string $host) * * @see Modifiers\PrependSegment::modifyPath() * - * @param Uri|UriInterface $uri - * @param string $path + * @param LeagueUriInterface|UriInterface $uri + * @param string $path * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function prepend_path($uri, string $path) { @@ -339,10 +339,10 @@ function prepend_path($uri, string $path) * * @see Modifiers\Relativize::process() * - * @param Uri|UriInterface $uri - * @param Uri|UriInterface $base_uri + * @param LeagueUriInterface|UriInterface $uri + * @param LeagueUriInterface|UriInterface $base_uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function relativize($uri, $base_uri) { @@ -354,10 +354,10 @@ function relativize($uri, $base_uri) * * @see Modifiers\RemoveBasePath::modifyPath() * - * @param Uri|UriInterface $uri - * @param string $path + * @param LeagueUriInterface|UriInterface $uri + * @param string $path * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function remove_basepath($uri, string $path) { @@ -369,9 +369,9 @@ function remove_basepath($uri, string $path) * * @see Modifiers\RemoveDotSegments::modifyPath() * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function remove_dot_segments($uri) { @@ -387,9 +387,9 @@ function remove_dot_segments($uri) * * @see Modifiers\RemoveEmptySegments::modifyPath() * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function remove_empty_segments($uri) { @@ -405,10 +405,10 @@ function remove_empty_segments($uri) * * @see Modifiers\RemoveLabels::modifyHost() * - * @param Uri|UriInterface $uri - * @param int[] $keys + * @param LeagueUriInterface|UriInterface $uri + * @param int[] $keys * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function remove_labels($uri, array $keys) { @@ -420,9 +420,9 @@ function remove_labels($uri, array $keys) * * @see Modifiers\RemoveLeadingSlash::modifyPath() * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function remove_leading_slash($uri) { @@ -438,10 +438,10 @@ function remove_leading_slash($uri) * * @see Modifiers\RemoveQueryParams::modifyQuery() * - * @param Uri|UriInterface $uri - * @param string[] $keys + * @param LeagueUriInterface|UriInterface $uri + * @param string[] $keys * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function remove_params($uri, array $keys) { @@ -453,10 +453,10 @@ function remove_params($uri, array $keys) * * @see Modifiers\RemoveQueryKeys::modifyQuery() * - * @param Uri|UriInterface $uri - * @param string[] $keys + * @param LeagueUriInterface|UriInterface $uri + * @param string[] $keys * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function remove_pairs($uri, array $keys) { @@ -468,9 +468,9 @@ function remove_pairs($uri, array $keys) * * @see Modifiers\RemoveRootLabel::modifyHost() * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function remove_root_label($uri) { @@ -486,9 +486,9 @@ function remove_root_label($uri) * * @see Modifiers\RemoveTrailingSlash::modifyPath() * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function remove_trailing_slash($uri) { @@ -504,10 +504,10 @@ function remove_trailing_slash($uri) * * @see Modifiers\RemoveSegments::modifyPath() * - * @param Uri|UriInterface $uri - * @param int[] $keys + * @param LeagueUriInterface|UriInterface $uri + * @param int[] $keys * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function remove_segments($uri, array $keys) { @@ -519,9 +519,9 @@ function remove_segments($uri, array $keys) * * @see Modifiers\RemoveZoneIdentifier::modifyHost() * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function remove_zone_id($uri) { @@ -537,10 +537,10 @@ function remove_zone_id($uri) * * @see Modifiers\Basename::modifyPath() * - * @param Uri|UriInterface $uri - * @param string $path + * @param LeagueUriInterface|UriInterface $uri + * @param string $path * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function replace_basename($uri, string $path) { @@ -552,10 +552,10 @@ function replace_basename($uri, string $path) * * @see Modifiers\DataUriParameters::modifyPath() * - * @param Uri|UriInterface $uri - * @param string $parameters + * @param LeagueUriInterface|UriInterface $uri + * @param string $parameters * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function replace_data_uri_parameters($uri, string $parameters) { @@ -567,10 +567,10 @@ function replace_data_uri_parameters($uri, string $parameters) * * @see Modifiers\Dirname::modifyPath() * - * @param Uri|UriInterface $uri - * @param string $path + * @param LeagueUriInterface|UriInterface $uri + * @param string $path * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function replace_dirname($uri, string $path) { @@ -582,10 +582,10 @@ function replace_dirname($uri, string $path) * * @see Modifiers\Extension::modifyPath() * - * @param Uri|UriInterface $uri - * @param string $extension + * @param LeagueUriInterface|UriInterface $uri + * @param string $extension * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function replace_extension($uri, string $extension) { @@ -597,11 +597,11 @@ function replace_extension($uri, string $extension) * * @see Modifiers\ReplaceLabel::modifyHost() * - * @param Uri|UriInterface $uri - * @param int $offset - * @param string $host + * @param LeagueUriInterface|UriInterface $uri + * @param int $offset + * @param string $host * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function replace_label($uri, int $offset, string $host) { @@ -613,11 +613,11 @@ function replace_label($uri, int $offset, string $host) * * @see Modifiers\PublicSuffix::modifyHost() * - * @param Uri|UriInterface $uri - * @param string $host - * @param null|Rules $resolver + * @param LeagueUriInterface|UriInterface $uri + * @param string $host + * @param null|Rules $resolver * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function replace_publicsuffix($uri, string $host, Rules $resolver = null) { @@ -629,11 +629,11 @@ function replace_publicsuffix($uri, string $host, Rules $resolver = null) * * @see Modifiers\RegisterableDomain::modifyHost() * - * @param Uri|UriInterface $uri - * @param string $host - * @param null|Rules $resolver + * @param LeagueUriInterface|UriInterface $uri + * @param string $host + * @param null|Rules $resolver * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function replace_registrabledomain($uri, string $host, Rules $resolver = null) { @@ -645,11 +645,11 @@ function replace_registrabledomain($uri, string $host, Rules $resolver = null) * * @see Modifiers\PrependSegment::modifyPath() * - * @param Uri|UriInterface $uri - * @param int $offset - * @param string $path + * @param LeagueUriInterface|UriInterface $uri + * @param int $offset + * @param string $path * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function replace_segment($uri, int $offset, string $path) { @@ -661,11 +661,11 @@ function replace_segment($uri, int $offset, string $path) * * @see Modifiers\Subdomain::modifyHost() * - * @param Uri|UriInterface $uri - * @param string $host - * @param null|Rules $resolver + * @param LeagueUriInterface|UriInterface $uri + * @param string $host + * @param null|Rules $resolver * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function replace_subdomain($uri, string $host, Rules $resolver = null) { @@ -677,10 +677,10 @@ function replace_subdomain($uri, string $host, Rules $resolver = null) * * @see Modifiers\Resolve::process() * - * @param Uri|UriInterface $uri - * @param Uri|UriInterface $base_uri + * @param LeagueUriInterface|UriInterface $uri + * @param LeagueUriInterface|UriInterface $base_uri * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function resolve($uri, $base_uri) { @@ -692,10 +692,10 @@ function resolve($uri, $base_uri) * * @see Modifiers\KsortQuery::modifyQuery() * - * @param Uri|UriInterface $uri - * @param int|callable $sort The algorithm used to sort the query keys + * @param LeagueUriInterface|UriInterface $uri + * @param int|callable $sort The algorithm used to sort the query keys * - * @return Uri|UriInterface + * @return LeagueUriInterface|UriInterface */ function sort_query($uri, $sort = SORT_REGULAR) { @@ -705,7 +705,7 @@ function sort_query($uri, $sort = SORT_REGULAR) /** * Returns the RFC3986 string representation of the given URI object * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * * @return string */ @@ -725,7 +725,7 @@ function uri_to_rfc3986($uri) /** * Returns the RFC3987 string representation of the given URI object * - * @param Uri|UriInterface $uri + * @param LeagueUriInterface|UriInterface $uri * * @return string */ diff --git a/tests/HostModifierTest.php b/tests/HostModifierTest.php index e71bdb78..e3a991d3 100644 --- a/tests/HostModifierTest.php +++ b/tests/HostModifierTest.php @@ -121,7 +121,7 @@ public function testWithoutZoneIdentifierProcess() $uri = Http::createFromString('http://[fe80::1234%25eth0-1]/path/to/the/sky.php'); $this->assertSame( 'http://[fe80::1234]/path/to/the/sky.php', - (string) (string) Uri\remove_zone_id($uri) + (string) Uri\remove_zone_id($uri) ); } @@ -153,7 +153,7 @@ public function validWithoutLabelsProvider() */ public function testRemoveLabels() { - $this->assertSame('example.com', (string) Uri\remove_labels($this->uri, [2])->getHost()); + $this->assertSame('example.com', Uri\remove_labels($this->uri, [2])->getHost()); } /** @@ -164,7 +164,7 @@ public function testRemoveLabels() * * @dataProvider invalidRemoveLabelsParameters * - * @param mixed $params + * @param array $params */ public function testRemoveLabelsFailedConstructor(array $params) { @@ -185,7 +185,7 @@ public function invalidRemoveLabelsParameters() */ public function testSubdomain() { - $this->assertSame('shop.example.com', (string) Uri\replace_subdomain($this->uri, 'shop')->getHost()); + $this->assertSame('shop.example.com', Uri\replace_subdomain($this->uri, 'shop')->getHost()); } /** @@ -194,7 +194,7 @@ public function testSubdomain() */ public function testRegisterableDomain() { - $this->assertSame('www.ulb.ac.be', (string) Uri\replace_registrabledomain($this->uri, 'ulb.ac.be')->getHost()); + $this->assertSame('www.ulb.ac.be', Uri\replace_registrabledomain($this->uri, 'ulb.ac.be')->getHost()); } /** @@ -203,7 +203,7 @@ public function testRegisterableDomain() */ public function testPublicSuffix() { - $this->assertSame('www.example.fr', (string) Uri\replace_publicsuffix($this->uri, 'fr')->getHost()); + $this->assertSame('www.example.fr', Uri\replace_publicsuffix($this->uri, 'fr')->getHost()); } /** @@ -212,7 +212,7 @@ public function testPublicSuffix() */ public function testAddRootLabel() { - $this->assertSame('www.example.com.', (string) Uri\add_root_label($this->uri)->getHost()); + $this->assertSame('www.example.com.', Uri\add_root_label($this->uri)->getHost()); } /** @@ -221,7 +221,7 @@ public function testAddRootLabel() */ public function testRemoveRootLabel() { - $this->assertSame('www.example.com', (string) Uri\remove_root_label($this->uri)->getHost()); + $this->assertSame('www.example.com', Uri\remove_root_label($this->uri)->getHost()); } /** diff --git a/tests/PathModifierTest.php b/tests/PathModifierTest.php index 173497ac..90f00e77 100644 --- a/tests/PathModifierTest.php +++ b/tests/PathModifierTest.php @@ -49,8 +49,8 @@ public function testToBinary(Data $binary, Data $ascii) * * @dataProvider fileProvider * - * @param DataUri $binary - * @param DataUri $ascii + * @param Data $binary + * @param Data $ascii */ public function testToAscii(Data $binary, Data $ascii) { @@ -84,7 +84,7 @@ public function testDataUriWithParameters() $uri = Data::createFromString('data:text/plain;charset=us-ascii,Bonjour%20le%20monde!'); $this->assertSame( 'text/plain;coco=chanel,Bonjour%20le%20monde!', - (string)Uri\replace_data_uri_parameters($uri, 'coco=chanel')->getPath() + Uri\replace_data_uri_parameters($uri, 'coco=chanel')->getPath() ); }