[PropertyAccess] Deprecate null as allowed value for defaultLifetime argument in createCache method

This commit is contained in:
Jan Schädlich 2019-06-28 08:03:02 +02:00 committed by Fabien Potencier
parent b92e4ed9d4
commit 9aac42698a
2 changed files with 5 additions and 1 deletions

View File

@ -1865,7 +1865,7 @@ class FrameworkExtension extends Extension
if (!$container->getParameter('kernel.debug')) {
$propertyAccessDefinition->setFactory([PropertyAccessor::class, 'createCache']);
$propertyAccessDefinition->setArguments([null, null, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]);
$propertyAccessDefinition->setArguments([null, 0, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]);
$propertyAccessDefinition->addTag('cache.pool', ['clearer' => 'cache.system_clearer']);
$propertyAccessDefinition->addTag('monolog.logger', ['channel' => 'cache']);
} else {

View File

@ -828,6 +828,10 @@ class PropertyAccessor implements PropertyAccessorInterface
*/
public static function createCache($namespace, $defaultLifetime, $version, LoggerInterface $logger = null)
{
if (null === $defaultLifetime) {
@trigger_error(sprintf('Passing null as "$defaultLifetime" 2nd argument of the "%s()" method is deprecated since Symfony 4.4, pass 0 instead.', __METHOD__), E_USER_DEPRECATED);
}
if (!class_exists('Symfony\Component\Cache\Adapter\ApcuAdapter')) {
throw new \LogicException(sprintf('The Symfony Cache component must be installed to use %s().', __METHOD__));
}