composeer update

This commit is contained in:
2019-06-23 11:49:01 +00:00
parent fc2380d68c
commit e9efe70112
327 changed files with 5194 additions and 2278 deletions

View File

@@ -8,8 +8,9 @@ CHANGELOG
* added `CompiledUrlGenerator` and `CompiledUrlGeneratorDumper`
* deprecated `PhpGeneratorDumper` and `PhpMatcherDumper`
* deprecated `generator_base_class`, `generator_cache_class`, `matcher_base_class` and `matcher_cache_class` router options
* deprecated implementing `Serializable` for `Route` and `CompiledRoute`; if you serialize them, please
ensure your unserialization logic can recover from a failure related to an updated serialization format
* `Serializable` implementing methods for `Route` and `CompiledRoute` are marked as `@internal` and `@final`.
Instead of overwriting them, use `__serialize` and `__unserialize` as extension points which are forward compatible
with the new serialization methods in PHP 7.4.
* exposed `utf8` Route option, defaults "locale" and "format" in configuration loaders and configurators
* added support for invokable route loader services

View File

@@ -64,7 +64,8 @@ class CompiledRoute implements \Serializable
}
/**
* @internal since Symfony 4.3, will be removed in Symfony 5 as the class won't implement Serializable anymore
* @internal since Symfony 4.3
* @final since Symfony 4.3
*/
public function serialize()
{
@@ -84,7 +85,8 @@ class CompiledRoute implements \Serializable
}
/**
* @internal since Symfony 4.3, will be removed in Symfony 5 as the class won't implement Serializable anymore
* @internal since Symfony 4.3
* @final since Symfony 4.3
*/
public function unserialize($serialized)
{

View File

@@ -78,7 +78,8 @@ class Route implements \Serializable
}
/**
* @internal since Symfony 4.3, will be removed in Symfony 5 as the class won't implement Serializable anymore
* @internal since Symfony 4.3
* @final since Symfony 4.3
*/
public function serialize()
{
@@ -104,7 +105,8 @@ class Route implements \Serializable
}
/**
* @internal since Symfony 4.3, will be removed in Symfony 5 as the class won't implement Serializable anymore
* @internal since Symfony 4.3
* @final since Symfony 4.3
*/
public function unserialize($serialized)
{

View File

@@ -233,12 +233,12 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
$reader
->expects($this->exactly(1))
->method('getClassAnnotations')
->will($this->returnValue([new RouteAnnotation($classRouteData1), new RouteAnnotation($classRouteData2)]))
->willReturn([new RouteAnnotation($classRouteData1), new RouteAnnotation($classRouteData2)])
;
$reader
->expects($this->once())
->method('getMethodAnnotations')
->will($this->returnValue([]))
->willReturn([])
;
$loader = new class($reader) extends AnnotationClassLoader {
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot)
@@ -319,7 +319,7 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
$reader
->expects($this->once())
->method('getMethodAnnotations')
->will($this->returnValue([new RouteAnnotation($methodRouteData)]))
->willReturn([new RouteAnnotation($methodRouteData)])
;
$loader = new class($reader) extends AnnotationClassLoader {

View File

@@ -34,13 +34,13 @@ class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest
$this->reader
->expects($this->any())
->method('getMethodAnnotations')
->will($this->returnValue([]))
->willReturn([])
;
$this->reader
->expects($this->any())
->method('getClassAnnotations')
->will($this->returnValue([]))
->willReturn([])
;
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses');
@@ -58,13 +58,13 @@ class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest
$this->reader
->expects($this->any())
->method('getMethodAnnotations')
->will($this->returnValue([]))
->willReturn([])
;
$this->reader
->expects($this->any())
->method('getClassAnnotations')
->will($this->returnValue([]))
->willReturn([])
;
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses');
@@ -93,7 +93,7 @@ class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest
$this->reader
->expects($this->any())
->method('getMethodAnnotations')
->will($this->returnValue([]))
->willReturn([])
;
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php');

View File

@@ -56,7 +56,7 @@ class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest
$route = new Route(['path' => '/path/to/{id}']);
$this->reader->expects($this->once())->method('getClassAnnotation');
$this->reader->expects($this->once())->method('getMethodAnnotations')
->will($this->returnValue([$route]));
->willReturn([$route]);
$this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/VariadicClass.php');
}

View File

@@ -118,7 +118,7 @@ class ObjectRouteLoaderTest extends TestCase
->getMock();
$service->expects($this->once())
->method('loadRoutes')
->will($this->returnValue('NOT_A_COLLECTION'));
->willReturn('NOT_A_COLLECTION');
$loader = new ObjectRouteLoaderForTest();
$loader->loaderMap = ['my_service' => $service];

View File

@@ -23,7 +23,7 @@ class RedirectableUrlMatcherTest extends UrlMatcherTest
$coll->add('foo', new Route('/foo/'));
$matcher = $this->getUrlMatcher($coll);
$matcher->expects($this->once())->method('redirect')->will($this->returnValue([]));
$matcher->expects($this->once())->method('redirect')->willReturn([]);
$matcher->match('/foo');
}
@@ -33,7 +33,7 @@ class RedirectableUrlMatcherTest extends UrlMatcherTest
$coll->add('foo', new Route('/foo'));
$matcher = $this->getUrlMatcher($coll);
$matcher->expects($this->once())->method('redirect')->will($this->returnValue([]));
$matcher->expects($this->once())->method('redirect')->willReturn([]);
$matcher->match('/foo/');
}
@@ -61,7 +61,7 @@ class RedirectableUrlMatcherTest extends UrlMatcherTest
->expects($this->once())
->method('redirect')
->with('/foo', 'foo', 'ftp')
->will($this->returnValue(['_route' => 'foo']))
->willReturn(['_route' => 'foo'])
;
$matcher->match('/foo');
}
@@ -88,7 +88,7 @@ class RedirectableUrlMatcherTest extends UrlMatcherTest
->expects($this->once())
->method('redirect')
->with('/foo/baz', 'foo', 'https')
->will($this->returnValue(['redirect' => 'value']))
->willReturn(['redirect' => 'value'])
;
$this->assertEquals(['_route' => 'foo', 'bar' => 'baz', 'redirect' => 'value'], $matcher->match('/foo/baz'));
}
@@ -103,7 +103,7 @@ class RedirectableUrlMatcherTest extends UrlMatcherTest
->expects($this->once())
->method('redirect')
->with('/', 'foo', 'https')
->will($this->returnValue(['redirect' => 'value']));
->willReturn(['redirect' => 'value']);
$this->assertEquals(['_route' => 'foo', 'redirect' => 'value'], $matcher->match('/'));
}
@@ -117,7 +117,7 @@ class RedirectableUrlMatcherTest extends UrlMatcherTest
->expects($this->once())
->method('redirect')
->with('/foo/baz/', 'foo', null)
->will($this->returnValue(['redirect' => 'value']))
->willReturn(['redirect' => 'value'])
;
$this->assertEquals(['_route' => 'foo', 'bar' => 'baz', 'redirect' => 'value'], $matcher->match('/foo/baz'));
}
@@ -148,7 +148,7 @@ class RedirectableUrlMatcherTest extends UrlMatcherTest
$coll->add('bar', new Route('/{name}'));
$matcher = $this->getUrlMatcher($coll);
$matcher->expects($this->once())->method('redirect')->with('/foo/', 'foo')->will($this->returnValue(['_route' => 'foo']));
$matcher->expects($this->once())->method('redirect')->with('/foo/', 'foo')->willReturn(['_route' => 'foo']);
$this->assertSame(['_route' => 'foo'], $matcher->match('/foo'));
$coll = new RouteCollection();
@@ -156,7 +156,7 @@ class RedirectableUrlMatcherTest extends UrlMatcherTest
$coll->add('bar', new Route('/{name}/'));
$matcher = $this->getUrlMatcher($coll);
$matcher->expects($this->once())->method('redirect')->with('/foo', 'foo')->will($this->returnValue(['_route' => 'foo']));
$matcher->expects($this->once())->method('redirect')->with('/foo', 'foo')->willReturn(['_route' => 'foo']);
$this->assertSame(['_route' => 'foo'], $matcher->match('/foo/'));
}
@@ -166,7 +166,7 @@ class RedirectableUrlMatcherTest extends UrlMatcherTest
$coll->add('foo', (new Route('/foo/'))->setSchemes(['https']));
$matcher = $this->getUrlMatcher($coll);
$matcher->expects($this->once())->method('redirect')->with('/foo/', 'foo', 'https')->will($this->returnValue([]));
$matcher->expects($this->once())->method('redirect')->with('/foo/', 'foo', 'https')->willReturn([]);
$matcher->match('/foo');
}

View File

@@ -28,7 +28,7 @@ class RouteCollectionBuilderTest extends TestCase
$resolver->expects($this->once())
->method('resolve')
->with('admin_routing.yml', 'yaml')
->will($this->returnValue($resolvedLoader));
->willReturn($resolvedLoader);
$originalRoute = new Route('/foo/path');
$expectedCollection = new RouteCollection();
@@ -39,12 +39,12 @@ class RouteCollectionBuilderTest extends TestCase
->expects($this->once())
->method('load')
->with('admin_routing.yml', 'yaml')
->will($this->returnValue($expectedCollection));
->willReturn($expectedCollection);
$loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
$loader->expects($this->any())
->method('getResolver')
->will($this->returnValue($resolver));
->willReturn($resolver);
// import the file!
$routes = new RouteCollectionBuilder($loader);
@@ -107,11 +107,11 @@ class RouteCollectionBuilderTest extends TestCase
// make this loader able to do the import - keeps mocking simple
$loader->expects($this->any())
->method('supports')
->will($this->returnValue(true));
->willReturn(true);
$loader
->expects($this->once())
->method('load')
->will($this->returnValue($importedCollection));
->willReturn($importedCollection);
$routes = new RouteCollectionBuilder($loader);
@@ -296,11 +296,11 @@ class RouteCollectionBuilderTest extends TestCase
// make this loader able to do the import - keeps mocking simple
$loader->expects($this->any())
->method('supports')
->will($this->returnValue(true));
->willReturn(true);
$loader
->expects($this->any())
->method('load')
->will($this->returnValue($importedCollection));
->willReturn($importedCollection);
// import this from the /admin route builder
$adminRoutes->import('admin.yml', '/imported');
@@ -347,11 +347,11 @@ class RouteCollectionBuilderTest extends TestCase
$loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
$loader->expects($this->any())
->method('supports')
->will($this->returnValue(true));
->willReturn(true);
$loader
->expects($this->any())
->method('load')
->will($this->returnValue([$firstCollection, $secondCollection]));
->willReturn([$firstCollection, $secondCollection]);
$routeCollectionBuilder = new RouteCollectionBuilder($loader);
$routeCollectionBuilder->import('/directory/recurse/*', '/other/', 'glob');

View File

@@ -88,7 +88,7 @@ class RouterTest extends TestCase
$this->loader->expects($this->once())
->method('load')->with('routing.yml', 'ResourceType')
->will($this->returnValue($routeCollection));
->willReturn($routeCollection);
$this->assertSame($routeCollection, $this->router->getRouteCollection());
}
@@ -99,7 +99,7 @@ class RouterTest extends TestCase
$this->loader->expects($this->once())
->method('load')->with('routing.yml', null)
->will($this->returnValue(new RouteCollection()));
->willReturn(new RouteCollection());
$this->assertInstanceOf('Symfony\\Component\\Routing\\Matcher\\UrlMatcher', $this->router->getMatcher());
}
@@ -110,7 +110,7 @@ class RouterTest extends TestCase
$this->loader->expects($this->once())
->method('load')->with('routing.yml', null)
->will($this->returnValue(new RouteCollection()));
->willReturn(new RouteCollection());
$this->assertInstanceOf('Symfony\\Component\\Routing\\Generator\\UrlGenerator', $this->router->getGenerator());
}