diff --git a/src/Symfony/Bridge/Monolog/Tests/ClassThatInheritLogger.php b/src/Symfony/Bridge/Monolog/Tests/ClassThatInheritLogger.php new file mode 100644 index 0000000000..31c62e3e75 --- /dev/null +++ b/src/Symfony/Bridge/Monolog/Tests/ClassThatInheritLogger.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Monolog\Tests; + +use Symfony\Bridge\Monolog\Logger; + +class ClassThatInheritLogger extends Logger +{ + public function getLogs(): array + { + return parent::getLogs(); + } + + public function countErrors(): int + { + return parent::countErrors(); + } +} diff --git a/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php b/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php index 3cf8d40e0b..2b2c7a3763 100644 --- a/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php @@ -128,33 +128,12 @@ class LoggerTest extends TestCase /** * @group legacy * @expectedDeprecation The "Symfony\Bridge\Monolog\Logger::getLogs()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2. + * @expectedDeprecation The "Symfony\Bridge\Monolog\Logger::countErrors()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2. */ - public function testInheritedClassCallGetLogsWithoutArgument() + public function testInheritedClassWithoutArgument() { $loggerChild = new ClassThatInheritLogger('test'); $loggerChild->getLogs(); - } - - /** - * @group legacy - * @expectedDeprecation The "Symfony\Bridge\Monolog\Logger::countErrors()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2. - */ - public function testInheritedClassCallCountErrorsWithoutArgument() - { - $loggerChild = new ClassThatInheritLogger('test'); $loggerChild->countErrors(); } } - -class ClassThatInheritLogger extends Logger -{ - public function getLogs(): array - { - return parent::getLogs(); - } - - public function countErrors(): int - { - return parent::countErrors(); - } -} diff --git a/src/Symfony/Bridge/Monolog/Tests/Processor/ClassThatInheritDebugProcessor.php b/src/Symfony/Bridge/Monolog/Tests/Processor/ClassThatInheritDebugProcessor.php new file mode 100644 index 0000000000..1f15bd9f76 --- /dev/null +++ b/src/Symfony/Bridge/Monolog/Tests/Processor/ClassThatInheritDebugProcessor.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Monolog\Tests\Processor; + +use Symfony\Bridge\Monolog\Processor\DebugProcessor; + +class ClassThatInheritDebugProcessor extends DebugProcessor +{ + public function getLogs(): array + { + return parent::getLogs(); + } + + public function countErrors(): int + { + return parent::countErrors(); + } +} diff --git a/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php b/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php index 7bd149c705..37456b801d 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php @@ -66,20 +66,12 @@ class DebugProcessorTest extends TestCase /** * @group legacy * @expectedDeprecation The "Symfony\Bridge\Monolog\Processor\DebugProcessor::getLogs()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2. + * @expectedDeprecation The "Symfony\Bridge\Monolog\Processor\DebugProcessor::countErrors()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2. */ - public function testInheritedClassCallGetLogsWithoutArgument() + public function testInheritedClassWithoutArgument() { $debugProcessorChild = new ClassThatInheritDebugProcessor(); $debugProcessorChild->getLogs(); - } - - /** - * @group legacy - * @expectedDeprecation The "Symfony\Bridge\Monolog\Processor\DebugProcessor::countErrors()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2. - */ - public function testInheritedClassCallCountErrorsWithoutArgument() - { - $debugProcessorChild = new ClassThatInheritDebugProcessor(); $debugProcessorChild->countErrors(); } @@ -96,16 +88,3 @@ class DebugProcessorTest extends TestCase ]; } } - -class ClassThatInheritDebugProcessor extends DebugProcessor -{ - public function getLogs(): array - { - return parent::getLogs(); - } - - public function countErrors(): int - { - return parent::countErrors(); - } -} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php index cca30c3f3f..68db3bb99f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php @@ -81,8 +81,6 @@ class AbstractControllerTest extends ControllerTraitTest class TestAbstractController extends AbstractController { - use TestControllerTrait; - private $throwOnUnexpectedService; public function __construct($throwOnUnexpectedService = true) @@ -90,6 +88,11 @@ class TestAbstractController extends AbstractController $this->throwOnUnexpectedService = $throwOnUnexpectedService; } + public function __call(string $method, array $arguments) + { + return $this->$method(...$arguments); + } + public function setContainer(ContainerInterface $container) { if (!$this->throwOnUnexpectedService) { @@ -114,11 +117,6 @@ class TestAbstractController extends AbstractController return parent::setContainer($container); } - public function getParameter(string $name) - { - return parent::getParameter($name); - } - public function fooAction() { } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php index fd064bb15b..7b7c2a9279 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php @@ -11,7 +11,6 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Controller; -use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait; use Symfony\Bundle\FrameworkBundle\Tests\TestCase; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\Form\Form; @@ -545,29 +544,3 @@ abstract class ControllerTraitTest extends TestCase $this->assertContains($link2, $links); } } - -trait TestControllerTrait -{ - use ControllerTrait { - generateUrl as public; - redirect as public; - forward as public; - getUser as public; - json as public; - file as public; - isGranted as public; - denyAccessUnlessGranted as public; - redirectToRoute as public; - addFlash as public; - isCsrfTokenValid as public; - renderView as public; - render as public; - stream as public; - createNotFoundException as public; - createAccessDeniedException as public; - createForm as public; - createFormBuilder as public; - getDoctrine as public; - addLink as public; - } -} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TestController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TestController.php index 595dfd8d32..58a49797ca 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TestController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TestController.php @@ -3,8 +3,30 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait; class TestController extends Controller { - use TestControllerTrait; + use ControllerTrait { + generateUrl as public; + redirect as public; + forward as public; + getUser as public; + json as public; + file as public; + isGranted as public; + denyAccessUnlessGranted as public; + redirectToRoute as public; + addFlash as public; + isCsrfTokenValid as public; + renderView as public; + render as public; + stream as public; + createNotFoundException as public; + createAccessDeniedException as public; + createForm as public; + createFormBuilder as public; + getDoctrine as public; + addLink as public; + } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/MissingUserProviderTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/MissingUserProviderTest.php index 47d68b4f68..d795980b3e 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/MissingUserProviderTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/MissingUserProviderTest.php @@ -24,6 +24,7 @@ class MissingUserProviderTest extends AbstractWebTestCase $response = $client->getResponse(); $this->assertSame(500, $response->getStatusCode()); + $this->stringContains('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException', $response->getContent()); $this->stringContains('"default" firewall requires a user provider but none was defined.', $response->getContent()); } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/MissingUserProvider/bundles.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/MissingUserProvider/bundles.php index ccff0d356c..cb3ed2b05f 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/MissingUserProvider/bundles.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/MissingUserProvider/bundles.php @@ -16,5 +16,6 @@ use Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\MissingUserProviderBun return [ new FrameworkBundle(), new SecurityBundle(), + new Symfony\Bundle\TwigBundle\TwigBundle(), new MissingUserProviderBundle(), ]; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/MissingUserProvider/config.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/MissingUserProvider/config.yml index 501a673b4f..52f9948da2 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/MissingUserProvider/config.yml +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/MissingUserProvider/config.yml @@ -1,5 +1,5 @@ imports: - - { resource: ./../config/framework.yml } + - { resource: ./../config/default.yml } security: firewalls: diff --git a/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php b/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php index 518ff37af6..f44447967d 100644 --- a/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php @@ -20,61 +20,6 @@ use Symfony\Component\BrowserKit\Response; use Symfony\Component\DomCrawler\Crawler; use Symfony\Component\DomCrawler\Form as DomCrawlerForm; -class SpecialResponse extends Response -{ -} - -class TestClient extends AbstractBrowser -{ - protected $nextResponse = null; - protected $nextScript = null; - - public function setNextResponse(Response $response) - { - $this->nextResponse = $response; - } - - public function setNextScript($script) - { - $this->nextScript = $script; - } - - protected function doRequest($request): Response - { - if (null === $this->nextResponse) { - return new Response(); - } - - $response = $this->nextResponse; - $this->nextResponse = null; - - return $response; - } - - protected function filterResponse($response): Response - { - if ($response instanceof SpecialResponse) { - return new Response($response->getContent(), $response->getStatusCode(), $response->getHeaders()); - } - - return $response; - } - - protected function getScript($request) - { - $r = new \ReflectionClass('Symfony\Component\BrowserKit\Response'); - $path = $r->getFileName(); - - return <<nextScript); -EOF; - } -} - class AbstractBrowserTest extends TestCase { public function getBrowser(array $server = [], History $history = null, CookieJar $cookieJar = null) @@ -160,17 +105,6 @@ class AbstractBrowserTest extends TestCase $this->assertNull($client->getResponse()); } - public function testGetInternalResponse() - { - $client = $this->getBrowser(); - $client->setNextResponse(new SpecialResponse('foo')); - $client->request('GET', 'http://example.com/'); - - $this->assertInstanceOf('Symfony\Component\BrowserKit\Response', $client->getInternalResponse()); - $this->assertNotInstanceOf('Symfony\Component\BrowserKit\Tests\SpecialResponse', $client->getInternalResponse()); - $this->assertInstanceOf('Symfony\Component\BrowserKit\Tests\SpecialResponse', $client->getResponse()); - } - /** * @group legacy * @expectedDeprecation Calling the "Symfony\Component\BrowserKit\Tests\%s::getInternalResponse()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0. diff --git a/src/Symfony/Component/BrowserKit/Tests/ClassThatInheritClient.php b/src/Symfony/Component/BrowserKit/Tests/ClassThatInheritClient.php new file mode 100644 index 0000000000..9f6a55ae9d --- /dev/null +++ b/src/Symfony/Component/BrowserKit/Tests/ClassThatInheritClient.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\BrowserKit\Tests; + +use Symfony\Component\BrowserKit\AbstractBrowser; +use Symfony\Component\BrowserKit\Response; +use Symfony\Component\DomCrawler\Crawler; +use Symfony\Component\DomCrawler\Form as DomCrawlerForm; + +class ClassThatInheritClient extends AbstractBrowser +{ + protected $nextResponse = null; + + public function setNextResponse(Response $response) + { + $this->nextResponse = $response; + } + + protected function doRequest($request): Response + { + if (null === $this->nextResponse) { + return new Response(); + } + + $response = $this->nextResponse; + $this->nextResponse = null; + + return $response; + } + + public function submit(DomCrawlerForm $form, array $values = []): Crawler + { + return parent::submit($form, $values); + } +} diff --git a/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php b/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php index 3d9db8e31b..44eed997bd 100644 --- a/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php @@ -14,89 +14,9 @@ namespace Symfony\Component\BrowserKit\Tests; use Symfony\Component\BrowserKit\CookieJar; use Symfony\Component\BrowserKit\History; use Symfony\Component\BrowserKit\HttpBrowser; -use Symfony\Component\BrowserKit\Response; -use Symfony\Component\HttpClient\MockHttpClient; -use Symfony\Component\HttpClient\Response\MockResponse; use Symfony\Contracts\HttpClient\HttpClientInterface; use Symfony\Contracts\HttpClient\ResponseInterface; -class SpecialHttpResponse extends Response -{ -} - -class TestHttpClient extends HttpBrowser -{ - protected $nextResponse = null; - protected $nextScript = null; - - public function __construct(array $server = [], History $history = null, CookieJar $cookieJar = null) - { - $client = new MockHttpClient(function (string $method, string $url, array $options) { - if (null === $this->nextResponse) { - return new MockResponse(); - } - - return new MockResponse($this->nextResponse->getContent(), [ - 'http_code' => $this->nextResponse->getStatusCode(), - 'response_headers' => $this->nextResponse->getHeaders(), - ]); - }); - parent::__construct($client); - - $this->setServerParameters($server); - $this->history = $history ?? new History(); - $this->cookieJar = $cookieJar ?? new CookieJar(); - } - - public function setNextResponse(Response $response) - { - $this->nextResponse = $response; - } - - public function setNextScript($script) - { - $this->nextScript = $script; - } - - protected function filterResponse($response): Response - { - if ($response instanceof SpecialHttpResponse) { - return new Response($response->getContent(), $response->getStatusCode(), $response->getHeaders()); - } - - return $response; - } - - protected function doRequest($request): Response - { - $response = parent::doRequest($request); - - if (null === $this->nextResponse) { - return $response; - } - - $class = \get_class($this->nextResponse); - $response = new $class($response->getContent(), $response->getStatusCode(), $response->getHeaders()); - $this->nextResponse = null; - - return $response; - } - - protected function getScript($request) - { - $r = new \ReflectionClass('Symfony\Component\BrowserKit\Response'); - $path = $r->getFileName(); - - return <<nextScript); -EOF; - } -} - class HttpBrowserTest extends AbstractBrowserTest { public function getBrowser(array $server = [], History $history = null, CookieJar $cookieJar = null) @@ -104,17 +24,6 @@ class HttpBrowserTest extends AbstractBrowserTest return new TestHttpClient($server, $history, $cookieJar); } - public function testGetInternalResponse() - { - $client = $this->getBrowser(); - $client->setNextResponse(new SpecialHttpResponse('foo')); - $client->request('GET', 'http://example.com/'); - - $this->assertInstanceOf('Symfony\Component\BrowserKit\Response', $client->getInternalResponse()); - $this->assertNotInstanceOf('Symfony\Component\BrowserKit\Tests\SpecialHttpResponse', $client->getInternalResponse()); - $this->assertInstanceOf('Symfony\Component\BrowserKit\Tests\SpecialHttpResponse', $client->getResponse()); - } - /** * @dataProvider validContentTypes */ diff --git a/src/Symfony/Component/BrowserKit/Tests/TestClient.php b/src/Symfony/Component/BrowserKit/Tests/TestClient.php new file mode 100644 index 0000000000..0efa48b98b --- /dev/null +++ b/src/Symfony/Component/BrowserKit/Tests/TestClient.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\BrowserKit\Tests; + +use Symfony\Component\BrowserKit\AbstractBrowser; +use Symfony\Component\BrowserKit\Response; + +class TestClient extends AbstractBrowser +{ + protected $nextResponse = null; + protected $nextScript = null; + + public function setNextResponse(Response $response) + { + $this->nextResponse = $response; + } + + public function setNextScript($script) + { + $this->nextScript = $script; + } + + protected function doRequest($request): Response + { + if (null === $this->nextResponse) { + return new Response(); + } + + $response = $this->nextResponse; + $this->nextResponse = null; + + return $response; + } + + protected function getScript($request) + { + $r = new \ReflectionClass('Symfony\Component\BrowserKit\Response'); + $path = $r->getFileName(); + + return <<nextScript); +EOF; + } +} diff --git a/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php b/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php new file mode 100644 index 0000000000..cbdc2ae1d2 --- /dev/null +++ b/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\BrowserKit\Tests; + +use Symfony\Component\BrowserKit\CookieJar; +use Symfony\Component\BrowserKit\History; +use Symfony\Component\BrowserKit\HttpBrowser; +use Symfony\Component\BrowserKit\Response; +use Symfony\Component\HttpClient\MockHttpClient; +use Symfony\Component\HttpClient\Response\MockResponse; + +class TestHttpClient extends HttpBrowser +{ + protected $nextResponse = null; + protected $nextScript = null; + + public function __construct(array $server = [], History $history = null, CookieJar $cookieJar = null) + { + $client = new MockHttpClient(function (string $method, string $url, array $options) { + if (null === $this->nextResponse) { + return new MockResponse(); + } + + return new MockResponse($this->nextResponse->getContent(), [ + 'http_code' => $this->nextResponse->getStatusCode(), + 'response_headers' => $this->nextResponse->getHeaders(), + ]); + }); + parent::__construct($client); + + $this->setServerParameters($server); + $this->history = $history ?? new History(); + $this->cookieJar = $cookieJar ?? new CookieJar(); + } + + public function setNextResponse(Response $response) + { + $this->nextResponse = $response; + } + + public function setNextScript($script) + { + $this->nextScript = $script; + } + + protected function doRequest($request): Response + { + if (null === $this->nextResponse) { + return parent::doRequest($request); + } + + $response = $this->nextResponse; + $this->nextResponse = null; + + return $response; + } + + protected function getScript($request) + { + $r = new \ReflectionClass('Symfony\Component\BrowserKit\Response'); + $path = $r->getFileName(); + + return <<nextScript); +EOF; + } +} diff --git a/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php index 4ac870292e..8de52465a8 100644 --- a/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php @@ -1337,14 +1337,3 @@ HTML; return $domxpath->query('//div'); } } - -class ClassThatInheritCrawler extends Crawler -{ - /** - * @return static - */ - public function children() - { - return parent::children(); - } -} diff --git a/src/Symfony/Component/DomCrawler/Tests/ClassThatInheritCrawler.php b/src/Symfony/Component/DomCrawler/Tests/ClassThatInheritCrawler.php new file mode 100644 index 0000000000..2b2ac1092e --- /dev/null +++ b/src/Symfony/Component/DomCrawler/Tests/ClassThatInheritCrawler.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DomCrawler\Tests; + +use Symfony\Component\DomCrawler\Crawler; + +class ClassThatInheritCrawler extends Crawler +{ + /** + * @return static + */ + public function children() + { + return parent::children(); + } +} diff --git a/src/Symfony/Component/Finder/Tests/ClassThatInheritFinder.php b/src/Symfony/Component/Finder/Tests/ClassThatInheritFinder.php new file mode 100644 index 0000000000..f937f6247c --- /dev/null +++ b/src/Symfony/Component/Finder/Tests/ClassThatInheritFinder.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests; + +use Symfony\Component\Finder\Finder; + +class ClassThatInheritFinder extends Finder +{ + /** + * @return $this + */ + public function sortByName() + { + parent::sortByName(); + } +} diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php index 48ef921a86..16a5b2a2f2 100644 --- a/src/Symfony/Component/Finder/Tests/FinderTest.php +++ b/src/Symfony/Component/Finder/Tests/FinderTest.php @@ -873,6 +873,7 @@ class FinderTest extends Iterator\RealIteratorTestCase $expected = [ self::$tmpDir.\DIRECTORY_SEPARATOR.'test.php', + __DIR__.\DIRECTORY_SEPARATOR.'ClassThatInheritFinder.php', __DIR__.\DIRECTORY_SEPARATOR.'GitignoreTest.php', __DIR__.\DIRECTORY_SEPARATOR.'FinderTest.php', __DIR__.\DIRECTORY_SEPARATOR.'GlobTest.php', @@ -1435,14 +1436,3 @@ class FinderTest extends Iterator\RealIteratorTestCase return Finder::create(); } } - -class ClassThatInheritFinder extends Finder -{ - /** - * @return $this - */ - public function sortByName() - { - parent::sortByName(); - } -} diff --git a/src/Symfony/Component/Form/Tests/AbstractTypeExtensionTest.php b/src/Symfony/Component/Form/Tests/AbstractTypeExtensionTest.php index 48e6a9145f..b50812ffa1 100644 --- a/src/Symfony/Component/Form/Tests/AbstractTypeExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractTypeExtensionTest.php @@ -12,12 +12,13 @@ namespace Symfony\Component\Form\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\Form\AbstractTypeExtension; use Symfony\Component\Form\Extension\Core\Type\DateTimeType; -use Symfony\Component\Form\Extension\Core\Type\DateType; class AbstractTypeExtensionTest extends TestCase { + /** + * @group legacy + */ public function testImplementingNeitherGetExtendedTypeNorExtendsTypeThrowsException() { $this->expectException('Symfony\Component\Form\Exception\LogicException'); @@ -28,6 +29,7 @@ class AbstractTypeExtensionTest extends TestCase /** * @group legacy + * @expectedDeprecation The Symfony\Component\Form\Tests\MultipleTypesExtension::getExtendedType() method is deprecated since Symfony 4.2 and will be removed in 5.0. Use getExtendedTypes() instead. */ public function testGetExtendedTypeReturnsFirstConfiguredExtension() { @@ -36,16 +38,3 @@ class AbstractTypeExtensionTest extends TestCase $this->assertSame(DateTimeType::class, $extension->getExtendedType()); } } - -class MultipleTypesExtension extends AbstractTypeExtension -{ - public static function getExtendedTypes(): iterable - { - yield DateTimeType::class; - yield DateType::class; - } -} - -class TypeExtensionWithoutExtendedTypes extends AbstractTypeExtension -{ -} diff --git a/src/Symfony/Component/Form/Tests/MultipleTypesExtension.php b/src/Symfony/Component/Form/Tests/MultipleTypesExtension.php new file mode 100644 index 0000000000..3eca855f5e --- /dev/null +++ b/src/Symfony/Component/Form/Tests/MultipleTypesExtension.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests; + +use Symfony\Component\Form\AbstractTypeExtension; +use Symfony\Component\Form\Extension\Core\Type\DateTimeType; +use Symfony\Component\Form\Extension\Core\Type\DateType; + +class MultipleTypesExtension extends AbstractTypeExtension +{ + public static function getExtendedTypes(): iterable + { + yield DateTimeType::class; + yield DateType::class; + } +} diff --git a/src/Symfony/Component/Form/Tests/TypeExtensionWithoutExtendedTypes.php b/src/Symfony/Component/Form/Tests/TypeExtensionWithoutExtendedTypes.php new file mode 100644 index 0000000000..edad8fc732 --- /dev/null +++ b/src/Symfony/Component/Form/Tests/TypeExtensionWithoutExtendedTypes.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests; + +use Symfony\Component\Form\AbstractTypeExtension; + +class TypeExtensionWithoutExtendedTypes extends AbstractTypeExtension +{ +} diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php index 968429b8f7..38966edf2c 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php @@ -159,7 +159,7 @@ class ExceptionListenerTest extends TestCase class TestLogger extends Logger implements DebugLoggerInterface { - public function countErrors(): int + public function countErrors(Request $request = null): int { return \count($this->logs['critical']); } diff --git a/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpReceiver.php b/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpReceiver.php index 53c6e75054..068b0cba83 100644 --- a/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpReceiver.php +++ b/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpReceiver.php @@ -58,9 +58,11 @@ class AmqpReceiver implements ReceiverInterface, MessageCountAwareInterface return; } + $body = $amqpEnvelope->getBody(); + try { $envelope = $this->serializer->decode([ - 'body' => $amqpEnvelope->getBody(), + 'body' => false === $body ? '' : $body, // workaround https://github.com/pdezwart/php-amqp/issues/351 'headers' => $amqpEnvelope->getHeaders(), ]); } catch (MessageDecodingFailedException $exception) { diff --git a/src/Symfony/Component/Routing/Router.php b/src/Symfony/Component/Routing/Router.php index 9d583315e2..c1be087994 100644 --- a/src/Symfony/Component/Routing/Router.php +++ b/src/Symfony/Component/Routing/Router.php @@ -23,11 +23,13 @@ use Symfony\Component\Routing\Generator\CompiledUrlGenerator; use Symfony\Component\Routing\Generator\ConfigurableRequirementsInterface; use Symfony\Component\Routing\Generator\Dumper\CompiledUrlGeneratorDumper; use Symfony\Component\Routing\Generator\Dumper\GeneratorDumperInterface; +use Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper; use Symfony\Component\Routing\Generator\UrlGenerator; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Matcher\CompiledUrlMatcher; use Symfony\Component\Routing\Matcher\Dumper\CompiledUrlMatcherDumper; use Symfony\Component\Routing\Matcher\Dumper\MatcherDumperInterface; +use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper; use Symfony\Component\Routing\Matcher\RequestMatcherInterface; use Symfony\Component\Routing\Matcher\UrlMatcher; use Symfony\Component\Routing\Matcher\UrlMatcherInterface; @@ -388,6 +390,11 @@ class Router implements RouterInterface, RequestMatcherInterface */ protected function getGeneratorDumperInstance() { + // For BC, fallback to PhpGeneratorDumper if the UrlGenerator and UrlGeneratorDumper are not consistent with each other + if (is_a($this->options['generator_class'], CompiledUrlGenerator::class, true) !== is_a($this->options['generator_dumper_class'], CompiledUrlGeneratorDumper::class, true)) { + return new PhpGeneratorDumper($this->getRouteCollection()); + } + return new $this->options['generator_dumper_class']($this->getRouteCollection()); } @@ -396,6 +403,11 @@ class Router implements RouterInterface, RequestMatcherInterface */ protected function getMatcherDumperInstance() { + // For BC, fallback to PhpMatcherDumper if the UrlMatcher and UrlMatcherDumper are not consistent with each other + if (is_a($this->options['matcher_class'], CompiledUrlMatcher::class, true) !== is_a($this->options['matcher_dumper_class'], CompiledUrlMatcherDumper::class, true)) { + return new PhpMatcherDumper($this->getRouteCollection()); + } + return new $this->options['matcher_dumper_class']($this->getRouteCollection()); } diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php index a446e61602..51790688e7 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php @@ -172,6 +172,10 @@ class FakeCustomToken implements TokenInterface { } + public function getRoleNames(): array + { + } + public function getCredentials() { }