diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php index 37a37786db..ed1d63fd86 100644 --- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php +++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php @@ -26,6 +26,8 @@ use Twig\Environment; */ class DebugCommand extends Command { + protected static $defaultName = 'debug:twig'; + private $twig; public function __construct(Environment $twig) @@ -38,7 +40,6 @@ class DebugCommand extends Command protected function configure() { $this - ->setName('debug:twig') ->setDefinition(array( new InputArgument('filter', InputArgument::OPTIONAL, 'Show details for all entries matching this filter'), new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (text or json)', 'text'), diff --git a/src/Symfony/Bridge/Twig/Command/LintCommand.php b/src/Symfony/Bridge/Twig/Command/LintCommand.php index 2973f6b4de..7a707ad0b1 100644 --- a/src/Symfony/Bridge/Twig/Command/LintCommand.php +++ b/src/Symfony/Bridge/Twig/Command/LintCommand.php @@ -31,6 +31,8 @@ use Twig\Source; */ class LintCommand extends Command { + protected static $defaultName = 'lint:twig'; + private $twig; public function __construct(Environment $twig) @@ -43,7 +45,6 @@ class LintCommand extends Command protected function configure() { $this - ->setName('lint:twig') ->setDescription('Lints a template and outputs encountered errors') ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt') ->addArgument('filename', InputArgument::IS_ARRAY) diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index 8463d20d52..4593db62ed 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -39,7 +39,8 @@ "symfony/web-link": "~3.4|~4.0" }, "conflict": { - "symfony/form": "<3.4" + "symfony/form": "<3.4", + "symfony/console": "<3.4" }, "suggest": { "symfony/finder": "", diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php index e4852da379..1006943a23 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php @@ -29,15 +29,14 @@ use Symfony\Component\HttpKernel\KernelInterface; */ class AboutCommand extends Command { + protected static $defaultName = 'about'; + /** * {@inheritdoc} */ protected function configure() { - $this - ->setName('about') - ->setDescription('Displays information about the current project') - ; + $this->setDescription('Displays information about the current project'); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index d314748670..c9b37daa7d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -36,6 +36,8 @@ class AssetsInstallCommand extends Command const METHOD_ABSOLUTE_SYMLINK = 'absolute symlink'; const METHOD_RELATIVE_SYMLINK = 'relative symlink'; + protected static $defaultName = 'assets:install'; + private $filesystem; public function __construct(Filesystem $filesystem) @@ -51,7 +53,6 @@ class AssetsInstallCommand extends Command protected function configure() { $this - ->setName('assets:install') ->setDefinition(array( new InputArgument('target', InputArgument::OPTIONAL, 'The target directory', 'public'), )) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index 1cf530ceba..1bb9c4c530 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -32,6 +32,8 @@ use Symfony\Component\Finder\Finder; */ class CacheClearCommand extends Command { + protected static $defaultName = 'cache:clear'; + private $cacheClearer; private $filesystem; @@ -53,7 +55,6 @@ class CacheClearCommand extends Command 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)'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php index 2bd42e69ec..aa17ad3a39 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php @@ -26,6 +26,8 @@ use Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer; */ final class CachePoolClearCommand extends Command { + protected static $defaultName = 'cache:pool:clear'; + private $poolClearer; public function __construct(Psr6CacheClearer $poolClearer) @@ -41,7 +43,6 @@ final class CachePoolClearCommand extends Command protected function configure() { $this - ->setName('cache:pool:clear') ->setDefinition(array( new InputArgument('pools', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'A list of cache pools or cache pool clearers'), )) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolPruneCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolPruneCommand.php index 741979bd4f..1c9cef9b93 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolPruneCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolPruneCommand.php @@ -24,6 +24,8 @@ use Symfony\Component\Console\Style\SymfonyStyle; */ final class CachePoolPruneCommand extends Command { + protected static $defaultName = 'cache:pool:prune'; + private $pools; /** @@ -42,7 +44,6 @@ final class CachePoolPruneCommand extends Command protected function configure() { $this - ->setName('cache:pool:prune') ->setDescription('Prune cache pools') ->setHelp(<<<'EOF' The %command.name% command deletes all expired items from all pruneable pools. diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php index b890ce8c3f..5219e1dbba 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php @@ -27,6 +27,8 @@ use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate; */ class CacheWarmupCommand extends Command { + protected static $defaultName = 'cache:warmup'; + private $cacheWarmer; public function __construct(CacheWarmerAggregate $cacheWarmer) @@ -42,7 +44,6 @@ class CacheWarmupCommand extends Command protected function configure() { $this - ->setName('cache:warmup') ->setDefinition(array( new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'), )) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php index f460fd5f09..5a55332b33 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php @@ -28,13 +28,14 @@ use Symfony\Component\Yaml\Yaml; */ class ConfigDebugCommand extends AbstractConfigCommand { + protected static $defaultName = 'debug:config'; + /** * {@inheritdoc} */ protected function configure() { $this - ->setName('debug:config') ->setDefinition(array( new InputArgument('name', InputArgument::OPTIONAL, 'The bundle name or the extension alias'), new InputArgument('path', InputArgument::OPTIONAL, 'The configuration option path'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php index fb51f8c3fc..62bdfec8c9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php @@ -30,13 +30,14 @@ use Symfony\Component\Console\Style\SymfonyStyle; */ class ConfigDumpReferenceCommand extends AbstractConfigCommand { + protected static $defaultName = 'config:dump-reference'; + /** * {@inheritdoc} */ protected function configure() { $this - ->setName('config:dump-reference') ->setDefinition(array( new InputArgument('name', InputArgument::OPTIONAL, 'The Bundle name or the extension alias'), new InputArgument('path', InputArgument::OPTIONAL, 'The configuration option path'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index 6ec4f4b8c4..cbf9e8bdb6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -33,6 +33,8 @@ use Symfony\Component\Config\FileLocator; */ class ContainerDebugCommand extends Command { + protected static $defaultName = 'debug:container'; + /** * @var ContainerBuilder|null */ @@ -44,7 +46,6 @@ class ContainerDebugCommand extends Command protected function configure() { $this - ->setName('debug:container') ->setDefinition(array( new InputArgument('name', InputArgument::OPTIONAL, 'A service name (foo)'), new InputOption('show-private', null, InputOption::VALUE_NONE, 'Used to show public *and* private services'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php index 69144d300e..75d9880798 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php @@ -29,6 +29,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; */ class EventDispatcherDebugCommand extends Command { + protected static $defaultName = 'debug:event-dispatcher'; private $dispatcher; public function __construct(EventDispatcherInterface $dispatcher) @@ -44,7 +45,6 @@ class EventDispatcherDebugCommand extends Command protected function configure() { $this - ->setName('debug:event-dispatcher') ->setDefinition(array( new InputArgument('event', InputArgument::OPTIONAL, 'An event name'), new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php index 61345c0c49..425f607f84 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php @@ -33,6 +33,7 @@ use Symfony\Component\Routing\Route; */ class RouterDebugCommand extends Command { + protected static $defaultName = 'debug:router'; private $router; public function __construct(RouterInterface $router) @@ -48,7 +49,6 @@ class RouterDebugCommand extends Command protected function configure() { $this - ->setName('debug:router') ->setDefinition(array( new InputArgument('name', InputArgument::OPTIONAL, 'A route name'), new InputOption('show-controllers', null, InputOption::VALUE_NONE, 'Show assigned controllers in overview'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php index 4c99b9dbe5..74ef9fdc96 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php @@ -30,6 +30,8 @@ use Symfony\Component\Routing\Matcher\TraceableUrlMatcher; */ class RouterMatchCommand extends Command { + protected static $defaultName = 'router:match'; + private $router; public function __construct(RouterInterface $router) @@ -45,7 +47,6 @@ class RouterMatchCommand extends Command protected function configure() { $this - ->setName('router:match') ->setDefinition(array( new InputArgument('path_info', InputArgument::REQUIRED, 'A path info'), new InputOption('method', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP method'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php index 933a60a2d0..43a190a3be 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php @@ -41,6 +41,8 @@ class TranslationDebugCommand extends Command const MESSAGE_UNUSED = 1; const MESSAGE_EQUALS_FALLBACK = 2; + protected static $defaultName = 'debug:translation'; + private $translator; private $loader; private $extractor; @@ -60,7 +62,6 @@ class TranslationDebugCommand extends Command protected function configure() { $this - ->setName('debug:translation') ->setDefinition(array( new InputArgument('locale', InputArgument::REQUIRED, 'The locale'), new InputArgument('bundle', InputArgument::OPTIONAL, 'The bundle name or directory where to load the messages, defaults to app/Resources folder'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php index b6427b3b68..fca86f92a4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php @@ -34,6 +34,8 @@ use Symfony\Component\Translation\Writer\TranslationWriterInterface; */ class TranslationUpdateCommand extends Command { + protected static $defaultName = 'translation:update'; + private $writer; private $loader; private $extractor; @@ -61,7 +63,6 @@ class TranslationUpdateCommand extends Command protected function configure() { $this - ->setName('translation:update') ->setDefinition(array( new InputArgument('locale', InputArgument::REQUIRED, 'The locale'), new InputArgument('bundle', InputArgument::OPTIONAL, 'The bundle name or directory where to load the messages, defaults to app/Resources folder'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php index e06547103d..1c031f5999 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php @@ -26,13 +26,14 @@ use Symfony\Component\Workflow\Marking; */ class WorkflowDumpCommand extends Command { + protected static $defaultName = 'workflow:dump'; + /** * {@inheritdoc} */ protected function configure() { $this - ->setName('workflow:dump') ->setDefinition(array( new InputArgument('name', InputArgument::REQUIRED, 'A workflow name'), new InputArgument('marking', InputArgument::IS_ARRAY, 'A marking (a list of places)'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/XliffLintCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/XliffLintCommand.php index 354d714694..42ee30e145 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/XliffLintCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/XliffLintCommand.php @@ -24,6 +24,8 @@ use Symfony\Component\Translation\Command\XliffLintCommand as BaseLintCommand; */ class XliffLintCommand extends BaseLintCommand { + protected static $defaultName = 'lint:xliff'; + public function __construct() { $directoryIteratorProvider = function ($directory, $default) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php index 267a57027e..4edd92ff69 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php @@ -23,6 +23,8 @@ use Symfony\Component\Yaml\Command\LintCommand as BaseLintCommand; */ class YamlLintCommand extends BaseLintCommand { + protected static $defaultName = 'lint:yaml'; + public function __construct() { $directoryIteratorProvider = function ($directory, $default) { diff --git a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php index d79176001a..f242bb5780 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php @@ -27,6 +27,8 @@ use Doctrine\DBAL\Schema\SchemaException; */ class InitAclCommand extends Command { + protected static $defaultName = 'init:acl'; + private $connection; private $schema; @@ -44,7 +46,6 @@ class InitAclCommand extends Command protected function configure() { $this - ->setName('init:acl') ->setDescription('Mounts ACL tables in the database') ->setHelp(<<<'EOF' The %command.name% command mounts ACL tables in the database. diff --git a/src/Symfony/Bundle/SecurityBundle/Command/SetAclCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/SetAclCommand.php index 59ecd6b0a0..e815174df0 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/SetAclCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/SetAclCommand.php @@ -32,6 +32,8 @@ use Symfony\Component\Security\Acl\Model\MutableAclProviderInterface; */ class SetAclCommand extends Command { + protected static $defaultName = 'acl:set'; + private $provider; public function __construct(MutableAclProviderInterface $provider) @@ -47,7 +49,6 @@ class SetAclCommand extends Command protected function configure() { $this - ->setName('acl:set') ->setDescription('Sets ACL for objects') ->setHelp(<<%command.name% command sets ACL. diff --git a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php index af6c866551..9a8c7f230a 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php @@ -31,6 +31,8 @@ use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; */ class UserPasswordEncoderCommand extends Command { + protected static $defaultName = 'security:encode-password'; + private $encoderFactory; private $userClasses; @@ -48,7 +50,6 @@ class UserPasswordEncoderCommand extends Command protected function configure() { $this - ->setName('security:encode-password') ->setDescription('Encodes a password.') ->addArgument('password', InputArgument::OPTIONAL, 'The plain password to encode.') ->addArgument('user-class', InputArgument::OPTIONAL, 'The User entity class path associated with the encoder used to encode the password.') diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php index 37cbffd9be..dbc9821b14 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php @@ -20,7 +20,6 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; * file that was distributed with this source code. */ use Symfony\Bundle\FrameworkBundle\Console\Application; -use Symfony\Bundle\SecurityBundle\Command\InitAclCommand; use Symfony\Bundle\SecurityBundle\Command\SetAclCommand; use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Security\Acl\Domain\ObjectIdentity; @@ -170,7 +169,6 @@ class SetAclCommandTest extends WebTestCase $kernel->boot(); $application = new Application($kernel); - $application->add(new InitAclCommand($kernel->getContainer()->get('security.acl.dbal.connection'), $kernel->getContainer()->get('security.acl.dbal.schema'))); $initAclCommand = $application->find('init:acl'); $initAclCommandTester = new CommandTester($initAclCommand); diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json index a0ac75fd80..b0ad7066e2 100644 --- a/src/Symfony/Bundle/SecurityBundle/composer.json +++ b/src/Symfony/Bundle/SecurityBundle/composer.json @@ -46,7 +46,8 @@ }, "conflict": { "symfony/var-dumper": "<3.4", - "symfony/event-dispatcher": "<3.4" + "symfony/event-dispatcher": "<3.4", + "symfony/console": "<3.4" }, "suggest": { "symfony/security-acl": "For using the ACL functionality of this bundle" diff --git a/src/Symfony/Bundle/TwigBundle/Resources/views/base_js.html.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/base_js.html.twig index 036af2b025..c18dd554dd 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/views/base_js.html.twig +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/base_js.html.twig @@ -24,7 +24,7 @@ var noop = function() {}; - var profilerStorageKey = 'sf2/profiler/'; + var profilerStorageKey = 'symfony/profiler/'; var request = function(url, onSuccess, onError, payload, options) { var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig index b5f08f8691..4196196593 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig @@ -24,7 +24,7 @@ var noop = function() {}; - var profilerStorageKey = 'sf2/profiler/'; + var profilerStorageKey = 'symfony/profiler/'; var request = function(url, onSuccess, onError, payload, options) { var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); diff --git a/src/Symfony/Component/Console/CHANGELOG.md b/src/Symfony/Component/Console/CHANGELOG.md index 90eb1152e4..c631f46071 100644 --- a/src/Symfony/Component/Console/CHANGELOG.md +++ b/src/Symfony/Component/Console/CHANGELOG.md @@ -17,6 +17,10 @@ CHANGELOG * added `CommandLoaderInterface`, `FactoryCommandLoader` and PSR-11 `ContainerCommandLoader` for commands lazy-loading * added a case-insensitive command name matching fallback + * added static `Command::$defaultName/getDefaultName()`, allowing for + commands to be registered at compile time in the application command loader. + Setting the `$defaultName` property avoids the need for filling the `command` + attribute on the `console.command` tag when using `AddConsoleCommandPass`. 3.3.0 ----- diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index f3a5d716f2..c75bf4e361 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -29,6 +29,11 @@ use Symfony\Component\Console\Exception\LogicException; */ class Command { + /** + * @var string|null The default command name + */ + protected static $defaultName; + private $application; private $name; private $processTitle; @@ -45,6 +50,17 @@ class Command private $usages = array(); private $helperSet; + /** + * @return string|null The default command name or null when no default name is set + */ + public static function getDefaultName() + { + $class = get_called_class(); + $r = new \ReflectionProperty($class, 'defaultName'); + + return $class === $r->class ? static::$defaultName : null; + } + /** * Constructor. * @@ -56,7 +72,7 @@ class Command { $this->definition = new InputDefinition(); - if (null !== $name) { + if (null !== $name || null !== $name = static::getDefaultName()) { $this->setName($name); } diff --git a/src/Symfony/Component/Console/DependencyInjection/AddConsoleCommandPass.php b/src/Symfony/Component/Console/DependencyInjection/AddConsoleCommandPass.php index 67034098c2..add7c5d0df 100644 --- a/src/Symfony/Component/Console/DependencyInjection/AddConsoleCommandPass.php +++ b/src/Symfony/Component/Console/DependencyInjection/AddConsoleCommandPass.php @@ -46,16 +46,21 @@ class AddConsoleCommandPass implements CompilerPassInterface $definition = $container->getDefinition($id); $class = $container->getParameterBag()->resolveValue($definition->getClass()); - if (!$r = $container->getReflectionClass($class)) { - throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); - } - if (!$r->isSubclassOf(Command::class)) { - throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, $this->commandTag, Command::class)); - } - $commandId = 'console.command.'.strtolower(str_replace('\\', '_', $class)); - if (!isset($tags[0]['command'])) { + if (isset($tags[0]['command'])) { + $commandName = $tags[0]['command']; + } else { + if (!$r = $container->getReflectionClass($class)) { + throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); + } + if (!$r->isSubclassOf(Command::class)) { + throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, $this->commandTag, Command::class)); + } + $commandName = $class::getDefaultName(); + } + + if (null === $commandName) { if (isset($serviceIds[$commandId]) || $container->hasAlias($commandId)) { $commandId = $commandId.'_'.$id; } @@ -69,7 +74,6 @@ class AddConsoleCommandPass implements CompilerPassInterface } $serviceIds[$commandId] = false; - $commandName = $tags[0]['command']; unset($tags[0]); $lazyCommandMap[$commandName] = $id; $lazyCommandRefs[$id] = new TypedReference($id, $class); diff --git a/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php b/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php index ddcee80145..807eb38973 100644 --- a/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php +++ b/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php @@ -77,6 +77,38 @@ class AddConsoleCommandPassTest extends TestCase $this->assertSame(array(array('setName', array('my:command')), array('setAliases', array(array('my:alias')))), $command->getMethodCalls()); } + public function testProcessFallsBackToDefaultName() + { + $container = new ContainerBuilder(); + $container + ->register('with-default-name', NamedCommand::class) + ->setPublic(false) + ->addTag('console.command') + ; + + $pass = new AddConsoleCommandPass(); + $pass->process($container); + + $commandLoader = $container->getDefinition('console.command_loader'); + $commandLocator = $container->getDefinition((string) $commandLoader->getArgument(0)); + + $this->assertSame(ContainerCommandLoader::class, $commandLoader->getClass()); + $this->assertSame(array('default' => 'with-default-name'), $commandLoader->getArgument(1)); + $this->assertEquals(array(array('with-default-name' => new ServiceClosureArgument(new TypedReference('with-default-name', NamedCommand::class)))), $commandLocator->getArguments()); + $this->assertSame(array('console.command.symfony_component_console_tests_dependencyinjection_namedcommand' => false), $container->getParameter('console.command.ids')); + + $container = new ContainerBuilder(); + $container + ->register('with-default-name', NamedCommand::class) + ->setPublic(false) + ->addTag('console.command', array('command' => 'new-name')) + ; + + $pass->process($container); + + $this->assertSame(array('new-name' => 'with-default-name'), $container->getDefinition('console.command_loader')->getArgument(1)); + } + public function visibilityProvider() { return array( @@ -96,7 +128,7 @@ class AddConsoleCommandPassTest extends TestCase $container->addCompilerPass(new AddConsoleCommandPass()); $definition = new Definition('Symfony\Component\Console\Tests\DependencyInjection\MyCommand'); - $definition->addTag('console.command', array('command' => 'my:command')); + $definition->addTag('console.command'); $definition->setAbstract(true); $container->setDefinition('my-command', $definition); @@ -114,7 +146,7 @@ class AddConsoleCommandPassTest extends TestCase $container->addCompilerPass(new AddConsoleCommandPass()); $definition = new Definition('SplObjectStorage'); - $definition->addTag('console.command', array('command' => 'my:command')); + $definition->addTag('console.command'); $container->setDefinition('my-command', $definition); $container->compile(); @@ -146,3 +178,8 @@ class AddConsoleCommandPassTest extends TestCase class MyCommand extends Command { } + +class NamedCommand extends Command +{ + protected static $defaultName = 'default'; +} diff --git a/src/Symfony/Component/DependencyInjection/CHANGELOG.md b/src/Symfony/Component/DependencyInjection/CHANGELOG.md index 3d2c56a5c8..1e51a5c927 100644 --- a/src/Symfony/Component/DependencyInjection/CHANGELOG.md +++ b/src/Symfony/Component/DependencyInjection/CHANGELOG.md @@ -28,6 +28,7 @@ CHANGELOG * deprecated service auto-registration while autowiring * deprecated the ability to check for the initialization of a private service with the `Container::initialized()` method * deprecated support for top-level anonymous services in XML + * deprecated case insensitivity of parameter names 3.3.0 ----- diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index aba675ab95..93a0ccda3e 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1039,11 +1039,15 @@ EOF; $php = array(); $dynamicPhp = array(); + $normalizedParams = array(); foreach ($this->container->getParameterBag()->all() as $key => $value) { if ($key !== $resolvedKey = $this->container->resolveEnvPlaceholders($key)) { throw new InvalidArgumentException(sprintf('Parameter name cannot use env parameters: %s.', $resolvedKey)); } + if ($key !== $lcKey = strtolower($key)) { + $normalizedParams[] = sprintf(' %s => %s,', $this->export($lcKey), $this->export($key)); + } $export = $this->exportParameters(array($value)); $export = explode('0 => ', substr(rtrim($export, " )\n"), 7, -1), 2); @@ -1063,7 +1067,7 @@ EOF; public function getParameter($name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); @@ -1081,7 +1085,7 @@ EOF; */ public function hasParameter($name) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } @@ -1151,6 +1155,30 @@ EOF; {$getDynamicParameter} } + +EOF; + + $code .= ' private $normalizedParameterNames = '.($normalizedParams ? sprintf("array(\n%s\n );", implode("\n", $normalizedParams)) : 'array();')."\n"; + $code .= <<<'EOF' + + private function normalizeParameterName($name) + { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { + $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; + if ((string) $name !== $normalizedName) { + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since version 3.4.', $name, $normalizedName), E_USER_DEPRECATED); + } + } else { + $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; + } + + return $normalizedName; + } + +EOF; + + $code .= <<docStar} * Gets the default parameters. * @@ -1533,10 +1561,10 @@ EOF; if (preg_match('/^%([^%]+)%$/', $value, $match)) { // we do this to deal with non string values (Boolean, integer, ...) // the preg_replace_callback converts them to strings - return $this->dumpParameter(strtolower($match[1])); + return $this->dumpParameter($match[1]); } else { $replaceParameters = function ($match) { - return "'.".$this->dumpParameter(strtolower($match[2])).".'"; + return "'.".$this->dumpParameter($match[2]).".'"; }; $code = str_replace('%%', '%', preg_replace_callback('/(?export($value))); @@ -1582,8 +1610,6 @@ EOF; */ private function dumpParameter($name) { - $name = strtolower($name); - if ($this->container->isCompiled() && $this->container->hasParameter($name)) { $value = $this->container->getParameter($name); $dumpedValue = $this->dumpValue($value, false); diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index f620f0785d..b1dc2b566a 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -471,11 +471,6 @@ class XmlFileLoader extends FileLoader $key = array_pop($keys); } else { $key = $arg->getAttribute('key'); - - // parameter keys are case insensitive - if ('parameter' == $name && $lowercase) { - $key = strtolower($key); - } } $onInvalid = $arg->getAttribute('on-invalid'); @@ -579,7 +574,7 @@ class XmlFileLoader extends FileLoader foreach ($schemaLocations as $namespace => $location) { $parts = explode('/', $location); if (0 === stripos($location, 'phar://')) { - $tmpfile = tempnam(sys_get_temp_dir(), 'sf2'); + $tmpfile = tempnam(sys_get_temp_dir(), 'symfony'); if ($tmpfile) { copy($location, $tmpfile); $tmpfiles[] = $tmpfile; diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php b/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php index d20e53531a..fd859068be 100644 --- a/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php +++ b/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php @@ -91,7 +91,7 @@ class EnvPlaceholderParameterBag extends ParameterBag parent::resolve(); foreach ($this->envPlaceholders as $env => $placeholders) { - if (!isset($this->parameters[$name = strtolower("env($env)")])) { + if (!$this->has($name = "env($env)")) { continue; } if (is_numeric($default = $this->parameters[$name])) { diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php index 83ba7e7076..1a9ca6fa4d 100644 --- a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php +++ b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php @@ -25,6 +25,8 @@ class ParameterBag implements ParameterBagInterface protected $parameters = array(); protected $resolved = false; + private $normalizedNames = array(); + /** * @param array $parameters An array of parameters */ @@ -49,7 +51,7 @@ class ParameterBag implements ParameterBagInterface public function add(array $parameters) { foreach ($parameters as $key => $value) { - $this->parameters[strtolower($key)] = $value; + $this->set($key, $value); } } @@ -66,7 +68,7 @@ class ParameterBag implements ParameterBagInterface */ public function get($name) { - $name = strtolower($name); + $name = $this->normalizeName($name); if (!array_key_exists($name, $this->parameters)) { if (!$name) { @@ -111,7 +113,7 @@ class ParameterBag implements ParameterBagInterface */ public function set($name, $value) { - $this->parameters[strtolower($name)] = $value; + $this->parameters[$this->normalizeName($name)] = $value; } /** @@ -119,7 +121,7 @@ class ParameterBag implements ParameterBagInterface */ public function has($name) { - return array_key_exists(strtolower($name), $this->parameters); + return array_key_exists($this->normalizeName($name), $this->parameters); } /** @@ -129,7 +131,7 @@ class ParameterBag implements ParameterBagInterface */ public function remove($name) { - unset($this->parameters[strtolower($name)]); + unset($this->parameters[$this->normalizeName($name)]); } /** @@ -206,7 +208,7 @@ class ParameterBag implements ParameterBagInterface // a non-string in a parameter value if (preg_match('/^%([^%\s]+)%$/', $value, $match)) { $key = $match[1]; - $lcKey = strtolower($key); + $lcKey = strtolower($key); // strtolower() to be removed in 4.0 if (isset($resolving[$lcKey])) { throw new ParameterCircularReferenceException(array_keys($resolving)); @@ -224,7 +226,7 @@ class ParameterBag implements ParameterBagInterface } $key = $match[1]; - $lcKey = strtolower($key); + $lcKey = strtolower($key); // strtolower() to be removed in 4.0 if (isset($resolving[$lcKey])) { throw new ParameterCircularReferenceException(array_keys($resolving)); } @@ -288,4 +290,18 @@ class ParameterBag implements ParameterBagInterface return $value; } + + private function normalizeName($name) + { + if (isset($this->normalizedNames[$normalizedName = strtolower($name)])) { + $normalizedName = $this->normalizedNames[$normalizedName]; + if ((string) $name !== $normalizedName) { + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since version 3.4.', $name, $normalizedName), E_USER_DEPRECATED); + } + } else { + $normalizedName = $this->normalizedNames[$normalizedName] = (string) $name; + } + + return $normalizedName; + } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 29073b276f..d48c2460dc 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -1097,6 +1097,21 @@ class ContainerBuilderTest extends TestCase $this->assertNotSame($container->get('foo'), $container->get('fOO'), '->get() returns the service for the given id, case sensitively'); $this->assertSame($container->get('fOO')->Foo->foo, $container->get('foo'), '->get() returns the service for the given id, case sensitively'); } + + /** + * @group legacy + * @expectedDeprecation Parameter names will be made case sensitive in Symfony 4.0. Using "FOO" instead of "foo" is deprecated since version 3.4. + */ + public function testParameterWithMixedCase() + { + $container = new ContainerBuilder(new ParameterBag(array('foo' => 'bar'))); + $container->register('foo', 'stdClass') + ->setProperty('foo', '%FOO%'); + + $container->compile(); + + $this->assertSame('bar', $container->get('foo')->foo); + } } class FooClass diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index 46780ed3f0..30eefb5546 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -112,10 +112,6 @@ class ContainerTest extends TestCase $sc->setParameter('foo', 'baz'); $this->assertEquals('baz', $sc->getParameter('foo'), '->setParameter() overrides previously set parameter'); - $sc->setParameter('Foo', 'baz1'); - $this->assertEquals('baz1', $sc->getParameter('foo'), '->setParameter() converts the key to lowercase'); - $this->assertEquals('baz1', $sc->getParameter('FOO'), '->getParameter() converts the key to lowercase'); - try { $sc->getParameter('baba'); $this->fail('->getParameter() thrown an \InvalidArgumentException if the key does not exist'); @@ -125,6 +121,20 @@ class ContainerTest extends TestCase } } + /** + * @group legacy + * @expectedDeprecation Parameter names will be made case sensitive in Symfony 4.0. Using "Foo" instead of "foo" is deprecated since version 3.4. + * @expectedDeprecation Parameter names will be made case sensitive in Symfony 4.0. Using "FOO" instead of "foo" is deprecated since version 3.4. + */ + public function testGetSetParameterWithMixedCase() + { + $sc = new Container(new ParameterBag(array('foo' => 'bar'))); + + $sc->setParameter('Foo', 'baz1'); + $this->assertEquals('baz1', $sc->getParameter('foo'), '->setParameter() converts the key to lowercase'); + $this->assertEquals('baz1', $sc->getParameter('FOO'), '->getParameter() converts the key to lowercase'); + } + public function testGetServiceIds() { $sc = new Container(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index 4f4cf9936b..47356e2d5c 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -650,4 +650,43 @@ class PhpDumperTest extends TestCase $container->get('bar'); } + + /** + * @group legacy + * @expectedDeprecation Parameter names will be made case sensitive in Symfony 4.0. Using "foo" instead of "Foo" is deprecated since version 3.4. + * @expectedDeprecation Parameter names will be made case sensitive in Symfony 4.0. Using "FOO" instead of "Foo" is deprecated since version 3.4. + * @expectedDeprecation Parameter names will be made case sensitive in Symfony 4.0. Using "bar" instead of "BAR" is deprecated since version 3.4. + */ + public function testParameterWithMixedCase() + { + $container = new ContainerBuilder(new ParameterBag(array('Foo' => 'bar', 'BAR' => 'foo'))); + $container->compile(); + + $dumper = new PhpDumper($container); + eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Parameter_With_Mixed_Case'))); + + $container = new \Symfony_DI_PhpDumper_Test_Parameter_With_Mixed_Case(); + + $this->assertSame('bar', $container->getParameter('foo')); + $this->assertSame('bar', $container->getParameter('FOO')); + $this->assertSame('foo', $container->getParameter('bar')); + $this->assertSame('foo', $container->getParameter('BAR')); + } + + /** + * @group legacy + * @expectedDeprecation Parameter names will be made case sensitive in Symfony 4.0. Using "FOO" instead of "foo" is deprecated since version 3.4. + */ + public function testParameterWithLowerCase() + { + $container = new ContainerBuilder(new ParameterBag(array('foo' => 'bar'))); + $container->compile(); + + $dumper = new PhpDumper($container); + eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Parameter_With_Lower_Case'))); + + $container = new \Symfony_DI_PhpDumper_Test_Parameter_With_Lower_Case(); + + $this->assertSame('bar', $container->getParameter('FOO')); + } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php index f0b4ca9330..1a4e5ab5c8 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php @@ -4,7 +4,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; $container = new ContainerBuilder(new ParameterBag(array( - 'FOO' => '%baz%', + 'foo' => '%baz%', 'baz' => 'bar', 'bar' => 'foo is %%foo bar', 'escape' => '@escapeme', diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php index 9f79c99317..582472b38b 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php @@ -78,7 +78,7 @@ class ProjectServiceContainer extends Container public function getParameter($name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); @@ -96,7 +96,7 @@ class ProjectServiceContainer extends Container */ public function hasParameter($name) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } @@ -142,6 +142,22 @@ class ProjectServiceContainer extends Container throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } + private $normalizedParameterNames = array(); + + private function normalizeParameterName($name) + { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { + $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; + if ((string) $name !== $normalizedName) { + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since version 3.4.', $name, $normalizedName), E_USER_DEPRECATED); + } + } else { + $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; + } + + return $normalizedName; + } + /** * Gets the default parameters. * diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php index 05bd46c18d..f5db7d75d4 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php @@ -82,7 +82,7 @@ class ProjectServiceContainer extends Container public function getParameter($name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); @@ -100,7 +100,7 @@ class ProjectServiceContainer extends Container */ public function hasParameter($name) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } @@ -156,6 +156,22 @@ class ProjectServiceContainer extends Container return $this->dynamicParameters[$name] = $value; } + private $normalizedParameterNames = array(); + + private function normalizeParameterName($name) + { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { + $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; + if ((string) $name !== $normalizedName) { + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since version 3.4.', $name, $normalizedName), E_USER_DEPRECATED); + } + } else { + $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; + } + + return $normalizedName; + } + /** * Gets the default parameters. * diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php index a2e3937d12..f7eb32e55e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php @@ -80,7 +80,7 @@ class ProjectServiceContainer extends Container public function getParameter($name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); @@ -98,7 +98,7 @@ class ProjectServiceContainer extends Container */ public function hasParameter($name) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } @@ -152,6 +152,24 @@ class ProjectServiceContainer extends Container return $this->dynamicParameters[$name] = $value; } + private $normalizedParameterNames = array( + 'env(foo)' => 'env(FOO)', + ); + + private function normalizeParameterName($name) + { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { + $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; + if ((string) $name !== $normalizedName) { + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since version 3.4.', $name, $normalizedName), E_USER_DEPRECATED); + } + } else { + $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; + } + + return $normalizedName; + } + /** * Gets the default parameters. * @@ -160,7 +178,7 @@ class ProjectServiceContainer extends Container protected function getDefaultParameters() { return array( - 'env(foo)' => 'foo', + 'env(FOO)' => 'foo', ); } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php index 004c7b8008..bbd0b34c58 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php @@ -65,7 +65,7 @@ class ProjectServiceContainer extends Container public function getParameter($name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); @@ -83,7 +83,7 @@ class ProjectServiceContainer extends Container */ public function hasParameter($name) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } @@ -129,6 +129,22 @@ class ProjectServiceContainer extends Container throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } + private $normalizedParameterNames = array(); + + private function normalizeParameterName($name) + { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { + $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; + if ((string) $name !== $normalizedName) { + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since version 3.4.', $name, $normalizedName), E_USER_DEPRECATED); + } + } else { + $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; + } + + return $normalizedName; + } + /** * Gets the default parameters. * diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt index 13cfae45af..d5f8d4f65e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt @@ -383,7 +383,7 @@ class Container%s extends Container public function getParameter($name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); @@ -401,7 +401,7 @@ class Container%s extends Container */ public function hasParameter($name) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } @@ -447,6 +447,22 @@ class Container%s extends Container throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } + private $normalizedParameterNames = array(); + + private function normalizeParameterName($name) + { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { + $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; + if ((string) $name !== $normalizedName) { + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since version 3.4.', $name, $normalizedName), E_USER_DEPRECATED); + } + } else { + $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; + } + + return $normalizedName; + } + /** * Gets the default parameters. * 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 847b722792..30f58e1d97 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -392,7 +392,7 @@ class ProjectServiceContainer extends Container public function getParameter($name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); @@ -410,7 +410,7 @@ class ProjectServiceContainer extends Container */ public function hasParameter($name) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } @@ -456,6 +456,22 @@ class ProjectServiceContainer extends Container throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } + private $normalizedParameterNames = array(); + + private function normalizeParameterName($name) + { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { + $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; + if ((string) $name !== $normalizedName) { + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since version 3.4.', $name, $normalizedName), E_USER_DEPRECATED); + } + } else { + $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; + } + + return $normalizedName; + } + /** * Gets the default parameters. * diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php index ff48181663..bf9e7c1dcf 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php @@ -86,7 +86,7 @@ class ProjectServiceContainer extends Container public function getParameter($name) { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); @@ -104,7 +104,7 @@ class ProjectServiceContainer extends Container */ public function hasParameter($name) { - $name = strtolower($name); + $name = $this->normalizeParameterName($name); return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); } @@ -160,6 +160,22 @@ class ProjectServiceContainer extends Container return $this->dynamicParameters[$name] = $value; } + private $normalizedParameterNames = array(); + + private function normalizeParameterName($name) + { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { + $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; + if ((string) $name !== $normalizedName) { + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since version 3.4.', $name, $normalizedName), E_USER_DEPRECATED); + } + } else { + $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; + } + + return $normalizedName; + } + /** * Gets the default parameters. * diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services2.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services2.xml index f1ac14dd5d..0d2d669949 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services2.xml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services2.xml @@ -5,7 +5,7 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> a string - bar + bar 0 4 @@ -23,7 +23,7 @@ bar - + value PHP_EOL diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services2.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services2.yml index 7ab302bcb9..e05d69d77e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services2.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services2.yml @@ -1,5 +1,5 @@ parameters: - FOO: bar + foo: bar values: - true - false @@ -9,5 +9,5 @@ parameters: bar: foo escape: '@@escapeme' foo_bar: '@foo_bar' - MixedCase: + mixedcase: MixedCaseKey: value diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php index 01fcd2c3ef..9abfb45d6e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php @@ -115,18 +115,18 @@ class EnvPlaceholderParameterBagTest extends TestCase { $bag = new EnvPlaceholderParameterBag(); $bag->get('env(INT_VAR)'); - $bag->set('env(Int_Var)', 2); + $bag->set('env(INT_VAR)', 2); $bag->resolve(); - $this->assertSame('2', $bag->all()['env(int_var)']); + $this->assertSame('2', $bag->all()['env(INT_VAR)']); } public function testResolveEnvAllowsNull() { $bag = new EnvPlaceholderParameterBag(); $bag->get('env(NULL_VAR)'); - $bag->set('env(Null_Var)', null); + $bag->set('env(NULL_VAR)', null); $bag->resolve(); - $this->assertNull($bag->all()['env(null_var)']); + $this->assertNull($bag->all()['env(NULL_VAR)']); } /** @@ -137,7 +137,7 @@ class EnvPlaceholderParameterBagTest extends TestCase { $bag = new EnvPlaceholderParameterBag(); $bag->get('env(ARRAY_VAR)'); - $bag->set('env(Array_Var)', array()); + $bag->set('env(ARRAY_VAR)', array()); $bag->resolve(); } @@ -148,7 +148,7 @@ class EnvPlaceholderParameterBagTest extends TestCase $bag->get('env(NULL_VAR)'); $bag->resolve(); - $this->assertNull($bag->all()['env(null_var)']); + $this->assertNull($bag->all()['env(NULL_VAR)']); } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php index 391e0eb3ff..3bac9ca64e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php @@ -46,8 +46,6 @@ class ParameterBagTest extends TestCase )); $bag->remove('foo'); $this->assertEquals(array('bar' => 'bar'), $bag->all(), '->remove() removes a parameter'); - $bag->remove('BAR'); - $this->assertEquals(array(), $bag->all(), '->remove() converts key to lowercase before removing'); } public function testGetSet() @@ -59,10 +57,6 @@ class ParameterBagTest extends TestCase $bag->set('foo', 'baz'); $this->assertEquals('baz', $bag->get('foo'), '->set() overrides previously set parameter'); - $bag->set('Foo', 'baz1'); - $this->assertEquals('baz1', $bag->get('foo'), '->set() converts the key to lowercase'); - $this->assertEquals('baz1', $bag->get('FOO'), '->get() converts the key to lowercase'); - try { $bag->get('baba'); $this->fail('->get() throws an Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException if the key does not exist'); @@ -109,10 +103,33 @@ class ParameterBagTest extends TestCase { $bag = new ParameterBag(array('foo' => 'bar')); $this->assertTrue($bag->has('foo'), '->has() returns true if a parameter is defined'); - $this->assertTrue($bag->has('Foo'), '->has() converts the key to lowercase'); $this->assertFalse($bag->has('bar'), '->has() returns false if a parameter is not defined'); } + /** + * @group legacy + * @expectedDeprecation Parameter names will be made case sensitive in Symfony 4.0. Using "BAR" instead of "bar" is deprecated since version 3.4. + * @expectedDeprecation Parameter names will be made case sensitive in Symfony 4.0. Using "Foo" instead of "foo" is deprecated since version 3.4. + * @expectedDeprecation Parameter names will be made case sensitive in Symfony 4.0. Using "FOO" instead of "foo" is deprecated since version 3.4. + * @expectedDeprecation Parameter names will be made case sensitive in Symfony 4.0. Using "Foo" instead of "foo" is deprecated since version 3.4. + */ + public function testMixedCase() + { + $bag = new ParameterBag(array( + 'foo' => 'foo', + 'bar' => 'bar', + )); + + $bag->remove('BAR'); + $this->assertEquals(array('foo' => 'foo'), $bag->all(), '->remove() converts key to lowercase before removing'); + + $bag->set('Foo', 'baz1'); + $this->assertEquals('baz1', $bag->get('foo'), '->set() converts the key to lowercase'); + $this->assertEquals('baz1', $bag->get('FOO'), '->get() converts the key to lowercase'); + + $this->assertTrue($bag->has('Foo'), '->has() converts the key to lowercase'); + } + public function testResolveValue() { $bag = new ParameterBag(array()); diff --git a/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php b/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php index ddd603fdd1..138565aa31 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php +++ b/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php @@ -39,7 +39,7 @@ class AutoExpireFlashBag implements FlashBagInterface * * @param string $storageKey The key used to store flashes in the session */ - public function __construct($storageKey = '_sf2_flashes') + public function __construct($storageKey = '_symfony_flashes') { $this->storageKey = $storageKey; } diff --git a/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php b/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php index 85b4f00b00..ee6be434cc 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php +++ b/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php @@ -39,7 +39,7 @@ class FlashBag implements FlashBagInterface * * @param string $storageKey The key used to store flashes in the session */ - public function __construct($storageKey = '_sf2_flashes') + public function __construct($storageKey = '_symfony_flashes') { $this->storageKey = $storageKey; } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php index 4eb200afa3..c25befc4c3 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php @@ -62,7 +62,7 @@ class AutoExpireFlashBagTest extends TestCase public function testGetStorageKey() { - $this->assertEquals('_sf2_flashes', $this->bag->getStorageKey()); + $this->assertEquals('_symfony_flashes', $this->bag->getStorageKey()); $attributeBag = new FlashBag('test'); $this->assertEquals('test', $attributeBag->getStorageKey()); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php index f0aa6a6157..07d1788807 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php @@ -57,7 +57,7 @@ class FlashBagTest extends TestCase public function testGetStorageKey() { - $this->assertEquals('_sf2_flashes', $this->bag->getStorageKey()); + $this->assertEquals('_symfony_flashes', $this->bag->getStorageKey()); $attributeBag = new FlashBag('test'); $this->assertEquals('test', $attributeBag->getStorageKey()); } diff --git a/src/Symfony/Component/Translation/Command/XliffLintCommand.php b/src/Symfony/Component/Translation/Command/XliffLintCommand.php index 80d8bb25dc..fead5edcb1 100644 --- a/src/Symfony/Component/Translation/Command/XliffLintCommand.php +++ b/src/Symfony/Component/Translation/Command/XliffLintCommand.php @@ -26,6 +26,8 @@ use Symfony\Component\Console\Style\SymfonyStyle; */ class XliffLintCommand extends Command { + protected static $defaultName = 'lint:xliff'; + private $format; private $displayCorrectFiles; private $directoryIteratorProvider; @@ -45,7 +47,6 @@ class XliffLintCommand extends Command protected function configure() { $this - ->setName('lint:xliff') ->setDescription('Lints a XLIFF file and outputs encountered errors') ->addArgument('filename', null, 'A file or a directory or STDIN') ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt') diff --git a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php index e3cab65437..1603dc0b04 100644 --- a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php @@ -222,7 +222,7 @@ class XliffFileLoader implements LoaderInterface $newPath = str_replace('\\', '/', __DIR__).'/schema/dic/xliff-core/xml.xsd'; $parts = explode('/', $newPath); if (0 === stripos($newPath, 'phar://')) { - $tmpfile = tempnam(sys_get_temp_dir(), 'sf2'); + $tmpfile = tempnam(sys_get_temp_dir(), 'symfony'); if ($tmpfile) { copy($newPath, $tmpfile); $parts = explode('/', str_replace('\\', '/', $tmpfile)); diff --git a/src/Symfony/Component/Yaml/Command/LintCommand.php b/src/Symfony/Component/Yaml/Command/LintCommand.php index 36025bdebb..202291551b 100644 --- a/src/Symfony/Component/Yaml/Command/LintCommand.php +++ b/src/Symfony/Component/Yaml/Command/LintCommand.php @@ -28,6 +28,8 @@ use Symfony\Component\Yaml\Yaml; */ class LintCommand extends Command { + protected static $defaultName = 'lint:yaml'; + private $parser; private $format; private $displayCorrectFiles; @@ -48,7 +50,6 @@ class LintCommand extends Command protected function configure() { $this - ->setName('lint:yaml') ->setDescription('Lints a file and outputs encountered errors') ->addArgument('filename', null, 'A file or a directory or STDIN') ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt') diff --git a/src/Symfony/Component/Yaml/composer.json b/src/Symfony/Component/Yaml/composer.json index bbf8439349..7a34d82857 100644 --- a/src/Symfony/Component/Yaml/composer.json +++ b/src/Symfony/Component/Yaml/composer.json @@ -21,6 +21,9 @@ "require-dev": { "symfony/console": "~3.4|~4.0" }, + "conflict": { + "symfony/console": "<3.4" + }, "suggest": { "symfony/console": "For validating YAML files using the lint command" },