exchanged $rootDir and $fileLinkFormatter arguments in DebugCommand

This commit is contained in:
Yonel Ceruto 2019-05-29 08:39:34 -04:00
parent 7f40716618
commit beca8642ca
6 changed files with 30 additions and 5 deletions

View File

@ -19,3 +19,9 @@ DependencyInjection
my_service:
factory: ['@factory_service', method]
```
TwigBridge
----------
* Deprecated to pass `$rootDir` and `$fileLinkFormatter` as 5th and 6th argument respectively to the
`DebugCommand::__construct()` method, swap the variables position.

View File

@ -404,6 +404,7 @@ TwigBundle
TwigBridge
----------
* Removed argument `$rootDir` from the `DebugCommand::__construct()` method and the 5th argument must be an instance of `FileLinkFormatter`
* removed the `$requestStack` and `$requestContext` arguments of the
`HttpFoundationExtension`, pass a `Symfony\Component\HttpFoundation\UrlHelper`
instance as the only argument instead

View File

@ -1,6 +1,12 @@
CHANGELOG
=========
4.4.0
-----
* deprecated to pass `$rootDir` and `$fileLinkFormatter` as 5th and 6th argument respectively to the
`DebugCommand::__construct()` method, swap the variables position.
4.3.0
-----

View File

@ -42,7 +42,11 @@ class DebugCommand extends Command
private $filesystemLoaders;
private $fileLinkFormatter;
public function __construct(Environment $twig, string $projectDir = null, array $bundlesMetadata = [], string $twigDefaultPath = null, string $rootDir = null, FileLinkFormatter $fileLinkFormatter = null)
/**
* @param FileLinkFormatter|null $fileLinkFormatter
* @param string|null $rootDir
*/
public function __construct(Environment $twig, string $projectDir = null, array $bundlesMetadata = [], string $twigDefaultPath = null, $fileLinkFormatter = null, $rootDir = null)
{
parent::__construct();
@ -50,8 +54,16 @@ class DebugCommand extends Command
$this->projectDir = $projectDir;
$this->bundlesMetadata = $bundlesMetadata;
$this->twigDefaultPath = $twigDefaultPath;
$this->rootDir = $rootDir;
$this->fileLinkFormatter = $fileLinkFormatter;
if (\is_string($fileLinkFormatter) || $rootDir instanceof FileLinkFormatter) {
@trigger_error(sprintf('Passing a string as "$fileLinkFormatter" 5th argument or an instance of FileLinkFormatter as "$rootDir" 6th argument of the "%s()" method is deprecated since Symfony 4.4, swap the variables position.', __METHOD__), E_USER_DEPRECATED);
$this->rootDir = $fileLinkFormatter;
$this->fileLinkFormatter = $rootDir;
} else {
$this->fileLinkFormatter = $fileLinkFormatter;
$this->rootDir = $rootDir;
}
}
protected function configure()

View File

@ -342,7 +342,7 @@ TXT
}
$application = new Application();
$application->add(new DebugCommand($environment, $projectDir, $bundleMetadata, $defaultPath, $rootDir));
$application->add(new DebugCommand($environment, $projectDir, $bundleMetadata, $defaultPath, null, $rootDir));
$command = $application->find('debug:twig');
return new CommandTester($command);

View File

@ -12,8 +12,8 @@
<argument>%kernel.project_dir%</argument>
<argument>%kernel.bundles_metadata%</argument>
<argument>%twig.default_path%</argument>
<argument>%kernel.root_dir%</argument>
<argument type="service" id="debug.file_link_formatter" on-invalid="null" />
<argument>%kernel.root_dir%</argument>
<tag name="console.command" command="debug:twig" />
</service>