diff --git a/UPGRADE-4.2.md b/UPGRADE-4.2.md index 2b13e8b758993..b85ffffae2c10 100644 --- a/UPGRADE-4.2.md +++ b/UPGRADE-4.2.md @@ -1,6 +1,11 @@ UPGRADE FROM 4.1 to 4.2 ======================= +BrowserKit +---------- + + * The `Client::submit()` method will have a new `$serverParameters` argument in version 5.0, not defining it is deprecated. + Cache ----- @@ -37,6 +42,16 @@ DoctrineBridge * The `lazy` attribute on `doctrine.event_listener` tags was removed. Listeners are now lazy by default. So any `lazy` attributes can safely be removed from those tags. +DomCrawler +---------- + + * The `Crawler::children()` method will have a new `$selector` argument in version 5.0, not defining it is deprecated. + +Finder +------ + + * The `Finder::sortByName()` method will have a new `$useNaturalSort` argument in version 5.0, not defining it is deprecated. + Form ---- @@ -123,6 +138,11 @@ Messenger ]; ``` +Monolog +------- + + * The methods `DebugProcessor::getLogs()`, `DebugProcessor::countErrors()`, `Logger::getLogs()` and `Logger::countErrors()` will have a new `$request` argument in version 5.0, not defining it is deprecated. + Security -------- @@ -149,8 +169,9 @@ SecurityBundle Serializer ---------- - * Relying on the default value (false) of the "as_collection" option is deprecated since 4.2. + * Relying on the default value (false) of the "as_collection" option is deprecated. You should set it to false explicitly instead as true will be the default value in 5.0. + * The `AbstractNormalizer::handleCircularReference()` method will have two new `$format` and `$context` arguments in version 5.0, not defining them is deprecated. Translation ----------- diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index 23be0dcf556ce..daf7ede46385b 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -1,6 +1,11 @@ UPGRADE FROM 4.x to 5.0 ======================= +BrowserKit +---------- + + * The `Client::submit()` method has a new `$serverParameters` argument. + Cache ----- @@ -49,11 +54,21 @@ DoctrineBridge * Deprecated injecting `ClassMetadataFactory` in `DoctrineExtractor`, an instance of `EntityManagerInterface` should be injected instead +DomCrawler +---------- + + * The `Crawler::children()` method has a new `$selector` argument. + EventDispatcher --------------- * The `TraceableEventDispatcherInterface` has been removed. +Finder +------ + + * The `Finder::sortByName()` method has a new `$useNaturalSort` argument. + FrameworkBundle --------------- @@ -101,6 +116,11 @@ HttpFoundation * The `getClientSize()` method of the `UploadedFile` class has been removed. * The `getSession()` method of the `Request` class throws an exception when session is null. +Monolog +------- + + * The methods `DebugProcessor::getLogs()`, `DebugProcessor::countErrors()`, `Logger::getLogs()` and `Logger::countErrors()` have a new `$request` argument. + Process ------- @@ -142,6 +162,11 @@ SecurityBundle * The `security.authentication.trust_resolver.anonymous_class` parameter has been removed. * The `security.authentication.trust_resolver.rememberme_class` parameter has been removed. +Serializer +---------- + + * The `AbstractNormalizer::handleCircularReference()` method has two new `$format` and `$context` arguments. + Translation ----------- diff --git a/src/Symfony/Bridge/Monolog/CHANGELOG.md b/src/Symfony/Bridge/Monolog/CHANGELOG.md index 6d984c218a4d6..cf5c9d3db838a 100644 --- a/src/Symfony/Bridge/Monolog/CHANGELOG.md +++ b/src/Symfony/Bridge/Monolog/CHANGELOG.md @@ -5,6 +5,9 @@ CHANGELOG ----- * added `ProcessorInterface`: an optional interface to allow autoconfiguration of Monolog processors + * The methods `DebugProcessor::getLogs()`, `DebugProcessor::countErrors()`, `Logger::getLogs()` + and `Logger::countErrors()` will have a new `$request` argument in version 5.0, not defining + it is deprecated since Symfony 4.2. 4.1.0 ----- diff --git a/src/Symfony/Bridge/Monolog/Logger.php b/src/Symfony/Bridge/Monolog/Logger.php index ba5caf06ea115..a3950d5bbf254 100644 --- a/src/Symfony/Bridge/Monolog/Logger.php +++ b/src/Symfony/Bridge/Monolog/Logger.php @@ -28,6 +28,10 @@ class Logger extends BaseLogger implements DebugLoggerInterface, ResetInterface */ public function getLogs(/* Request $request = null */) { + if (\func_num_args() < 1 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { + @trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); + } + if ($logger = $this->getDebugLogger()) { return \call_user_func_array(array($logger, 'getLogs'), \func_get_args()); } @@ -40,6 +44,10 @@ public function getLogs(/* Request $request = null */) */ public function countErrors(/* Request $request = null */) { + if (\func_num_args() < 1 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { + @trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); + } + if ($logger = $this->getDebugLogger()) { return \call_user_func_array(array($logger, 'countErrors'), \func_get_args()); } diff --git a/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php b/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php index 13f8a2de3e48a..1a8c7edd85e64 100644 --- a/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php +++ b/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php @@ -61,6 +61,10 @@ public function __invoke(array $record) */ public function getLogs(/* Request $request = null */) { + if (\func_num_args() < 1 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { + @trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); + } + if (1 <= \func_num_args() && null !== ($request = \func_get_arg(0)) && isset($this->records[$hash = spl_object_hash($request)])) { return $this->records[$hash]; } @@ -77,6 +81,10 @@ public function getLogs(/* Request $request = null */) */ public function countErrors(/* Request $request = null */) { + if (\func_num_args() < 1 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { + @trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); + } + if (1 <= \func_num_args() && null !== ($request = \func_get_arg(0)) && isset($this->errorCount[$hash = spl_object_hash($request)])) { return $this->errorCount[$hash]; } diff --git a/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php b/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php index 46156adbd8b79..6ffade80731bf 100644 --- a/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php @@ -107,4 +107,37 @@ public function testClear() $this->assertEmpty($logger->getLogs()); $this->assertSame(0, $logger->countErrors()); } + + /** + * @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. + */ + public function testInheritedClassCallGetLogsWithoutArgument() + { + $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() + { + parent::getLogs(); + } + + public function countErrors() + { + parent::countErrors(); + } } diff --git a/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php b/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php index 9acaf6074ec88..d7a83dca7c1b9 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php @@ -60,6 +60,26 @@ public function testWithRequestStack() $this->assertSame(1, $processor->countErrors($request)); } + /** + * @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. + */ + public function testInheritedClassCallGetLogsWithoutArgument() + { + $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(); + } + private function getRecord($level = Logger::WARNING, $message = 'test') { return array( @@ -73,3 +93,16 @@ private function getRecord($level = Logger::WARNING, $message = 'test') ); } } + +class ClassThatInheritDebugProcessor extends DebugProcessor +{ + public function getLogs() + { + parent::getLogs(); + } + + public function countErrors() + { + parent::countErrors(); + } +} diff --git a/src/Symfony/Component/BrowserKit/CHANGELOG.md b/src/Symfony/Component/BrowserKit/CHANGELOG.md index ceb1af7c2ad5a..55ff9e28033ef 100644 --- a/src/Symfony/Component/BrowserKit/CHANGELOG.md +++ b/src/Symfony/Component/BrowserKit/CHANGELOG.md @@ -1,6 +1,12 @@ CHANGELOG ========= +4.2.0 +----- + + * The method `Client::submit()` will have a new `$serverParameters` argument + in version 5.0, not defining it is deprecated since version 4.2 + 3.4.0 ----- diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index f2a4a7d1dd7e6..e3056a31207a4 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -311,6 +311,10 @@ public function clickLink(string $linkText): Crawler */ public function submit(Form $form, array $values = array()/*, array $serverParameters = array()*/) { + if (\func_num_args() < 3 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { + @trigger_error(sprintf('The "%s()" method will have a new "array $serverParameters = array()" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); + } + $form->setValues($values); $serverParameters = 2 < \func_num_args() ? func_get_arg(2) : array(); diff --git a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php index 28005d25888d7..36de64c32de64 100644 --- a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php @@ -16,6 +16,7 @@ use Symfony\Component\BrowserKit\CookieJar; use Symfony\Component\BrowserKit\History; use Symfony\Component\BrowserKit\Response; +use Symfony\Component\DomCrawler\Form as DomCrawlerForm; class SpecialResponse extends Response { @@ -877,4 +878,42 @@ public function testInternalRequestNull() $client = new TestClient(); $this->assertNull($client->getInternalRequest()); } + + /** + * @group legacy + * @expectedDeprecation The "Symfony\Component\BrowserKit\Client::submit()" method will have a new "array $serverParameters = array()" argument in version 5.0, not defining it is deprecated since Symfony 4.2. + */ + public function testInheritedClassCallSubmitWithTwoArguments() + { + $clientChild = new ClassThatInheritClient(); + $clientChild->setNextResponse(new Response('
')); + $clientChild->submit($clientChild->request('GET', 'http://www.example.com/foo/foobar')->filter('input')->form()); + } +} + +class ClassThatInheritClient extends Client +{ + protected $nextResponse = null; + + public function setNextResponse(Response $response) + { + $this->nextResponse = $response; + } + + protected function doRequest($request) + { + if (null === $this->nextResponse) { + return new Response(); + } + + $response = $this->nextResponse; + $this->nextResponse = null; + + return $response; + } + + public function submit(DomCrawlerForm $form, array $values = array()) + { + return parent::submit($form, $values); + } } diff --git a/src/Symfony/Component/DomCrawler/CHANGELOG.md b/src/Symfony/Component/DomCrawler/CHANGELOG.md index c2065c5911541..c8c6c823258d4 100644 --- a/src/Symfony/Component/DomCrawler/CHANGELOG.md +++ b/src/Symfony/Component/DomCrawler/CHANGELOG.md @@ -6,6 +6,8 @@ CHANGELOG * The `$currentUri` constructor argument of the `AbstractUriElement`, `Link` and `Image` classes is now optional. +* The `Crawler::children()` method will have a new `$selector` argument in version 5.0, + not defining it is deprecated since version 4.2. 3.1.0 ----- diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 373c5edb636e3..360ddbe26b3a3 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -510,6 +510,9 @@ public function parents() */ public function children(/* string $selector = null */) { + if (\func_num_args() < 1 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { + @trigger_error(sprintf('The "%s()" method will have a new "string $selector = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); + } $selector = 0 < \func_num_args() ? func_get_arg(0) : null; if (!$this->nodes) { diff --git a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php index 294c2f6bf8f92..9e73eaae1d9c2 100644 --- a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php @@ -1148,6 +1148,62 @@ public function testEvaluateThrowsAnExceptionIfDocumentIsEmpty() (new Crawler())->evaluate('//form/input[1]'); } + /** + * @group legacy + * @expectedDeprecation The "Symfony\Component\DomCrawler\Crawler::children()" method will have a new "string $selector = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2. + */ + public function testInheritedClassCallChildrenWithoutArgument() + { + $dom = new \DOMDocument(); + $dom->loadHTML(' + + + Foo + Fabien\'s Foo + Fabien"s Foo + \' Fabien"s Foo + +Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: