Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Command;

use Symfony\Component\Config\ConfigCache;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\KernelInterface;

/**
Expand Down Expand Up @@ -60,16 +57,10 @@
}, $kernel, $kernel::class);
$container = $buildContainer();

if (str_ends_with($file, '.xml') && is_file(substr_replace($file, '.ser', -4))) {
$dumpedContainer = unserialize(file_get_contents(substr_replace($file, '.ser', -4)));
$container->setDefinitions($dumpedContainer->getDefinitions());
$container->setAliases($dumpedContainer->getAliases());
$container->__construct($dumpedContainer->getParameterBag());
} else {
(new XmlFileLoader($container, new FileLocator()))->load($file);
$locatorPass = new ServiceLocatorTagPass();
$locatorPass->process($container);
}
$dumpedContainer = unserialize(file_get_contents(substr_replace($file, '.ser', -4)));

Check failure on line 60 in src/Symfony/Bundle/FrameworkBundle/Command/BuildDebugContainerTrait.php

View workflow job for this annotation

GitHub Actions / Psalm

InvalidArgument

src/Symfony/Bundle/FrameworkBundle/Command/BuildDebugContainerTrait.php:60:62: InvalidArgument: Argument 1 of file_get_contents expects string, but array<array-key, string> provided (see https://psalm.dev/004)

Check failure on line 60 in src/Symfony/Bundle/FrameworkBundle/Command/BuildDebugContainerTrait.php

View workflow job for this annotation

GitHub Actions / Psalm

InvalidArgument

src/Symfony/Bundle/FrameworkBundle/Command/BuildDebugContainerTrait.php:60:62: InvalidArgument: Argument 1 of file_get_contents expects string, but array<array-key, string> provided (see https://psalm.dev/004)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest changing the value of debug.container.dump to have a file name ending in .ser directly instead of keeping a .xml path while the XML file won't exist.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep the param as is: the xml file still exists and is dumped e.g. for IDE plugins

$container->setDefinitions($dumpedContainer->getDefinitions());
$container->setAliases($dumpedContainer->getAliases());
$container->__construct($dumpedContainer->getParameterBag());
}

return $this->container = $container;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Command;

use Symfony\Component\Config\ConfigCache;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\RuntimeException;
Expand All @@ -27,8 +26,6 @@
use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
use Symfony\Component\HttpKernel\Kernel;

#[AsCommand(name: 'lint:container', description: 'Ensure that arguments injected into services match type declarations')]
Expand Down Expand Up @@ -96,11 +93,7 @@ private function getContainerBuilder(bool $resolveEnvVars): ContainerBuilder
}, $kernel, $kernel::class);
$container = $buildContainer();
} else {
if (str_ends_with($file, '.xml') && is_file(substr_replace($file, '.ser', -4))) {
$container = unserialize(file_get_contents(substr_replace($file, '.ser', -4)));
} else {
(new XmlFileLoader($container = new ContainerBuilder(new EnvPlaceholderParameterBag()), new FileLocator()))->load($file);
}
$container = unserialize(file_get_contents(substr_replace($file, '.ser', -4)));

if (!$container instanceof ContainerBuilder) {
throw new RuntimeException(\sprintf('This command does not support the application container: "%s" is not a "%s".', get_debug_type($container), ContainerBuilder::class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
use Symfony\Component\Routing\Loader\GlobFileLoader;
use Symfony\Component\Routing\Loader\PhpFileLoader;
use Symfony\Component\Routing\Loader\Psr4DirectoryLoader;
use Symfony\Component\Routing\Loader\XmlFileLoader;
use Symfony\Component\Routing\Loader\YamlFileLoader;
use Symfony\Component\Routing\Matcher\Dumper\CompiledUrlMatcherDumper;
use Symfony\Component\Routing\Matcher\ExpressionLanguageProvider;
Expand All @@ -51,13 +50,6 @@
$container->services()
->set('routing.resolver', LoaderResolver::class)

->set('routing.loader.xml', XmlFileLoader::class)
->args([
service('file_locator'),
'%kernel.environment%',
])
->tag('routing.loader')

->set('routing.loader.yml', YamlFileLoader::class)
->args([
service('file_locator'),
Expand Down
Loading
Loading