diff --git a/UPGRADE-3.3.md b/UPGRADE-3.3.md index 44044e7358..ae1985740f 100644 --- a/UPGRADE-3.3.md +++ b/UPGRADE-3.3.md @@ -303,7 +303,7 @@ Security * The `RoleInterface` has been deprecated. Extend the `Symfony\Component\Security\Core\Role\Role` class in your custom role implementations instead. - * The `LogoutUrlGenerator::registerListener()` method will expect a 6th `$context = null` argument in 4.0. + * The `LogoutUrlGenerator::registerListener()` method will expect a 6th `string $context = null` argument in 4.0. Define the argument when overriding this method. * The `AccessDecisionManager::setVoters()` method has been deprecated. Pass diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 6424371880..4b040fd203 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -426,7 +426,7 @@ Security * The `RoleInterface` has been removed. Extend the `Symfony\Component\Security\Core\Role\Role` class instead. - * The `LogoutUrlGenerator::registerListener()` method expects a 6th `$context = null` argument. + * The `LogoutUrlGenerator::registerListener()` method expects a 6th `string $context = null` argument. * The `AccessDecisionManager::setVoters()` method has been removed. Pass the voters to the constructor instead. diff --git a/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php b/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php index 599940e8d7..fb258808f3 100644 --- a/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php @@ -54,12 +54,12 @@ class ServerLogHandler extends AbstractHandler $recordFormatted = $this->formatRecord($record); - if (!fwrite($this->socket, $recordFormatted)) { - fclose($this->socket); + if (-1 === stream_socket_sendto($this->socket, $recordFormatted)) { + stream_socket_shutdown($this->socket, STREAM_SHUT_RDWR); // Let's retry: the persistent connection might just be stale if ($this->socket = $this->createSocket()) { - fwrite($this->socket, $recordFormatted); + stream_socket_sendto($this->socket, $recordFormatted); } } } finally { diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php index f8814c3c84..173a0fa82f 100644 --- a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php +++ b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php @@ -16,7 +16,6 @@ use PHPUnit\Framework\AssertionFailedError; use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestSuite; use PHPUnit\Util\Blacklist; -use PHPUnit\Util\Test; use Symfony\Bridge\PhpUnit\ClockMock; use Symfony\Bridge\PhpUnit\DnsMock; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 993bae7f4a..a09171e4a0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -49,11 +49,13 @@ use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface; use Symfony\Component\PropertyInfo\PropertyListExtractorInterface; use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface; use Symfony\Component\Serializer\Encoder\CsvEncoder; +use Symfony\Component\Serializer\Encoder\DecoderInterface; use Symfony\Component\Serializer\Encoder\EncoderInterface; use Symfony\Component\Serializer\Encoder\YamlEncoder; use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory; use Symfony\Component\Serializer\Normalizer\DataUriNormalizer; use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer; +use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Validator\ConstraintValidatorInterface; @@ -285,8 +287,12 @@ class FrameworkExtension extends Extension ->addTag('property_info.access_extractor'); $container->registerForAutoconfiguration(EncoderInterface::class) ->addTag('serializer.encoder'); + $container->registerForAutoconfiguration(DecoderInterface::class) + ->addTag('serializer.encoder'); $container->registerForAutoconfiguration(NormalizerInterface::class) ->addTag('serializer.normalizer'); + $container->registerForAutoconfiguration(DenormalizerInterface::class) + ->addTag('serializer.normalizer'); $container->registerForAutoconfiguration(ConstraintValidatorInterface::class) ->addTag('validator.constraint_validator'); $container->registerForAutoconfiguration(ObjectInitializerInterface::class) diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php index 50d5320227..eed32c5a20 100644 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php +++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php @@ -47,7 +47,7 @@ class ServerLogCommand extends Command } $this - ->addOption('host', null, InputOption::VALUE_REQUIRED, 'The server host', '0:9911') + ->addOption('host', null, InputOption::VALUE_REQUIRED, 'The server host', '0.0.0.0:9911') ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The line format', ConsoleFormatter::SIMPLE_FORMAT) ->addOption('date-format', null, InputOption::VALUE_REQUIRED, 'The date format', ConsoleFormatter::SIMPLE_DATE) ->addOption('filter', null, InputOption::VALUE_REQUIRED, 'An expression to filter log. Example: "level > 200 or channel in [\'app\', \'doctrine\']"') diff --git a/src/Symfony/Component/DependencyInjection/CHANGELOG.md b/src/Symfony/Component/DependencyInjection/CHANGELOG.md index 7e03a50856..a85de7dff8 100644 --- a/src/Symfony/Component/DependencyInjection/CHANGELOG.md +++ b/src/Symfony/Component/DependencyInjection/CHANGELOG.md @@ -37,6 +37,7 @@ CHANGELOG * deprecated the ability to set or unset a private service with the `Container::set()` method * deprecated the ability to check for the existence of a private service with the `Container::has()` method * deprecated the ability to request a private service with the `Container::get()` method + * deprecated support for generating a dumped `Container` without populating the method map 3.0.0 ----- diff --git a/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php b/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php index 8a2ef34f5b..43d65bdfd3 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php @@ -77,7 +77,7 @@ class Compiler * @param string $type The type of the pass * @param int $priority Used to sort the passes */ - public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, $priority = 0*/) + public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, int $priority = 0*/) { if (func_num_args() >= 3) { $priority = func_get_arg(2); @@ -85,7 +85,7 @@ class Compiler if (__CLASS__ !== get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s() will have a third `$priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', __METHOD__), E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php index a3ef360991..1e80a6060a 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php @@ -108,7 +108,7 @@ class PassConfig * * @throws InvalidArgumentException when a pass type doesn't exist */ - public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_OPTIMIZATION/*, $priority = 0*/) + public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_OPTIMIZATION/*, int $priority = 0*/) { if (func_num_args() >= 3) { $priority = func_get_arg(2); @@ -116,7 +116,7 @@ class PassConfig if (__CLASS__ !== get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s() will have a third `$priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', __METHOD__), E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php index 35733c72d0..193a37e20b 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php @@ -86,7 +86,7 @@ class ServiceReferenceGraph * @param string $reference * @param bool $lazy */ - public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null/*, $lazy = false*/) + public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null/*, bool $lazy = false*/) { if (func_num_args() >= 6) { $lazy = func_get_arg(5); @@ -94,7 +94,7 @@ class ServiceReferenceGraph if (__CLASS__ !== get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s() will have a 6th `$lazy = false` argument in version 4.0. Not defining it is deprecated since 3.3.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a 6th `bool $lazy = false` argument in version 4.0. Not defining it is deprecated since 3.3.', __METHOD__), E_USER_DEPRECATED); } } $lazy = false; diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 30c8614b3e..0a2d673c78 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -448,7 +448,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface * * @return $this */ - public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, $priority = 0*/) + public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, int $priority = 0*/) { if (func_num_args() >= 3) { $priority = func_get_arg(2); @@ -456,7 +456,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface if (__CLASS__ !== get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s() will have a third `$priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', __METHOD__), E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 66a6c56bf5..baec10f7e9 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1429,24 +1429,29 @@ EOF; } if ($value instanceof IteratorArgument) { - $countCode = array(); - $countCode[] = 'function () {'; $operands = array(0); - $code = array(); $code[] = 'new RewindableGenerator(function () {'; - foreach ($value->getValues() as $k => $v) { - ($c = $this->getServiceConditionals($v)) ? $operands[] = "(int) ($c)" : ++$operands[0]; - $v = $this->wrapServiceConditionals($v, sprintf(" yield %s => %s;\n", $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate))); - foreach (explode("\n", $v) as $v) { - if ($v) { - $code[] = ' '.$v; + + if (!$values = $value->getValues()) { + $code[] = ' return new \EmptyIterator();'; + } else { + $countCode = array(); + $countCode[] = 'function () {'; + + foreach ($values as $k => $v) { + ($c = $this->getServiceConditionals($v)) ? $operands[] = "(int) ($c)" : ++$operands[0]; + $v = $this->wrapServiceConditionals($v, sprintf(" yield %s => %s;\n", $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate))); + foreach (explode("\n", $v) as $v) { + if ($v) { + $code[] = ' '.$v; + } } } - } - $countCode[] = sprintf(' return %s;', implode(' + ', $operands)); - $countCode[] = ' }'; + $countCode[] = sprintf(' return %s;', implode(' + ', $operands)); + $countCode[] = ' }'; + } $code[] = sprintf(' }, %s)', count($operands) > 1 ? implode("\n", $countCode) : $operands[0]); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 05c549bcce..3558c7bd22 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -449,12 +449,17 @@ class ContainerBuilderTest extends TestCase $builder->register('bar', 'stdClass'); $builder ->register('lazy_context', 'LazyContext') - ->setArguments(array(new IteratorArgument(array('k1' => new Reference('bar'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))))) + ->setArguments(array( + new IteratorArgument(array('k1' => new Reference('bar'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))), + new IteratorArgument(array()), + )) ; $lazyContext = $builder->get('lazy_context'); $this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyValues); + $this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyEmptyValues); $this->assertCount(1, $lazyContext->lazyValues); + $this->assertCount(0, $lazyContext->lazyEmptyValues); $i = 0; foreach ($lazyContext->lazyValues as $k => $v) { @@ -465,6 +470,13 @@ class ContainerBuilderTest extends TestCase // The second argument should have been ignored. $this->assertEquals(1, $i); + + $i = 0; + foreach ($lazyContext->lazyEmptyValues as $k => $v) { + ++$i; + } + + $this->assertEquals(0, $i); } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index e2269538d4..744384b136 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -436,7 +436,10 @@ class PhpDumperTest extends TestCase $container->register('lazy_referenced', 'stdClass'); $container ->register('lazy_context', 'LazyContext') - ->setArguments(array(new IteratorArgument(array('k1' => new Reference('lazy_referenced'), 'k2' => new Reference('service_container'))))) + ->setArguments(array( + new IteratorArgument(array('k1' => new Reference('lazy_referenced'), 'k2' => new Reference('service_container'))), + new IteratorArgument(array()), + )) ; $container->compile(); @@ -447,6 +450,9 @@ class PhpDumperTest extends TestCase $lazyContext = $container->get('lazy_context'); $this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyValues); + $this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyEmptyValues); + $this->assertCount(2, $lazyContext->lazyValues); + $this->assertCount(0, $lazyContext->lazyEmptyValues); $i = -1; foreach ($lazyContext->lazyValues as $k => $v) { @@ -461,6 +467,8 @@ class PhpDumperTest extends TestCase break; } } + + $this->assertEmpty(iterator_to_array($lazyContext->lazyEmptyValues)); } public function testClosureProxy() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php index 9a18388be0..2a31ec6d76 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php @@ -134,11 +134,11 @@ $container ; $container ->register('lazy_context', 'LazyContext') - ->setArguments(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container'))))) + ->setArguments(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container'))), new IteratorArgument(array()))) ; $container ->register('lazy_context_ignore_invalid_ref', 'LazyContext') - ->setArguments(array(new IteratorArgument(array(new Reference('foo.baz'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))))) + ->setArguments(array(new IteratorArgument(array(new Reference('foo.baz'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))), new IteratorArgument(array()))) ; $container ->register('closure_proxy', 'BarClass') diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php index 8ccbbcd438..68fd01cf84 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php @@ -102,9 +102,11 @@ class DummyProxyDumper implements ProxyDumper class LazyContext { public $lazyValues; + public $lazyEmptyValues; - public function __construct($lazyValues) + public function __construct($lazyValues, $lazyEmptyValues) { $this->lazyValues = $lazyValues; + $this->lazyEmptyValues = $lazyEmptyValues; } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php index d59f315c2c..b8d5aeafac 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php @@ -323,7 +323,9 @@ class ProjectServiceContainer extends Container return $this->services['lazy_context'] = new \LazyContext(new RewindableGenerator(function () { yield 'k1' => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->get('foo.baz')) && false ?: '_'}; yield 'k2' => $this; - }, 2)); + }, 2), new RewindableGenerator(function () { + return new \EmptyIterator(); + }, 0)); } /** @@ -343,7 +345,9 @@ class ProjectServiceContainer extends Container } }, function () { return 1 + (int) ($this->has('invalid')); - })); + }), new RewindableGenerator(function () { + return new \EmptyIterator(); + }, 0)); } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index f35ca89f03..a519cece6e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -326,7 +326,9 @@ class ProjectServiceContainer extends Container return $this->services['lazy_context'] = new \LazyContext(new RewindableGenerator(function () { yield 'k1' => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->get('foo.baz')) && false ?: '_'}; yield 'k2' => $this; - }, 2)); + }, 2), new RewindableGenerator(function () { + return new \EmptyIterator(); + }, 0)); } /** @@ -341,7 +343,9 @@ class ProjectServiceContainer extends Container { return $this->services['lazy_context_ignore_invalid_ref'] = new \LazyContext(new RewindableGenerator(function () { yield 0 => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->get('foo.baz')) && false ?: '_'}; - }, 1)); + }, 1), new RewindableGenerator(function () { + return new \EmptyIterator(); + }, 0)); } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml index 792c515995..79fdff4c4e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml @@ -121,12 +121,14 @@ + + diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml index 519567054e..bfee29fb60 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml @@ -112,10 +112,10 @@ services: factory: ['@factory_simple', getInstance] lazy_context: class: LazyContext - arguments: [!iterator {'k1': '@foo.baz', 'k2': '@service_container'}] + arguments: [!iterator {'k1': '@foo.baz', 'k2': '@service_container'}, !iterator []] lazy_context_ignore_invalid_ref: class: LazyContext - arguments: [!iterator ['@foo.baz', '@?invalid']] + arguments: [!iterator ['@foo.baz', '@?invalid'], !iterator []] closure_proxy: class: BarClass arguments: [!closure_proxy ['@closure_proxy', getBaz]] diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index 3a6e94aae0..41d1c48d54 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -273,7 +273,7 @@ class XmlFileLoaderTest extends TestCase $lazyDefinition = $container->getDefinition('lazy_context'); - $this->assertEquals(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container')))), $lazyDefinition->getArguments(), '->load() parses lazy arguments'); + $this->assertEquals(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container'))), new IteratorArgument(array())), $lazyDefinition->getArguments(), '->load() parses lazy arguments'); } public function testParsesTags() @@ -659,7 +659,6 @@ class XmlFileLoaderTest extends TestCase $this->assertFalse($container->getDefinition('no_defaults')->isAutowired()); - $this->assertTrue($container->getDefinition('child_def')->isPublic()); $this->assertSame(array('foo' => array(array())), $container->getDefinition('child_def')->getTags()); $this->assertFalse($container->getDefinition('child_def')->isAutowired()); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 8de64d55f4..2c655d7189 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -346,7 +346,7 @@ class YamlFileLoaderTest extends TestCase $lazyDefinition = $container->getDefinition('lazy_context'); - $this->assertEquals(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container')))), $lazyDefinition->getArguments(), '->load() parses lazy arguments'); + $this->assertEquals(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container'))), new IteratorArgument(array())), $lazyDefinition->getArguments(), '->load() parses lazy arguments'); } public function testAutowire() diff --git a/src/Symfony/Component/Ldap/CHANGELOG.md b/src/Symfony/Component/Ldap/CHANGELOG.md new file mode 100644 index 0000000000..61af4adf15 --- /dev/null +++ b/src/Symfony/Component/Ldap/CHANGELOG.md @@ -0,0 +1,7 @@ +CHANGELOG +========= + +3.1.0 +----- + + * The `LdapClient` class is deprecated. Use the `Ldap` class instead. diff --git a/src/Symfony/Component/Ldap/LdapClient.php b/src/Symfony/Component/Ldap/LdapClient.php index 0a68c05875..b20c7ea482 100644 --- a/src/Symfony/Component/Ldap/LdapClient.php +++ b/src/Symfony/Component/Ldap/LdapClient.php @@ -18,7 +18,7 @@ namespace Symfony\Component\Ldap; * @author Francis Besset * @author Charles Sarrazin * - * @deprecated The LdapClient class will be removed in Symfony 4.0. You should use the Ldap class instead. + * @deprecated since version 3.1, to be removed in 4.0. Use the Ldap class instead. */ final class LdapClient implements LdapClientInterface { diff --git a/src/Symfony/Component/Ldap/LdapClientInterface.php b/src/Symfony/Component/Ldap/LdapClientInterface.php index 020e4b5589..0872ee082e 100644 --- a/src/Symfony/Component/Ldap/LdapClientInterface.php +++ b/src/Symfony/Component/Ldap/LdapClientInterface.php @@ -19,7 +19,7 @@ namespace Symfony\Component\Ldap; * @author Grégoire Pineau * @author Charles Sarrazin * - * @deprecated You should use LdapInterface instead + * @deprecated since version 3.1, to be removed in 4.0. Use the LdapInterface instead. */ interface LdapClientInterface extends LdapInterface { diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php index d65e8e7cc5..b18808eb40 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php @@ -35,7 +35,7 @@ class LdapBindAuthenticationProviderTest extends TestCase public function testEmptyPasswordShouldThrowAnException() { $userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock(); - $ldap = $this->getMockBuilder('Symfony\Component\Ldap\LdapClientInterface')->getMock(); + $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock(); $provider = new LdapBindAuthenticationProvider($userProvider, $userChecker, 'key', $ldap); diff --git a/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php b/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php index 1c37229389..3f2def8d73 100644 --- a/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php +++ b/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php @@ -48,7 +48,7 @@ class LogoutUrlGenerator * @param CsrfTokenManagerInterface|null $csrfTokenManager A CsrfTokenManagerInterface instance * @param string|null $context The listener context */ - public function registerListener($key, $logoutPath, $csrfTokenId, $csrfParameter, CsrfTokenManagerInterface $csrfTokenManager = null/*, $context = null*/) + public function registerListener($key, $logoutPath, $csrfTokenId, $csrfParameter, CsrfTokenManagerInterface $csrfTokenManager = null/*, string $context = null*/) { if (func_num_args() >= 6) { $context = func_get_arg(5); @@ -56,7 +56,7 @@ class LogoutUrlGenerator if (__CLASS__ !== get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s() will have a sixth `$context = null` argument in version 4.0. Not defining it is deprecated since 3.3.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a sixth `string $context = null` argument in version 4.0. Not defining it is deprecated since 3.3.', __METHOD__), E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index db55db06de..97d9a5c9f6 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -302,7 +302,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N * * @throws RuntimeException */ - protected function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes/*, $format = null*/) + protected function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes/*, string $format = null*/) { if (func_num_args() >= 6) { $format = func_get_arg(5); @@ -310,7 +310,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N if (__CLASS__ !== get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s::%s() will have a 6th `$format = null` argument in version 4.0. Not defining it is deprecated since 3.2.', get_class($this), __FUNCTION__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s::%s() will have a 6th `string $format = null` argument in version 4.0. Not defining it is deprecated since 3.2.', get_class($this), __FUNCTION__), E_USER_DEPRECATED); } }