diff --git a/UPGRADE-3.3.md b/UPGRADE-3.3.md
index ae1985740f..c068b378f5 100644
--- a/UPGRADE-3.3.md
+++ b/UPGRADE-3.3.md
@@ -244,6 +244,10 @@ FrameworkBundle
class has been deprecated and will be removed in 4.0. Use the
`Symfony\Component\Workflow\DependencyInjection\ValidateWorkflowsPass` class instead.
+ * Passing an array of validators or validator aliases as the second argument of
+ `ConstraintValidatorFactory::__construct()` is deprecated since 3.3 and will
+ be removed in 4.0. Use the service locator instead.
+
HttpFoundation
--------------
@@ -262,7 +266,7 @@ HttpKernel
* Deprecated the `Kernel::getRootDir()` method. Use the new `Kernel::getProjectDir()`
method instead.
- * The `Extension::addClassesToCompile()` method has been deprecated and will be removed in 4.0.
+ * The `Extension::addClassesToCompile()` and `Extension::getClassesToCompile()` methods have been deprecated and will be removed in 4.0.
* The `Psr6CacheClearer::addPool()` method has been deprecated. Pass an array
of pools indexed by name to the constructor instead.
diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md
index e4d9df88d6..70c6f8e7e6 100644
--- a/UPGRADE-4.0.md
+++ b/UPGRADE-4.0.md
@@ -301,6 +301,10 @@ FrameworkBundle
* Extending `ConstraintValidatorFactory` is not supported anymore.
+ * Passing an array of validators or validator aliases as the second argument of
+ `ConstraintValidatorFactory::__construct()` has been removed.
+ Use the service locator instead.
+
* Class parameters related to routing have been removed
* router.options.generator_class
* router.options.generator_base_class
@@ -374,7 +378,7 @@ HttpKernel
* Removed the `Kernel::getRootDir()` method. Use the `Kernel::getProjectDir()`
method instead.
- * The `Extension::addClassesToCompile()` method has been removed.
+ * The `Extension::addClassesToCompile()` and `Extension::getClassesToCompile()` methods have been removed.
* Possibility to pass non-scalar values as URI attributes to the ESI and SSI
renderers has been removed. The inline fragment renderer should be used with
diff --git a/src/Symfony/Bridge/PhpUnit/CHANGELOG.md b/src/Symfony/Bridge/PhpUnit/CHANGELOG.md
index daaa369e49..1cb07da782 100644
--- a/src/Symfony/Bridge/PhpUnit/CHANGELOG.md
+++ b/src/Symfony/Bridge/PhpUnit/CHANGELOG.md
@@ -8,3 +8,9 @@ CHANGELOG
deprecated, use the `@group legacy` notation instead
* using the `Legacy` prefix in class names to mark a test as legacy is deprecated,
use the `@group legacy` notation instead
+
+3.1.0
+-----
+
+ * passing a numerically indexed array to the constructor of the `SymfonyTestsListenerTrait`
+ is deprecated, pass an array of namespaces indexed by the mocked feature instead
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt
index 7bbda8775d..7e9c6f8ed7 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt
+++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt
@@ -17,6 +17,8 @@ require PHPUNIT_COMPOSER_INSTALL;
require_once __DIR__.'/../../bootstrap.php';
require __DIR__.'/fake_vendor/autoload.php';
require __DIR__.'/fake_vendor/acme/lib/deprecation_riddled.php';
+
+?>
--EXPECTF--
Unsilenced deprecation notices (2)
diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
index 82d52706d9..51e13a8430 100644
--- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
+++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
@@ -79,7 +79,7 @@
{{- block('choice_widget_options') -}}
{%- else -%}
-
+
{%- endif -%}
{% endfor %}
{%- endblock choice_widget_options -%}
@@ -259,7 +259,7 @@
{% set label = name|humanize %}
{%- endif -%}
{%- endif -%}
-
+
{%- endif -%}
{%- endblock form_label -%}
diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
index df80163243..b7473b5812 100644
--- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
+++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
@@ -49,6 +49,7 @@ CHANGELOG
`Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass` instead
* Deprecated `ValidateWorkflowsPass`, use
`Symfony\Component\Workflow\DependencyInjection\ValidateWorkflowsPass` instead
+ * Deprecated `ConstraintValidatorFactory::__construct()` second argument.
3.2.0
-----
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
index 76705f08d5..6db6da85e0 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
@@ -46,7 +46,6 @@ class AboutCommand extends ContainerAwareCommand
/** @var $kernel KernelInterface */
$kernel = $this->getContainer()->get('kernel');
- $baseDir = realpath($kernel->getRootDir().DIRECTORY_SEPARATOR.'..');
$io->table(array(), array(
array('Symfony>'),
@@ -62,9 +61,9 @@ class AboutCommand extends ContainerAwareCommand
array('Environment', $kernel->getEnvironment()),
array('Debug', $kernel->isDebug() ? 'true' : 'false'),
array('Charset', $kernel->getCharset()),
- array('Root directory', self::formatPath($kernel->getRootDir(), $baseDir)),
- array('Cache directory', self::formatPath($kernel->getCacheDir(), $baseDir).' ('.self::formatFileSize($kernel->getCacheDir()).'>)'),
- array('Log directory', self::formatPath($kernel->getLogDir(), $baseDir).' ('.self::formatFileSize($kernel->getLogDir()).'>)'),
+ array('Root directory', self::formatPath($kernel->getRootDir(), $kernel->getProjectDir())),
+ array('Cache directory', self::formatPath($kernel->getCacheDir(), $kernel->getProjectDir()).' ('.self::formatFileSize($kernel->getCacheDir()).'>)'),
+ array('Log directory', self::formatPath($kernel->getLogDir(), $kernel->getProjectDir()).' ('.self::formatFileSize($kernel->getLogDir()).'>)'),
new TableSeparator(),
array('PHP>'),
new TableSeparator(),
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php
index feb966d850..136b1c21fa 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php
@@ -82,9 +82,7 @@ EOT
$targetArg = rtrim($input->getArgument('target'), '/');
if (!is_dir($targetArg)) {
- $appRoot = $this->getContainer()->getParameter('kernel.root_dir').'/..';
-
- $targetArg = $appRoot.'/'.$targetArg;
+ $targetArg = $this->getContainer()->getParameter('kernel.project_dir').'/'.$targetArg;
if (!is_dir($targetArg)) {
throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
index 49284270e6..02aad425c2 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
@@ -201,6 +201,7 @@ EOF
{
$cacheDir = var_export($warmupDir, true);
$rootDir = var_export(realpath($parent->getRootDir()), true);
+ $projectDir = var_export(realpath($parent->getProjectDir()), true);
$logDir = var_export(realpath($parent->getLogDir()), true);
// the temp kernel class name must have the same length than the real one
// to avoid the many problems in serialized resources files
@@ -224,6 +225,11 @@ namespace $namespace
return $rootDir;
}
+ public function getProjectDir()
+ {
+ return $projectDir;
+ }
+
public function getLogDir()
{
return $logDir;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php
index 6cf9574ece..38a1190ade 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php
@@ -14,7 +14,10 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Validator;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory;
use Symfony\Component\DependencyInjection\Container;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\Blank as BlankConstraint;
+use Symfony\Component\Validator\ConstraintValidator;
class ConstraintValidatorFactoryTest extends TestCase
{
@@ -41,6 +44,38 @@ class ConstraintValidatorFactoryTest extends TestCase
}
public function testGetInstanceReturnsService()
+ {
+ $service = 'validator_constraint_service';
+ $validator = $this->getMockForAbstractClass(ConstraintValidator::class);
+
+ // mock ContainerBuilder b/c it implements TaggedContainerInterface
+ $container = $this->getMockBuilder(ContainerBuilder::class)->setMethods(array('get', 'has'))->getMock();
+ $container
+ ->expects($this->once())
+ ->method('get')
+ ->with($service)
+ ->willReturn($validator);
+ $container
+ ->expects($this->once())
+ ->method('has')
+ ->with($service)
+ ->willReturn(true);
+
+ $constraint = $this->getMockBuilder(Constraint::class)->getMock();
+ $constraint
+ ->expects($this->once())
+ ->method('validatedBy')
+ ->will($this->returnValue($service));
+
+ $factory = new ConstraintValidatorFactory($container);
+ $this->assertSame($validator, $factory->getInstance($constraint));
+ }
+
+ /**
+ * @group legacy
+ * @expectedDeprecation Passing an array of validators or validator aliases as the second argument of "Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory::__construct" is deprecated since 3.3 and will be removed in 4.0. Use the service locator instead.
+ */
+ public function testGetInstanceReturnsServiceWithAlias()
{
$service = 'validator_constraint_service';
$alias = 'validator_constraint_alias';
diff --git a/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php b/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php
index aba02e0944..49cd5fe113 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php
@@ -45,15 +45,16 @@ class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface
protected $container;
protected $validators;
- /**
- * Constructor.
- *
- * @param ContainerInterface $container The service container
- * @param array $validators An array of validators
- */
- public function __construct(ContainerInterface $container, array $validators = array())
+ public function __construct(ContainerInterface $container, array $validators = null)
{
$this->container = $container;
+
+ if (null !== $validators) {
+ @trigger_error(sprintf('Passing an array of validators or validator aliases as the second argument of "%s" is deprecated since 3.3 and will be removed in 4.0. Use the service locator instead.', __METHOD__), E_USER_DEPRECATED);
+ } else {
+ $validators = array();
+ }
+
$this->validators = $validators;
}
@@ -82,6 +83,7 @@ class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface
$this->validators[$name] = new $name();
}
} elseif (is_string($this->validators[$name])) {
+ // To be removed in 4.0
$this->validators[$name] = $this->container->get($this->validators[$name]);
}
diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
index a54244d67c..4191506f1e 100644
--- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
+++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
@@ -98,11 +98,11 @@ class SecurityExtension extends Extension
if ($config['encoders']) {
$this->createEncoders($config['encoders'], $container);
+ }
- if (class_exists(Application::class)) {
- $loader->load('console.xml');
- $container->getDefinition('security.console.user_password_encoder_command')->replaceArgument(1, array_keys($config['encoders']));
- }
+ if (class_exists(Application::class)) {
+ $loader->load('console.xml');
+ $container->getDefinition('security.console.user_password_encoder_command')->replaceArgument(1, array_keys($config['encoders']));
}
// load ACL
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php
index bfa0f1b877..6ef0e305ec 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php
@@ -345,6 +345,11 @@ abstract class CompleteConfigurationTest extends TestCase
$this->assertEquals('security.user_checker', $this->getContainer('container1')->getAlias('security.user_checker.secure'));
}
+ public function testUserPasswordEncoderCommandIsRegistered()
+ {
+ $this->assertTrue($this->getContainer('remember_me_options')->has('security.console.user_password_encoder_command'));
+ }
+
protected function getContainer($file)
{
$file = $file.'.'.$this->getFileExtension();
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig
index ea73c8bde7..28e3a3c838 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig
@@ -107,8 +107,8 @@
{% if profile.parent %}
-