- Client HTTP user agent has been changed to 'Symfony BrowserKit' (was 'Symfony2 BrowserKit' before).
-
Setting unknown style options is deprecated and will throw an exception in Symfony 4.0.
-
The
QuestionHelper::setInputStream()method is deprecated and will be removed in Symfony 4.0. UseStreamableInputInterface::setStream()orCommandTester::setInputs()instead.Before:
$input = new ArrayInput(); $questionHelper->setInputStream($stream); $questionHelper->ask($input, $output, $question);
After:
$input = new ArrayInput(); $input->setStream($stream); $questionHelper->ask($input, $output, $question);
Before:
$commandTester = new CommandTester($command); $stream = fopen('php://memory', 'r+', false); fputs($stream, "AppBundle\nYes"); rewind($stream); $command->getHelper('question')->setInputStream($stream); $commandTester->execute();
After:
$commandTester = new CommandTester($command); $commandTester->setInputs(array('AppBundle', 'Yes')); $commandTester->execute();
-
Calling
get()on aContainerBuilderinstance before compiling the container is deprecated and will throw an exception in Symfony 4.0. -
Setting or unsetting a private service with the
Container::set()method is deprecated. Only public services can be set or unset in Symfony 4.0. -
Checking the existence of a private service with the
Container::has()method is deprecated and will returnfalsein Symfony 4.0. -
Requesting a private service with the
Container::get()method is deprecated and will no longer be supported in Symfony 4.0.
- Passing a
ParserCacheInterfaceinstance to theExpressionLanguagehas been deprecated and will not be supported in Symfony 4.0. You should use theCacheItemPoolInterfaceinterface instead.
-
Calling
isValid()on aForminstance before submitting it is deprecated and will throw an exception in Symfony 4.0.Before:
if ($form->isValid()) { // ... }
After:
if ($form->isSubmitted() && $form->isValid()) { // ... }
- The
doctrine/annotationsdependency has been removed; require it viacomposer require doctrine/annotationsif you are using annotations in your project - The
symfony/security-coreandsymfony/security-csrfdependencies have been removed; require them viacomposer require symfony/security-core symfony/security-csrfif you depend on them and don't already depend onsymfony/symfony - The
symfony/templatingdependency has been removed; require it viacomposer require symfony/templatingif you depend on it and don't already depend onsymfony/symfony - The
symfony/translationdependency has been removed; require it viacomposer require symfony/translationif you depend on it and don't already depend onsymfony/symfony - The
symfony/assetdependency has been removed; require it viacomposer require symfony/assetif you depend on it and don't already depend onsymfony/symfony - The
Resources/public/images/*files have been removed. - The
Resources/public/css/*.cssfiles have been removed (they are now inlined in TwigBundle). - The service
serializer.mapping.cache.doctrine.apcis deprecated. APCu should now be automatically used when available.
-
Extending the following methods of
Responseis deprecated (these methods will befinalin 4.0):setDate/getDatesetExpires/getExpiressetLastModified/getLastModifiedsetProtocolVersion/getProtocolVersionsetStatusCode/getStatusCodesetCharset/getCharsetsetPrivate/setPublicgetAgegetMaxAge/setMaxAgesetSharedMaxAgegetTtl/setTtlsetClientTtlgetEtag/setEtaghasVary/getVary/setVaryisInvalid/isSuccessful/isRedirection/isClientError/isServerErrorisOk/isForbidden/isNotFound/isRedirect/isEmpty
-
Checking only for cacheable HTTP methods with
Request::isMethodSafe()is deprecated since version 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method withfalseas first argument or useRequest::isMethodCacheable()instead.
-
DataCollector::varToString()is deprecated and will be removed in Symfony 4.0. Use thecloneVar()method instead. -
Surrogate name in a
Surrogate-CapabilityHTTP request header has been changed to 'symfony'.Before:
Surrogate-Capability: symfony2="ESI/1.0"
After:
Surrogate-Capability: symfony="ESI/1.0"
UrlGeneratornow generates URLs in compliance withRFC 3986, which means spaces will be percent encoded (%20) inside query strings.
- Method
AbstractNormalizer::instantiateObject()will have a 6th$format = nullargument in Symfony 4.0. Not defining it when overriding the method is deprecated.
-
Injecting the Form
TwigRendererinto theFormExtensionis deprecated and has no more effect. Upgrade Twig to^1.30, inject theTwig_Environmentinto theTwigRendererEngineand load theTwigRendererusing theTwig_FactoryRuntimeLoaderinstead.Before:
use Symfony\Bridge\Twig\Extension\FormExtension; use Symfony\Bridge\Twig\Form\TwigRenderer; use Symfony\Bridge\Twig\Form\TwigRendererEngine; // ... $rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig')); $rendererEngine->setEnvironment($twig); $twig->addExtension(new FormExtension(new TwigRenderer($rendererEngine, $csrfTokenManager)));
After:
$rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'), $twig); $twig->addRuntimeLoader(new \Twig_FactoryRuntimeLoader(array( TwigRenderer::class => function () use ($rendererEngine, $csrfTokenManager) { return new TwigRenderer($rendererEngine, $csrfTokenManager); }, ))); $twig->addExtension(new FormExtension());
-
Deprecated the
TwigRendererEngineInterfaceinterface, it will be removed in 4.0.
-
Tests\Constraints\AbstractConstraintValidatorTesthas been deprecated in favor ofTest\ConstraintValidatorTestCase.Before:
// ... use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest; class MyCustomValidatorTest extends AbstractConstraintValidatorTest { // ... }
After:
// ... use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; class MyCustomValidatorTest extends ConstraintValidatorTestCase { // ... }
-
Setting the strict option of the
ChoiceConstraint tofalsehas been deprecated and the option will be changed totrueas of 4.0.// ... use Symfony\Component\Validator\Constraints as Assert; class MyEntity { /** * @Assert\Choice(choices={"MR", "MRS"}, strict=true) */ private $salutation; }
-
Support for silently ignoring duplicate mapping keys in YAML has been deprecated and will lead to a
ParseExceptionin Symfony 4.0. -
Mappings with a colon (
:) that is not followed by a whitespace are deprecated and will lead to aParseExceptionin Symfony 4.0 (e.g.foo:barmust befoo: bar).