Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3644b70

Browse files
committed
feature #32241 [PropertyAccess] Deprecate null as allowed value for defaultLifetime argument in createCache method (jschaedl)
This PR was squashed before being merged into the 4.4 branch (closes #32241). Discussion ---------- [PropertyAccess] Deprecate null as allowed value for defaultLifetime argument in createCache method | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #32179 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | N/A<!-- required for new features --> This PR is related to #32234 (comment) Commits ------- 9aac426 [PropertyAccess] Deprecate null as allowed value for defaultLifetime argument in createCache method
2 parents 905c863 + 9aac426 commit 3644b70

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1869,7 +1869,7 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
18691869

18701870
if (!$container->getParameter('kernel.debug')) {
18711871
$propertyAccessDefinition->setFactory([PropertyAccessor::class, 'createCache']);
1872-
$propertyAccessDefinition->setArguments([null, null, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]);
1872+
$propertyAccessDefinition->setArguments([null, 0, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]);
18731873
$propertyAccessDefinition->addTag('cache.pool', ['clearer' => 'cache.system_clearer']);
18741874
$propertyAccessDefinition->addTag('monolog.logger', ['channel' => 'cache']);
18751875
} else {

src/Symfony/Component/PropertyAccess/PropertyAccessor.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,10 @@ private function getPropertyPath($propertyPath): PropertyPath
828828
*/
829829
public static function createCache($namespace, $defaultLifetime, $version, LoggerInterface $logger = null)
830830
{
831+
if (null === $defaultLifetime) {
832+
@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);
833+
}
834+
831835
if (!class_exists('Symfony\Component\Cache\Adapter\ApcuAdapter')) {
832836
throw new \LogicException(sprintf('The Symfony Cache component must be installed to use %s().', __METHOD__));
833837
}

0 commit comments

Comments
 (0)