diff --git a/LICENSE b/LICENSE index 00837045..0138f8f0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2023 Fabien Potencier +Copyright (c) 2004-present Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Tests/Annotation/RouteTest.php b/Tests/Annotation/RouteTest.php index 4df94ca2..de671ed9 100644 --- a/Tests/Annotation/RouteTest.php +++ b/Tests/Annotation/RouteTest.php @@ -57,7 +57,7 @@ public function testLoadFromDoctrineAnnotation(string $methodName, string $gette $this->assertEquals($route->$getter(), $expectedReturn); } - public function getValidParameters(): iterable + public static function getValidParameters(): iterable { return [ ['simplePath', 'getPath', '/Blog'], diff --git a/Tests/Generator/UrlGeneratorTest.php b/Tests/Generator/UrlGeneratorTest.php index 70afde18..a6335b7b 100644 --- a/Tests/Generator/UrlGeneratorTest.php +++ b/Tests/Generator/UrlGeneratorTest.php @@ -130,7 +130,7 @@ public function testAbsoluteUrlWithExtraParameters(string $expectedQueryString, $this->assertSame('http://localhost/app.php/testing'.$expectedQueryString, $url); } - public function valuesProvider(): array + public static function valuesProvider(): array { $stdClass = new \stdClass(); $stdClass->baz = 'bar'; @@ -894,7 +894,7 @@ public function testGetRelativePath($sourcePath, $targetPath, $expectedPath) $this->assertSame($expectedPath, UrlGenerator::getRelativePath($sourcePath, $targetPath)); } - public function provideRelativePaths() + public static function provideRelativePaths() { return [ [ @@ -1036,7 +1036,7 @@ public function testLookRoundRequirementsInPath($expected, $path, $requirement) $this->assertSame($expected, $this->getGenerator($routes)->generate('test', ['foo' => 'a/b', 'baz' => 'c/d/e'])); } - public function provideLookAroundRequirementsInPath() + public static function provideLookAroundRequirementsInPath() { yield ['/app.php/a/b/b%28ar/c/d/e', '/{foo}/b(ar/{baz}', '.+(?=/b\\(ar/)']; yield ['/app.php/a/b/bar/c/d/e', '/{foo}/bar/{baz}', '.+(?!$)']; diff --git a/Tests/Loader/AbstractAnnotationLoaderTest.php b/Tests/Loader/AbstractAnnotationLoaderTestCase.php similarity index 92% rename from Tests/Loader/AbstractAnnotationLoaderTest.php rename to Tests/Loader/AbstractAnnotationLoaderTestCase.php index fea06e51..e743ef2e 100644 --- a/Tests/Loader/AbstractAnnotationLoaderTest.php +++ b/Tests/Loader/AbstractAnnotationLoaderTestCase.php @@ -14,7 +14,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Routing\Loader\AnnotationClassLoader; -abstract class AbstractAnnotationLoaderTest extends TestCase +abstract class AbstractAnnotationLoaderTestCase extends TestCase { public function getReader() { diff --git a/Tests/Loader/AnnotationClassLoaderTest.php b/Tests/Loader/AnnotationClassLoaderTestCase.php similarity index 98% rename from Tests/Loader/AnnotationClassLoaderTest.php rename to Tests/Loader/AnnotationClassLoaderTestCase.php index 8221fe12..b717d196 100644 --- a/Tests/Loader/AnnotationClassLoaderTest.php +++ b/Tests/Loader/AnnotationClassLoaderTestCase.php @@ -15,7 +15,7 @@ use Symfony\Component\Routing\Loader\AnnotationClassLoader; use Symfony\Component\Routing\Tests\Fixtures\AnnotationFixtures\AbstractClassController; -abstract class AnnotationClassLoaderTest extends TestCase +abstract class AnnotationClassLoaderTestCase extends TestCase { /** * @var AnnotationClassLoader @@ -30,7 +30,7 @@ public function testSupportsChecksResource($resource, $expectedSupports) $this->assertSame($expectedSupports, $this->loader->supports($resource), '->supports() returns true if the resource is loadable'); } - public function provideTestSupportsChecksResource() + public static function provideTestSupportsChecksResource() { return [ ['class', true], diff --git a/Tests/Loader/AnnotationClassLoaderWithAnnotationsTest.php b/Tests/Loader/AnnotationClassLoaderWithAnnotationsTest.php index e2843a0a..1130204b 100644 --- a/Tests/Loader/AnnotationClassLoaderWithAnnotationsTest.php +++ b/Tests/Loader/AnnotationClassLoaderWithAnnotationsTest.php @@ -16,7 +16,7 @@ use Symfony\Component\Routing\Loader\AnnotationClassLoader; use Symfony\Component\Routing\Route; -class AnnotationClassLoaderWithAnnotationsTest extends AnnotationClassLoaderTest +class AnnotationClassLoaderWithAnnotationsTest extends AnnotationClassLoaderTestCase { protected function setUp(string $env = null): void { diff --git a/Tests/Loader/AnnotationClassLoaderWithAttributesTest.php b/Tests/Loader/AnnotationClassLoaderWithAttributesTest.php index 75263944..d613ba09 100644 --- a/Tests/Loader/AnnotationClassLoaderWithAttributesTest.php +++ b/Tests/Loader/AnnotationClassLoaderWithAttributesTest.php @@ -14,7 +14,7 @@ use Symfony\Component\Routing\Loader\AnnotationClassLoader; use Symfony\Component\Routing\Route; -class AnnotationClassLoaderWithAttributesTest extends AnnotationClassLoaderTest +class AnnotationClassLoaderWithAttributesTest extends AnnotationClassLoaderTestCase { protected function setUp(string $env = null): void { diff --git a/Tests/Loader/AnnotationDirectoryLoaderTest.php b/Tests/Loader/AnnotationDirectoryLoaderTest.php index e8e14c9b..c0c0da38 100644 --- a/Tests/Loader/AnnotationDirectoryLoaderTest.php +++ b/Tests/Loader/AnnotationDirectoryLoaderTest.php @@ -14,7 +14,7 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader; -class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest +class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTestCase { protected $loader; protected $reader; diff --git a/Tests/Loader/AnnotationFileLoaderTest.php b/Tests/Loader/AnnotationFileLoaderTest.php index 2ea13d73..47336815 100644 --- a/Tests/Loader/AnnotationFileLoaderTest.php +++ b/Tests/Loader/AnnotationFileLoaderTest.php @@ -15,7 +15,7 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Loader\AnnotationFileLoader; -class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest +class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTestCase { protected $loader; protected $reader; diff --git a/Tests/Loader/ContainerLoaderTest.php b/Tests/Loader/ContainerLoaderTest.php index 5f74111d..6a3e4c51 100644 --- a/Tests/Loader/ContainerLoaderTest.php +++ b/Tests/Loader/ContainerLoaderTest.php @@ -25,7 +25,7 @@ public function testSupports(bool $expected, string $type = null) $this->assertSame($expected, (new ContainerLoader(new Container()))->supports('foo', $type)); } - public function supportsProvider() + public static function supportsProvider() { return [ [true, 'service'], diff --git a/Tests/Loader/DirectoryLoaderTest.php b/Tests/Loader/DirectoryLoaderTest.php index 184d5089..d4f2fd32 100644 --- a/Tests/Loader/DirectoryLoaderTest.php +++ b/Tests/Loader/DirectoryLoaderTest.php @@ -18,7 +18,7 @@ use Symfony\Component\Routing\Loader\YamlFileLoader; use Symfony\Component\Routing\RouteCollection; -class DirectoryLoaderTest extends AbstractAnnotationLoaderTest +class DirectoryLoaderTest extends AbstractAnnotationLoaderTestCase { private $loader; private $reader; diff --git a/Tests/Loader/ObjectLoaderTest.php b/Tests/Loader/ObjectLoaderTest.php index 82b19362..00b6af62 100644 --- a/Tests/Loader/ObjectLoaderTest.php +++ b/Tests/Loader/ObjectLoaderTest.php @@ -50,7 +50,7 @@ public function testExceptionWithoutSyntax(string $resourceString) $loader->load($resourceString); } - public function getBadResourceStrings() + public static function getBadResourceStrings() { return [ ['Foo:Bar:baz'], @@ -82,7 +82,7 @@ public function testExceptionOnMethodNotReturningCollection() { $this->expectException(\LogicException::class); $service = $this->getMockBuilder(\stdClass::class) - ->setMethods(['loadRoutes']) + ->addMethods(['loadRoutes']) ->getMock(); $service->expects($this->once()) ->method('loadRoutes') diff --git a/Tests/Loader/PhpFileLoaderTest.php b/Tests/Loader/PhpFileLoaderTest.php index 4d260ce9..48db540a 100644 --- a/Tests/Loader/PhpFileLoaderTest.php +++ b/Tests/Loader/PhpFileLoaderTest.php @@ -324,7 +324,7 @@ protected function configureRoute(Route $route, \ReflectionClass $class, \Reflec $this->assertSame(MyController::class.'::__invoke', $route->getDefault('_controller')); } - public function providePsr4ConfigFiles(): array + public static function providePsr4ConfigFiles(): array { return [ ['psr4-attributes.php'], diff --git a/Tests/Loader/Psr4DirectoryLoaderTest.php b/Tests/Loader/Psr4DirectoryLoaderTest.php index 2bae5900..4b2a4676 100644 --- a/Tests/Loader/Psr4DirectoryLoaderTest.php +++ b/Tests/Loader/Psr4DirectoryLoaderTest.php @@ -81,7 +81,7 @@ public function testPsr4NamespaceTrim(string $namespace) $this->assertSame(MyController::class.'::__invoke', $route->getDefault('_controller')); } - public function provideNamespacesThatNeedTrimming(): array + public static function provideNamespacesThatNeedTrimming(): array { return [ ['\\Symfony\Component\Routing\Tests\Fixtures\Psr4Controllers'], diff --git a/Tests/Loader/XmlFileLoaderTest.php b/Tests/Loader/XmlFileLoaderTest.php index 8963d498..65ea4a9d 100644 --- a/Tests/Loader/XmlFileLoaderTest.php +++ b/Tests/Loader/XmlFileLoaderTest.php @@ -234,7 +234,7 @@ public function testLoadThrowsExceptionWithInvalidFileEvenWithoutSchemaValidatio $loader->load($filePath); } - public function getPathsToInvalidFiles() + public static function getPathsToInvalidFiles() { return [ ['nonvalidnode.xml'], @@ -482,7 +482,7 @@ public function testImportRouteWithController($file) $this->assertSame('FrameworkBundle:Template:template', $route->getDefault('_controller')); } - public function provideFilesImportingRoutesWithControllers() + public static function provideFilesImportingRoutesWithControllers() { yield ['import_controller.xml']; yield ['import__controller.xml']; @@ -619,7 +619,7 @@ protected function configureRoute(Route $route, \ReflectionClass $class, \Reflec $this->assertSame(MyController::class.'::__invoke', $route->getDefault('_controller')); } - public function providePsr4ConfigFiles(): array + public static function providePsr4ConfigFiles(): array { return [ ['psr4-attributes.xml'], diff --git a/Tests/Loader/YamlFileLoaderTest.php b/Tests/Loader/YamlFileLoaderTest.php index c7fe9a48..41d1605e 100644 --- a/Tests/Loader/YamlFileLoaderTest.php +++ b/Tests/Loader/YamlFileLoaderTest.php @@ -56,7 +56,7 @@ public function testLoadThrowsExceptionWithInvalidFile($filePath) $loader->load($filePath); } - public function getPathsToInvalidFiles() + public static function getPathsToInvalidFiles() { return [ ['nonvalid.yml'], @@ -175,7 +175,7 @@ public function testImportRouteWithController($file) $this->assertSame('FrameworkBundle:Template:template', $route->getDefault('_controller')); } - public function provideFilesImportingRoutesWithControllers() + public static function provideFilesImportingRoutesWithControllers() { yield ['import_controller.yml']; yield ['import__controller.yml']; @@ -485,7 +485,7 @@ protected function configureRoute(Route $route, \ReflectionClass $class, \Reflec $this->assertSame(MyController::class.'::__invoke', $route->getDefault('_controller')); } - public function providePsr4ConfigFiles(): array + public static function providePsr4ConfigFiles(): array { return [ ['psr4-attributes.yaml'], diff --git a/Tests/Matcher/CompiledRedirectableUrlMatcherTest.php b/Tests/Matcher/CompiledRedirectableUrlMatcherTest.php index faf5f181..2dcadc27 100644 --- a/Tests/Matcher/CompiledRedirectableUrlMatcherTest.php +++ b/Tests/Matcher/CompiledRedirectableUrlMatcherTest.php @@ -26,7 +26,7 @@ protected function getUrlMatcher(RouteCollection $routes, RequestContext $contex return $this->getMockBuilder(TestCompiledRedirectableUrlMatcher::class) ->setConstructorArgs([$compiledRoutes, $context ?? new RequestContext()]) - ->setMethods(['redirect']) + ->onlyMethods(['redirect']) ->getMock(); } } diff --git a/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php b/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php index 0df1c0cf..2236ca7c 100644 --- a/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php +++ b/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php @@ -65,7 +65,7 @@ public function testDump(RouteCollection $collection, $fixture) $this->assertStringEqualsFile($basePath.$fixture, $dumper->dump()); } - public function getRouteCollections() + public static function getRouteCollections() { /* test case 1 */ @@ -490,7 +490,7 @@ private function generateDumpedMatcher(RouteCollection $collection) return $this->getMockBuilder(TestCompiledUrlMatcher::class) ->setConstructorArgs([$compiledRoutes, new RequestContext()]) - ->setMethods(['redirect']) + ->onlyMethods(['redirect']) ->getMock(); } diff --git a/Tests/Matcher/Dumper/StaticPrefixCollectionTest.php b/Tests/Matcher/Dumper/StaticPrefixCollectionTest.php index d3f4c4f0..86e0d0e3 100644 --- a/Tests/Matcher/Dumper/StaticPrefixCollectionTest.php +++ b/Tests/Matcher/Dumper/StaticPrefixCollectionTest.php @@ -34,7 +34,7 @@ public function testGrouping(array $routes, $expected) $this->assertEquals($expected, $dumped); } - public function routeProvider() + public static function routeProvider() { return [ 'Simple - not nested' => [ diff --git a/Tests/Matcher/ExpressionLanguageProviderTest.php b/Tests/Matcher/ExpressionLanguageProviderTest.php index 0aa3549b..2e431b71 100644 --- a/Tests/Matcher/ExpressionLanguageProviderTest.php +++ b/Tests/Matcher/ExpressionLanguageProviderTest.php @@ -59,7 +59,7 @@ public function testCompile(string $expression, string $expected) $this->assertSame($expected, $this->expressionLanguage->compile($expression)); } - public function compileProvider(): iterable + public static function compileProvider(): iterable { return [ ['env("APP_ENV")', '($context->getParameter(\'_functions\')->get(\'env\')("APP_ENV"))'], @@ -76,7 +76,7 @@ public function testEvaluate(string $expression, $expected) $this->assertSame($expected, $this->expressionLanguage->evaluate($expression, ['context' => $this->context])); } - public function evaluateProvider(): iterable + public static function evaluateProvider(): iterable { return [ ['env("APP_ENV")', 'test'], diff --git a/Tests/Requirement/EnumRequirementTest.php b/Tests/Requirement/EnumRequirementTest.php index 75613f49..68b32ea7 100644 --- a/Tests/Requirement/EnumRequirementTest.php +++ b/Tests/Requirement/EnumRequirementTest.php @@ -54,7 +54,7 @@ public function testToString(string $expected, string|array $cases = []) $this->assertSame($expected, (string) new EnumRequirement($cases)); } - public function provideToString() + public static function provideToString() { return [ ['hearts|diamonds|clubs|spades', TestStringBackedEnum::class], diff --git a/Tests/RouteCompilerTest.php b/Tests/RouteCompilerTest.php index 6f5b91f5..57f61c7e 100644 --- a/Tests/RouteCompilerTest.php +++ b/Tests/RouteCompilerTest.php @@ -32,7 +32,7 @@ public function testCompile($name, $arguments, $prefix, $regex, $variables, $tok $this->assertEquals($tokens, $compiled->getTokens(), $name.' (tokens)'); } - public function provideCompileData() + public static function provideCompileData() { return [ [ @@ -199,7 +199,7 @@ public function testCompileImplicitUtf8Data($name, $arguments, $prefix, $regex, $this->assertEquals($tokens, $compiled->getTokens(), $name.' (tokens)'); } - public function provideCompileImplicitUtf8Data() + public static function provideCompileImplicitUtf8Data() { return [ [ @@ -284,7 +284,7 @@ public function testRouteWithVariableNameStartingWithADigit($name) $route->compile(); } - public function getVariableNamesStartingWithADigit() + public static function getVariableNamesStartingWithADigit() { return [ ['09'], @@ -312,7 +312,7 @@ public function testCompileWithHost($name, $arguments, $prefix, $regex, $variabl $this->assertEquals($hostTokens, $compiled->getHostTokens(), $name.' (host tokens)'); } - public function provideCompileWithHostData() + public static function provideCompileWithHostData() { return [ [ @@ -381,7 +381,7 @@ public function testRemoveCapturingGroup($regex, $requirement) $this->assertSame($regex, $route->compile()->getRegex()); } - public function provideRemoveCapturingGroup() + public static function provideRemoveCapturingGroup() { yield ['{^/(?Pa(?:b|c)(?:d|e)f)$}sD', 'a(b|c)(d|e)f']; yield ['{^/(?Pa\(b\)c)$}sD', 'a\(b\)c']; diff --git a/Tests/RouteTest.php b/Tests/RouteTest.php index 29c51cae..72cfdc20 100644 --- a/Tests/RouteTest.php +++ b/Tests/RouteTest.php @@ -151,7 +151,7 @@ public function testSetInvalidRequirement($req) $route->setRequirement('foo', $req); } - public function getInvalidRequirements() + public static function getInvalidRequirements() { return [ [''], @@ -354,7 +354,7 @@ public function testLocaleRequirementWithLocalizedRoutes(Route $route) $this->assertSame($expected, $route->getRequirement('_locale')); } - public function provideNonLocalizedRoutes() + public static function provideNonLocalizedRoutes() { return [ [new Route('/foo')], @@ -364,7 +364,7 @@ public function provideNonLocalizedRoutes() ]; } - public function provideLocalizedRoutes() + public static function provideLocalizedRoutes() { return [ [(new Route('/foo'))->setDefault('_locale', 'en')->setDefault('_canonical_route', 'foo')->setRequirement('_locale', 'en')], diff --git a/composer.json b/composer.json index 787a8c30..b0de1fc8 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "symfony/routing", "type": "library", "description": "Maps an HTTP request to a set of configuration variables", - "keywords": ["routing", "router", "URL", "URI"], + "keywords": ["routing", "router", "url", "uri"], "homepage": "https://symfony.com", "license": "MIT", "authors": [