diff --git a/DataTest.php b/DataTest.php index 9f7f4141..54c7e269 100644 --- a/DataTest.php +++ b/DataTest.php @@ -45,7 +45,7 @@ public function testCreateFromString(string $uri, string $path): void self::assertSame($path, Uri::createFromString($uri)->getPath()); } - public function validUrlProvider(): array + public static function validUrlProvider(): array { return [ 'simple string' => [ @@ -84,7 +84,7 @@ public function testCreateFromStringFailed(string $uri): void Uri::createFromString($uri); } - public function invalidUrlProvider(): array + public static function invalidUrlProvider(): array { return [ 'invalid data' => ['data:image/png;base64,°28'], @@ -105,7 +105,7 @@ public function testCreateFromStringFailedWithWrongComponent(string $uri): void Uri::createFromString($uri); } - public function invalidComponentProvider(): array + public static function invalidComponentProvider(): array { return [ 'invalid data' => ['data:image/png;base64,zzz28'], diff --git a/FactoryTest.php b/FactoryTest.php index 4eb6fce6..e68de4b2 100644 --- a/FactoryTest.php +++ b/FactoryTest.php @@ -31,7 +31,7 @@ public function testCreateFromPathFailed(string $path): void Uri::createFromDataPath($path); } - public function invalidDataPath(): array + public static function invalidDataPath(): array { return [ 'invalid format' => ['/usr/bin/yeah'], @@ -56,7 +56,7 @@ public function testCreateFromPath(string $path, string $expected): void self::assertStringContainsString($expected, $uri->getPath()); } - public function validFilePath(): array + public static function validFilePath(): array { return [ 'text file' => ['hello-world.txt', 'text/plain'], @@ -74,7 +74,7 @@ public function testCreateFromUnixPath(string $uri, string $expected): void self::assertSame($expected, (string) Uri::createFromUnixPath($uri)); } - public function unixpathProvider(): array + public static function unixpathProvider(): array { return [ 'relative path' => [ @@ -110,7 +110,7 @@ public function testCreateFromWindowsLocalPath(string $uri, string $expected): v self::assertSame($expected, (string) Uri::createFromWindowsPath($uri)); } - public function windowLocalPathProvider(): array + public static function windowLocalPathProvider(): array { return [ 'relative path' => [ @@ -180,7 +180,7 @@ public function testCreateFromServer(string $expected, array $input): void self::assertSame($expected, (string) Http::createFromServer($input)); } - public function validServerArray(): array + public static function validServerArray(): array { return [ 'with host' => [ @@ -364,7 +364,8 @@ public function testCreateFromBaseUri(string $base_uri, string $uri, string $exp { self::assertSame($expected, (string) Uri::createFromBaseUri($uri, $base_uri)); } - public function createProvider(): array + + public static function createProvider(): array { $base_uri = 'http://a/b/c/d;p?q'; diff --git a/FileTest.php b/FileTest.php index de80a99c..6a4683ce 100644 --- a/FileTest.php +++ b/FileTest.php @@ -42,7 +42,7 @@ public function testCreateFromString(string $uri, string $expected): void self::assertSame($expected, (string) Uri::createFromString($uri)); } - public function validUrlProvider(): array + public static function validUrlProvider(): array { return [ 'relative path' => [ @@ -99,7 +99,7 @@ public function testConstructorThrowsException(string $uri): void Uri::createFromString($uri); } - public function invalidUrlProvider(): array + public static function invalidUrlProvider(): array { return [ 'no authority 1' => ['file:example.com'], diff --git a/FtpTest.php b/FtpTest.php index 7a1259ae..0b62c30d 100644 --- a/FtpTest.php +++ b/FtpTest.php @@ -29,7 +29,7 @@ public function testCreateFromString(string $uri, string $expected): void self::assertSame($expected, (string) Uri::createFromString($uri)); } - public function validUrlProvider(): array + public static function validUrlProvider(): array { return [ 'with default port' => [ @@ -70,7 +70,7 @@ public function testConstructorThrowInvalidArgumentException(string $uri): void Uri::createFromString($uri); } - public function invalidUrlProvider(): array + public static function invalidUrlProvider(): array { return [ //['http://example.com'], @@ -98,7 +98,7 @@ public function testPort(string $uri, ?int $port): void self::assertSame($port, Uri::createFromString($uri)->getPort()); } - public function portProvider(): array + public static function portProvider(): array { return [ ['ftp://www.example.com:443/', 443], diff --git a/HttpTest.php b/HttpTest.php index 49e8700c..f57a5b8c 100644 --- a/HttpTest.php +++ b/HttpTest.php @@ -153,7 +153,7 @@ public function testSetState(Http $uri): void self::assertEquals($uri, eval('return '.var_export($uri, true).';')); } - public function setStateDataProvider(): array + public static function setStateDataProvider(): array { return [ 'all components' => [Http::createFromString('https://a:b@c:442/d?q=r#f')], @@ -178,7 +178,7 @@ public function testCreateFromString(string $expected, string $uri): void self::assertSame($expected, (string) Http::createFromString($uri)); } - public function validUrlProvider(): array + public static function validUrlProvider(): array { return [ 'with default port' => [ @@ -213,7 +213,7 @@ public function testIsValid(string $uri): void Http::createFromString($uri); } - public function invalidUrlProvider(): array + public static function invalidUrlProvider(): array { return [ ['http:example.com'], @@ -235,7 +235,7 @@ public function testValidPort(string $uri, ?int $port): void self::assertSame($port, Http::createFromString($uri)->getPort()); } - public function portProvider(): array + public static function portProvider(): array { return [ ['http://www.example.com:443/', 443], @@ -255,7 +255,7 @@ public function testPathIsInvalid(string $path): void Http::createFromString()->withPath($path); } - public function invalidPathProvider(): array + public static function invalidPathProvider(): array { return [ ['data:go'], @@ -276,7 +276,7 @@ public function testCreateFromInvalidUrlKO(string $uri): void Http::createFromString($uri); } - public function invalidURI(): array + public static function invalidURI(): array { return [ ['http://user@:80'], diff --git a/UriInfoTest.php b/UriInfoTest.php index 3d3c73ae..35e64e4e 100644 --- a/UriInfoTest.php +++ b/UriInfoTest.php @@ -40,7 +40,7 @@ public function testInfo( self::assertSame($infos['network_path'], UriInfo::isNetworkPath($uri)); } - public function uriProvider(): array + public static function uriProvider(): array { return [ 'absolute uri' => [ @@ -106,7 +106,7 @@ public function testSameValueAs(Psr7UriInterface|Uri $uri1, Psr7UriInterface|Uri self::assertSame($expected, UriInfo::isSameDocument($uri1, $uri2)); } - public function sameValueAsProvider(): array + public static function sameValueAsProvider(): array { return [ '2 disctincts URIs' => [ @@ -165,7 +165,7 @@ public function testGetOrigin(Psr7UriInterface|Uri $uri, ?string $expectedOrigin self::assertSame($expectedOrigin, UriInfo::getOrigin($uri)); } - public function getOriginProvider(): array + public static function getOriginProvider(): array { return [ 'http uri' => [ @@ -211,7 +211,7 @@ public function testIsCrossOrigin(string $original, string $modified, bool $expe /** * @return array */ - public function getCrossOriginExamples(): array + public static function getCrossOriginExamples(): array { return [ 'different path' => ['http://example.com/123', 'http://example.com/', false], diff --git a/UriResolverTest.php b/UriResolverTest.php index 31a1936c..97380d61 100644 --- a/UriResolverTest.php +++ b/UriResolverTest.php @@ -40,7 +40,7 @@ public function testCreateResolve(string $base_uri, string $uri, string $expecte )); } - public function resolveProvider(): array + public static function resolveProvider(): array { return [ 'base uri' => [self::BASE_URI, '', self::BASE_URI], @@ -103,7 +103,7 @@ public function testRelativize(string $uri, string $resolved, string $expected): ); } - public function relativizeProvider(): array + public static function relativizeProvider(): array { return [ 'different scheme' => [self::BASE_URI, 'https://a/b/c/d;p?q', 'https://a/b/c/d;p?q'], @@ -160,7 +160,7 @@ public function testRelativizeAndResolve( ); } - public function relativizeAndResolveProvider(): array + public static function relativizeAndResolveProvider(): array { return [ 'empty path' => [self::BASE_URI, 'http://a/', '../../', 'http://a/'], diff --git a/UriStringTest.php b/UriStringTest.php index b2811f58..e6429475 100644 --- a/UriStringTest.php +++ b/UriStringTest.php @@ -26,7 +26,7 @@ public function testParseSucced(Stringable|string|int $uri, array $expected): vo self::assertSame($expected, UriString::parse($uri)); } - public function validUriProvider(): array + public static function validUriProvider(): array { return [ 'scheme with non-leading digit' => [ @@ -748,7 +748,7 @@ public function testParseFailed(string $uri): void UriString::parse($uri); } - public function invalidUriProvider(): array + public static function invalidUriProvider(): array { return [ 'invalid scheme' => ['0scheme://host/path?query#fragment'], @@ -785,7 +785,7 @@ public function testBuild(string $uri, string $expected): void self::assertSame($expected, UriString::build(UriString::parse($uri))); } - public function buildUriProvider(): array + public static function buildUriProvider(): array { return [ 'complete URI' => [ diff --git a/UriTemplate/ExpressionTest.php b/UriTemplate/ExpressionTest.php index 6781f726..bcab2e6f 100644 --- a/UriTemplate/ExpressionTest.php +++ b/UriTemplate/ExpressionTest.php @@ -36,7 +36,7 @@ public function testItCanBeInstantiatedWithAValidNotation(string $notation, arra self::assertSame($variableNames, $expression->variableNames); } - public function providesValidNotation(): iterable + public static function providesValidNotation(): iterable { return [ 'level 1' => ['notation' => '{var}', 'variableNames' => ['var']], @@ -86,7 +86,7 @@ public function testExpressionConstructFailsWithInvalidString(string $expression Expression::createFromString($expression); } - public function providesInvalidExpression(): iterable + public static function providesInvalidExpression(): iterable { return [ 'missing content' => ['{}'], @@ -136,7 +136,7 @@ public function testExpandsUriTemplates(string $template, string $expectedUriStr self::assertSame($expectedUriString, Expression::createFromString($template)->expand(new VariableBag($variables))); } - public function templateExpansionProvider(): iterable + public static function templateExpansionProvider(): iterable { $variables = [ 'var' => 'value', @@ -271,7 +271,7 @@ public function testExpandThrowsExceptionIfTheModifierCanNotBeApplied(string $ex * * @see https://github.com/uri-templates/uritemplate-test/blob/master/negative-tests.json */ - public function invalidModifierToApply(): iterable + public static function invalidModifierToApply(): iterable { return [ 'can not apply a modifier on a hash value (1)' => [ diff --git a/UriTemplate/TemplateTest.php b/UriTemplate/TemplateTest.php index 82a49f84..0248dbf2 100644 --- a/UriTemplate/TemplateTest.php +++ b/UriTemplate/TemplateTest.php @@ -34,7 +34,7 @@ public function testItCanBeInstantiatedWithAValidNotation(string $notation): voi self::assertSame($notation, $template->value); } - public function providesValidNotation(): iterable + public static function providesValidNotation(): iterable { return [ 'complex template' => ['http://example.com{+path}{/segments}{?query,more*,foo[]*}'], @@ -55,7 +55,7 @@ public function testItFailsToInstantiatedWithAnInvalidNotation(string $notation) Template::createFromString($notation); } - public function providesInvalidNotation(): iterable + public static function providesInvalidNotation(): iterable { return [ ['fooba{r'], @@ -86,7 +86,7 @@ public function testGetVariableNames(string $template, array $expected): void self::assertSame($expected, Template::createFromString($template)->variableNames); } - public function expectedVariableNames(): iterable + public static function expectedVariableNames(): iterable { return [ [ @@ -116,7 +116,7 @@ public function testItCanExpandVariables(string $notation, array $variables, str self::assertSame($expected, Template::createFromString($notation)->expand(new VariableBag($variables))); } - public function providesExpansion(): iterable + public static function providesExpansion(): iterable { return [ 'with variables' => [ diff --git a/UriTemplate/VarSpecifierTest.php b/UriTemplate/VarSpecifierTest.php index 917094dd..56fa796d 100644 --- a/UriTemplate/VarSpecifierTest.php +++ b/UriTemplate/VarSpecifierTest.php @@ -34,7 +34,7 @@ public function testItCanBeInstantiatedWithAValidNotation(string $notation): voi self::assertSame($notation, VarSpecifier::createFromString($notation)->toString()); } - public function providesValidNotation(): iterable + public static function providesValidNotation(): iterable { return [ 'simple' => ['notation' => 'var'], @@ -60,7 +60,7 @@ public function testItFailsToInstantiatedWithAnInvalidNotationString(string $not VarSpecifier::createFromString($notation); } - public function providesInvalidNotation(): iterable + public static function providesInvalidNotation(): iterable { return [ 'using the explode modifier with the position notation' => ['notation' => 'var:*'], diff --git a/UriTemplate/VariableBagTest.php b/UriTemplate/VariableBagTest.php index 8353b5e3..e791f730 100644 --- a/UriTemplate/VariableBagTest.php +++ b/UriTemplate/VariableBagTest.php @@ -50,7 +50,7 @@ public function testItCanBeInstantiatedWithAnIterable( self::assertCount($count, $bag); } - public function provideValidIterable(): iterable + public static function provideValidIterable(): iterable { return [ 'array' => [ @@ -92,7 +92,7 @@ public function testItCanAssignNameAndValuesToTheBag(string $name, $value, $expe self::assertSame($expected, $bag->fetch($name)); } - public function provideValidAssignParameters(): iterable + public static function provideValidAssignParameters(): iterable { return [ 'string' => [ diff --git a/UriTemplateTest.php b/UriTemplateTest.php index cc2af23a..47942ba3 100644 --- a/UriTemplateTest.php +++ b/UriTemplateTest.php @@ -123,7 +123,7 @@ public function testGetVariableNames(string $template, array $expected): void self::assertSame($expected, (new UriTemplate($template))->getVariableNames()); } - public function expectedVariableNames(): iterable + public static function expectedVariableNames(): iterable { return [ [ @@ -155,7 +155,7 @@ public function testExpandsUriTemplates(string $template, string $expectedUriStr self::assertSame($expectedUriString, (new UriTemplate($template))->expand($variables)->__toString()); } - public function templateExpansionProvider(): iterable + public static function templateExpansionProvider(): iterable { $variables = [ 'var' => 'value', @@ -389,7 +389,7 @@ public function testInvalidUriTemplate(string $template): void /** * @see https://github.com/uri-templates/uritemplate-test/blob/master/negative-tests.json */ - public function provideInvalidTemplate(): iterable + public static function provideInvalidTemplate(): iterable { return [ 'mismatch in at least one expression (1)' => ['http://example.com/}/{+foo}'], diff --git a/UriTest.php b/UriTest.php index 81e534c0..5a85fd14 100644 --- a/UriTest.php +++ b/UriTest.php @@ -300,7 +300,7 @@ public function testModificationFailedWithMissingAuthority(string $path): void /** * @covers ::assertValidState */ - public function missingAuthorityProvider(): array + public static function missingAuthorityProvider(): array { return [ ['data:go'], @@ -349,7 +349,7 @@ public function testSetState(Uri $uri): void self::assertEquals($uri, eval('return '.var_export($uri, true).';')); } - public function setStateDataProvider(): array + public static function setStateDataProvider(): array { return [ 'all components' => [Uri::createFromString('https://a:b@c:442/d?q=r#f')], @@ -577,7 +577,7 @@ public function testWithUserInfoEncodesUsernameAndPassword(string $user, ?string self::assertSame($expected, $new->getUserInfo()); } - public function userInfoProvider(): array + public static function userInfoProvider(): array { return [ 'no password' => ['login:', null, 'login%3A'], diff --git a/WsTest.php b/WsTest.php index 30351bbf..e4ee20b0 100644 --- a/WsTest.php +++ b/WsTest.php @@ -30,7 +30,7 @@ public function testCreateFromString(string $input, string $expected): void self::assertSame($expected, (string) Uri::createFromString($input)); } - public function validUrlProvider(): array + public static function validUrlProvider(): array { return [ 'with default port' => [ @@ -69,7 +69,7 @@ public function testConstructorThrowInvalidArgumentException(string $uri): void Uri::createFromString($uri); } - public function invalidUrlProvider(): array + public static function invalidUrlProvider(): array { return [ ['wss:example.com'], @@ -95,7 +95,7 @@ public function testPort(string $uri, ?int $port): void self::assertSame($port, Uri::createFromString($uri)->getPort()); } - public function portProvider(): array + public static function portProvider(): array { return [ ['ws://www.example.com:443/', 443], diff --git a/composer.json b/composer.json index d562257a..98d0cf57 100644 --- a/composer.json +++ b/composer.json @@ -46,8 +46,8 @@ "require": { "php": "^8.1", "ext-json": "*", - "psr/http-message": "^1.0.1", - "league/uri-interfaces": "^2.3" + "league/uri-interfaces": "^2.4", + "psr/http-message": "^1.0" }, "autoload": { "psr-4": {