diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index a19492b..0089206 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -14,7 +14,9 @@ jobs: composer update --no-interaction --prefer-dist --optimize-autoloader - name: PHPStan - uses: docker://oskarstark/phpstan-ga:0.12.44 + uses: docker://oskarstark/phpstan-ga:0.12.48 + env: + REQUIRE_DEV: true with: entrypoint: /composer/vendor/bin/phpstan args: analyze --no-progress @@ -28,7 +30,7 @@ jobs: uses: actions/checkout@v2 - name: PHP-CS-Fixer - uses: OskarStark/php-cs-fixer-ga@2.16.4.1 + uses: OskarStark/php-cs-fixer-ga@2.16.4 with: args: --dry-run --diff-format udiff @@ -40,6 +42,8 @@ jobs: uses: actions/checkout@v2 - name: Psalm - uses: psalm/psalm-github-actions@master + uses: docker://vimeo/psalm-github-actions:3.17.2 + env: + REQUIRE_DEV: true with: args: --no-progress --show-info=false --stats diff --git a/composer.json b/composer.json index d8772f8..c016cb9 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "require-dev": { "phpunit/phpunit": "^7.5", "php-http/psr7-integration-tests": "^1.0", - "http-interop/http-factory-tests": "dev-master", + "http-interop/http-factory-tests": "^0.8", "symfony/error-handler": "^4.4" }, "provide": { diff --git a/tests/UriTest.php b/tests/UriTest.php index d5f52fa..bb165e8 100644 --- a/tests/UriTest.php +++ b/tests/UriTest.php @@ -126,12 +126,22 @@ public function testWithPortCannotBeNegative() (new Uri())->withPort(-1); } - public function testParseUriPortCannotBeZero() + public function testParseUriPortCannotBeNegative() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Unable to parse URI'); - new Uri('//example.com:0'); + new Uri('//example.com:-1'); + } + + public function testParseUriPortCanBeZero() + { + if (version_compare(PHP_VERSION, '7.4.12') < 0) { + self::markTestSkipped('Skipping this on low PHP versions.'); + } + + $uri = new Uri('//example.com:0'); + $this->assertEquals(0, $uri->getPort()); } public function testSchemeMustHaveCorrectType()