From 531156e0039ecafb165a9b330bb27dc917da61a9 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Sat, 20 May 2017 11:00:43 +0200 Subject: [PATCH] [FrameworkBundle] Remove deprecated code --- .../Bundle/FrameworkBundle/CHANGELOG.md | 6 + .../Command/CacheClearCommand.php | 197 +----------------- .../DependencyInjection/Configuration.php | 6 - .../FrameworkExtension.php | 13 +- .../FrameworkBundle/FrameworkBundle.php | 8 - .../FrameworkBundle/Resources/config/form.xml | 101 --------- .../Resources/config/form_csrf.xml | 7 - .../Resources/config/routing.xml | 24 +-- .../Resources/config/serializer.xml | 11 - .../Templating/TemplateNameParser.php | 13 +- .../CacheClearCommandTest.php | 39 +--- .../FrameworkExtensionTest.php | 15 -- .../Templating/TemplateNameParserTest.php | 25 --- .../Validator/ConstraintValidatorFactory.php | 4 +- 14 files changed, 26 insertions(+), 443 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md index e7af6de4c027..d04634686161 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md @@ -11,6 +11,12 @@ CHANGELOG `RoutingResolverPass`, `SerializerPass`, `ValidateWorkflowsPass` * made `Translator::__construct()` `$defaultLocale` argument required * removed `SessionListener`, `TestSessionListener` + * Removed `cache:clear` warmup part along with the `--no-optional-warmers` option + * Removed core form types services registration when unnecessary + * Removed `framework.serializer.cache` option and `serializer.mapping.cache.apc`, `serializer.mapping.cache.doctrine.apc` services + * Removed `ConstraintValidatorFactory::$validators` and `ConstraintValidatorFactory::$container` protected properties + * Removed class parameters related to routing + * Removed absolute template paths support in the template name parser 3.3.0 ----- diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index 49284270e6e3..0a70d9a85911 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -15,8 +15,6 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Symfony\Component\HttpKernel\KernelInterface; -use Symfony\Component\Finder\Finder; /** * Clear and Warmup the cache. @@ -34,8 +32,7 @@ protected function configure() $this ->setName('cache:clear') ->setDefinition(array( - new InputOption('no-warmup', '', InputOption::VALUE_NONE, 'Do not warm up the cache'), - new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'), + new InputOption('no-warmup', '', InputOption::VALUE_NONE, 'Noop. Will be deprecated in 4.1 to be removed in 5.0.'), )) ->setDescription('Clears the cache') ->setHelp(<<<'EOF' @@ -56,37 +53,22 @@ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); - $realCacheDir = $this->getContainer()->getParameter('kernel.cache_dir'); - // the old cache dir name must not be longer than the real one to avoid exceeding - // the maximum length of a directory or file path within it (esp. Windows MAX_PATH) - $oldCacheDir = substr($realCacheDir, 0, -1).('~' === substr($realCacheDir, -1) ? '+' : '~'); + $cacheDir = $this->getContainer()->getParameter('kernel.cache_dir'); $filesystem = $this->getContainer()->get('filesystem'); - if (!is_writable($realCacheDir)) { - throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $realCacheDir)); - } - - if ($filesystem->exists($oldCacheDir)) { - $filesystem->remove($oldCacheDir); + if (!is_writable($cacheDir)) { + throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $cacheDir)); } $kernel = $this->getContainer()->get('kernel'); $io->comment(sprintf('Clearing the cache for the %s environment with debug %s', $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); - $this->getContainer()->get('cache_clearer')->clear($realCacheDir); - - if ($input->getOption('no-warmup')) { - $filesystem->rename($realCacheDir, $oldCacheDir); - } else { - @trigger_error('Calling cache:clear without the --no-warmup option is deprecated since version 3.3. Cache warmup should be done with the cache:warmup command instead.', E_USER_DEPRECATED); - - $this->warmupCache($input, $output, $realCacheDir, $oldCacheDir); - } + $this->getContainer()->get('cache_clearer')->clear($cacheDir); if ($output->isVerbose()) { $io->comment('Removing old cache directory...'); } - $filesystem->remove($oldCacheDir); + $filesystem->remove($cacheDir); if ($output->isVerbose()) { $io->comment('Finished'); @@ -94,171 +76,4 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->success(sprintf('Cache for the "%s" environment (debug=%s) was successfully cleared.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); } - - private function warmupCache(InputInterface $input, OutputInterface $output, $realCacheDir, $oldCacheDir) - { - $filesystem = $this->getContainer()->get('filesystem'); - $io = new SymfonyStyle($input, $output); - - // the warmup cache dir name must have the same length than the real one - // to avoid the many problems in serialized resources files - $realCacheDir = realpath($realCacheDir); - $warmupDir = substr($realCacheDir, 0, -1).('_' === substr($realCacheDir, -1) ? '-' : '_'); - - if ($filesystem->exists($warmupDir)) { - if ($output->isVerbose()) { - $io->comment('Clearing outdated warmup directory...'); - } - $filesystem->remove($warmupDir); - } - - if ($output->isVerbose()) { - $io->comment('Warming up cache...'); - } - $this->warmup($warmupDir, $realCacheDir, !$input->getOption('no-optional-warmers')); - - $filesystem->rename($realCacheDir, $oldCacheDir); - if ('\\' === DIRECTORY_SEPARATOR) { - sleep(1); // workaround for Windows PHP rename bug - } - $filesystem->rename($warmupDir, $realCacheDir); - } - - /** - * @param string $warmupDir - * @param string $realCacheDir - * @param bool $enableOptionalWarmers - * - * @internal to be removed in 4.0 - */ - protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = true) - { - // create a temporary kernel - $realKernel = $this->getContainer()->get('kernel'); - $realKernelClass = get_class($realKernel); - $namespace = ''; - if (false !== $pos = strrpos($realKernelClass, '\\')) { - $namespace = substr($realKernelClass, 0, $pos); - $realKernelClass = substr($realKernelClass, $pos + 1); - } - $tempKernel = $this->getTempKernel($realKernel, $namespace, $realKernelClass, $warmupDir); - $tempKernel->boot(); - - $tempKernelReflection = new \ReflectionObject($tempKernel); - $tempKernelFile = $tempKernelReflection->getFileName(); - - // warmup temporary dir - $warmer = $tempKernel->getContainer()->get('cache_warmer'); - if ($enableOptionalWarmers) { - $warmer->enableOptionalWarmers(); - } - $warmer->warmUp($warmupDir); - - // fix references to the Kernel in .meta files - $safeTempKernel = str_replace('\\', '\\\\', get_class($tempKernel)); - $realKernelFQN = get_class($realKernel); - - foreach (Finder::create()->files()->name('*.meta')->in($warmupDir) as $file) { - file_put_contents($file, preg_replace( - '/(C\:\d+\:)"'.$safeTempKernel.'"/', - sprintf('$1"%s"', $realKernelFQN), - file_get_contents($file) - )); - } - - // fix references to cached files with the real cache directory name - $search = array($warmupDir, str_replace('\\', '\\\\', $warmupDir)); - $replace = str_replace('\\', '/', $realCacheDir); - foreach (Finder::create()->files()->in($warmupDir) as $file) { - $content = str_replace($search, $replace, file_get_contents($file)); - file_put_contents($file, $content); - } - - // fix references to container's class - $tempContainerClass = get_class($tempKernel->getContainer()); - $realContainerClass = get_class($realKernel->getContainer()); - foreach (Finder::create()->files()->name($tempContainerClass.'*')->in($warmupDir) as $file) { - $content = str_replace($tempContainerClass, $realContainerClass, file_get_contents($file)); - file_put_contents($file, $content); - rename($file, str_replace(DIRECTORY_SEPARATOR.$tempContainerClass, DIRECTORY_SEPARATOR.$realContainerClass, $file)); - } - - // remove temp kernel file after cache warmed up - @unlink($tempKernelFile); - } - - /** - * @param KernelInterface $parent - * @param string $namespace - * @param string $parentClass - * @param string $warmupDir - * - * @return KernelInterface - * - * @internal to be removed in 4.0 - */ - protected function getTempKernel(KernelInterface $parent, $namespace, $parentClass, $warmupDir) - { - $cacheDir = var_export($warmupDir, true); - $rootDir = var_export(realpath($parent->getRootDir()), 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 - $class = substr($parentClass, 0, -1).'_'; - // the temp container class must be changed too - $containerClass = var_export(substr(get_class($parent->getContainer()), 0, -1).'_', true); - $code = <<getResources(); - \$filteredResources = array(); - foreach (\$resources as \$resource) { - if ((string) \$resource !== __FILE__) { - \$filteredResources[] = \$resource; - } - } - - \$container->setResources(\$filteredResources); - - return \$container; - } - } -} -EOF; - $this->getContainer()->get('filesystem')->mkdir($warmupDir); - file_put_contents($file = $warmupDir.'/kernel.tmp', $code); - require_once $file; - $class = "$namespace\\$class"; - - return new $class($parent->getEnvironment(), $parent->isDebug()); - } } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 9d09599d811e..e4fed3d17df0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -65,12 +65,6 @@ public function getConfigTreeBuilder() ->info("Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests. Note: When using the HttpCache, you need to call the method in your front controller instead") ->defaultTrue() ->end() - ->arrayNode('trusted_proxies') // @deprecated in version 3.3, to be removed in 4.0 - ->beforeNormalization() - ->always() - ->thenInvalid('The "framework.trusted_proxies" configuration key has been removed in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.') - ->end() - ->end() ->scalarNode('ide')->defaultNull()->end() ->booleanNode('test')->end() ->scalarNode('default_locale')->defaultValue('en')->end() diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 7ab3a4b680a5..a06858343abc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1242,18 +1242,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder $chainLoader->replaceArgument(0, $serializerLoaders); $container->getDefinition('serializer.mapping.cache_warmer')->replaceArgument(0, $serializerLoaders); - if (isset($config['cache']) && $config['cache']) { - @trigger_error('The "framework.serializer.cache" option is deprecated since Symfony 3.1 and will be removed in 4.0. Configure the "cache.serializer" service under "framework.cache.pools" instead.', E_USER_DEPRECATED); - - $container->setParameter( - 'serializer.mapping.cache.prefix', - 'serializer_'.$this->getKernelRootHash($container) - ); - - $container->getDefinition('serializer.mapping.class_metadata_factory')->replaceArgument( - 1, new Reference($config['cache']) - ); - } elseif (!$container->getParameter('kernel.debug') && class_exists(CacheClassMetadataFactory::class)) { + if (!$container->getParameter('kernel.debug') && class_exists(CacheClassMetadataFactory::class)) { $cacheMetadataFactory = new Definition( CacheClassMetadataFactory::class, array( diff --git a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php index 1844f9b4a439..d085059f4afe 100644 --- a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php +++ b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php @@ -60,14 +60,6 @@ public function boot() { ErrorHandler::register(null, false)->throwAt($this->container->getParameter('debug.error_handler.throw_at'), true); - if ($this->container->hasParameter('kernel.trusted_proxies')) { - @trigger_error('The "kernel.trusted_proxies" parameter is deprecated since version 3.3 and will be removed in 4.0. Use the Request::setTrustedProxies() method in your front controller instead.', E_USER_DEPRECATED); - - if ($trustedProxies = $this->container->getParameter('kernel.trusted_proxies')) { - Request::setTrustedProxies($trustedProxies, Request::getTrustedHeaderSet()); - } - } - if ($this->container->getParameter('kernel.http_method_override')) { Request::enableHttpMethodParameterOverride(); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml index 642d8d4ee7bf..ae0be68d1e43 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml @@ -67,97 +67,10 @@ - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - @@ -190,19 +103,5 @@ %validator.translation_domain% - - - - - - - - - - - - - The service "%service_id%" is internal and deprecated since Symfony 3.3 and will be removed in Symfony 4.0 - diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_csrf.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_csrf.xml index 5beec83ccce0..cae1c84aa774 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_csrf.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_csrf.xml @@ -16,12 +16,5 @@ %validator.translation_domain% - - - - - - The service "%service_id%" is internal and deprecated since Symfony 3.3 and will be removed in Symfony 4.0 - diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml index 1278a0cb2208..a5403ba6a533 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml @@ -5,14 +5,6 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - Symfony\Component\Routing\Generator\UrlGenerator - Symfony\Component\Routing\Generator\UrlGenerator - Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper - Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher - Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher - Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper - %router.cache_class_prefix%UrlMatcher - %router.cache_class_prefix%UrlGenerator localhost http @@ -65,14 +57,14 @@ %kernel.cache_dir% %kernel.debug% - %router.options.generator_class% - %router.options.generator_base_class% - %router.options.generator_dumper_class% - %router.options.generator.cache_class% - %router.options.matcher_class% - %router.options.matcher_base_class% - %router.options.matcher_dumper_class% - %router.options.matcher.cache_class% + Symfony\Component\Routing\Generator\UrlGenerator + Symfony\Component\Routing\Generator\UrlGenerator + Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper + %router.cache_class_prefix%UrlGenerator + Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher + Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher + Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper + %router.cache_class_prefix%UrlMatcher diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml index d350091a0182..ced92835ae4d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml @@ -66,17 +66,6 @@ - - - %serializer.mapping.cache.prefix% - - The "%service_id%" service is deprecated since Symfony 3.2 and will be removed in 4.0. APCu should now be automatically used when available. - - - - The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. APCu should now be automatically used when available. - - diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php index c16365ff187b..a98e2e7627f5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php @@ -55,7 +55,7 @@ public function parse($name) throw new \RuntimeException(sprintf('Template name "%s" contains invalid characters.', $name)); } - if ($this->isAbsolutePath($name) || !preg_match('/^(?:([^:]*):([^:]*):)?(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches) || 0 === strpos($name, '@')) { + if (!preg_match('/^(?:([^:]*):([^:]*):)?(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches) || 0 === strpos($name, '@')) { return parent::parse($name); } @@ -71,15 +71,4 @@ public function parse($name) return $this->cache[$name] = $template; } - - private function isAbsolutePath($file) - { - $isAbsolute = (bool) preg_match('#^(?:/|[a-zA-Z]:)#', $file); - - if ($isAbsolute) { - @trigger_error('Absolute template path support is deprecated since Symfony 3.1 and will be removed in 4.0.', E_USER_DEPRECATED); - } - - return $isAbsolute; - } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php index b9fe63ec5bba..5aef68d6e14a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php @@ -14,12 +14,9 @@ use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand\Fixture\TestAppKernel; use Symfony\Bundle\FrameworkBundle\Tests\TestCase; -use Symfony\Component\Config\ConfigCacheFactory; -use Symfony\Component\Config\Resource\ResourceInterface; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Filesystem\Filesystem; -use Symfony\Component\Finder\Finder; class CacheClearCommandTest extends TestCase { @@ -43,10 +40,7 @@ protected function tearDown() $this->fs->remove($this->rootDir); } - /** - * @group legacy - */ - public function testCacheIsFreshAfterCacheClearedWithWarmup() + public function testCacheIsCleared() { $input = new ArrayInput(array('cache:clear')); $application = new Application($this->kernel); @@ -54,35 +48,6 @@ public function testCacheIsFreshAfterCacheClearedWithWarmup() $application->doRun($input, new NullOutput()); - // Ensure that all *.meta files are fresh - $finder = new Finder(); - $metaFiles = $finder->files()->in($this->kernel->getCacheDir())->name('*.php.meta'); - // simply check that cache is warmed up - $this->assertGreaterThanOrEqual(1, count($metaFiles)); - $configCacheFactory = new ConfigCacheFactory(true); - - foreach ($metaFiles as $file) { - $configCacheFactory->cache(substr($file, 0, -5), function () use ($file) { - $this->fail(sprintf('Meta file "%s" is not fresh', (string) $file)); - }); - } - - // check that app kernel file present in meta file of container's cache - $containerRef = new \ReflectionObject($this->kernel->getContainer()); - $containerFile = $containerRef->getFileName(); - $containerMetaFile = $containerFile.'.meta'; - $kernelRef = new \ReflectionObject($this->kernel); - $kernelFile = $kernelRef->getFileName(); - /** @var ResourceInterface[] $meta */ - $meta = unserialize(file_get_contents($containerMetaFile)); - $found = false; - foreach ($meta as $resource) { - if ((string) $resource === $kernelFile) { - $found = true; - break; - } - } - $this->assertTrue($found, 'Kernel file should present as resource'); - $this->assertRegExp(sprintf('/\'kernel.container_class\'\s*=>\s*\'%s\'/', get_class($this->kernel->getContainer())), file_get_contents($containerFile), 'kernel.container_class is properly set on the dumped container'); + $this->assertDirectoryNotExists($this->kernel->getCacheDir()); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index a6a201350214..397afb2265a1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -788,21 +788,6 @@ public function testSerializerCacheDisabled() $this->assertFalse($container->hasDefinition('serializer.mapping.cache_class_metadata_factory')); } - /** - * @group legacy - * @expectedDeprecation The "framework.serializer.cache" option is deprecated %s. - */ - public function testDeprecatedSerializerCacheOption() - { - $container = $this->createContainerFromFile('serializer_legacy_cache', array('kernel.debug' => true, 'kernel.container_class' => __CLASS__)); - - $this->assertFalse($container->hasDefinition('serializer.mapping.cache_class_metadata_factory')); - $this->assertTrue($container->hasDefinition('serializer.mapping.class_metadata_factory')); - - $cache = $container->getDefinition('serializer.mapping.class_metadata_factory')->getArgument(1); - $this->assertEquals(new Reference('foo'), $cache); - } - public function testSerializerMapping() { $container = $this->createContainerFromFile('serializer_mapping', array('kernel.bundles_metadata' => array('TestBundle' => array('namespace' => 'Symfony\\Bundle\\FrameworkBundle\\Tests', 'path' => __DIR__.'/Fixtures/TestBundle', 'parent' => null)))); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php index 3e162d167d23..7f7829b9c0f9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php @@ -81,29 +81,4 @@ public function testParseValidNameWithNotFoundBundle() { $this->parser->parse('BarBundle:Post:index.html.php'); } - - /** - * @group legacy - * @dataProvider provideAbsolutePaths - * @expectedDeprecation Absolute template path support is deprecated since Symfony 3.1 and will be removed in 4.0. - */ - public function testAbsolutePathsAreDeprecated($name, $logicalName, $path, $ref) - { - $template = $this->parser->parse($name); - - $this->assertSame($ref->getLogicalName(), $template->getLogicalName()); - $this->assertSame($logicalName, $template->getLogicalName()); - $this->assertSame($path, $template->getPath()); - } - - public function provideAbsolutePaths() - { - return array( - array('/path/to/section/index.html.php', '/path/to/section/index.html.php', '/path/to/section/index.html.php', new BaseTemplateReference('/path/to/section/index.html.php', 'php')), - array('C:\\path\\to\\section\\name.html.php', 'C:path/to/section/name.html.php', 'C:path/to/section/name.html.php', new BaseTemplateReference('C:path/to/section/name.html.php', 'php')), - array('C:\\path\\to\\section\\name:foo.html.php', 'C:path/to/section/name:foo.html.php', 'C:path/to/section/name:foo.html.php', new BaseTemplateReference('C:path/to/section/name:foo.html.php', 'php')), - array('\\path\\to\\section\\name.html.php', '/path/to/section/name.html.php', '/path/to/section/name.html.php', new BaseTemplateReference('/path/to/section/name.html.php', 'php')), - array('/path/to/section/name.php', '/path/to/section/name.php', '/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')), - ); - } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php b/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php index aba02e0944e2..dfa6fae64637 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php +++ b/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php @@ -42,8 +42,8 @@ */ class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface { - protected $container; - protected $validators; + private $container; + private $validators; /** * Constructor.