-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle][SecurityBundle][TwigBundle][Yaml] remove deprecated code #23815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
|
||
namespace Symfony\Bundle\FrameworkBundle\Command; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
|
@@ -29,27 +30,16 @@ | |
* | ||
* @final since version 3.4 | ||
*/ | ||
class AssetsInstallCommand extends ContainerAwareCommand | ||
class AssetsInstallCommand extends Command | ||
{ | ||
const METHOD_COPY = 'copy'; | ||
const METHOD_ABSOLUTE_SYMLINK = 'absolute symlink'; | ||
const METHOD_RELATIVE_SYMLINK = 'relative symlink'; | ||
|
||
private $filesystem; | ||
|
||
/** | ||
* @param Filesystem $filesystem | ||
*/ | ||
public function __construct($filesystem = null) | ||
public function __construct(Filesystem $filesystem) | ||
{ | ||
if (!$filesystem instanceof Filesystem) { | ||
@trigger_error(sprintf('Passing a command name as the first argument of "%s" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED); | ||
|
||
parent::__construct($filesystem); | ||
|
||
return; | ||
} | ||
|
||
parent::__construct(); | ||
|
||
$this->filesystem = $filesystem; | ||
|
@@ -96,17 +86,11 @@ protected function configure() | |
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
// BC to be removed in 4.0 | ||
if (null === $this->filesystem) { | ||
$this->filesystem = $this->getContainer()->get('filesystem'); | ||
$baseDir = $this->getContainer()->getParameter('kernel.project_dir'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
$kernel = $this->getApplication()->getKernel(); | ||
$targetArg = rtrim($input->getArgument('target'), '/'); | ||
|
||
if (!is_dir($targetArg)) { | ||
$targetArg = (isset($baseDir) ? $baseDir : $kernel->getContainer()->getParameter('kernel.project_dir')).'/'.$targetArg; | ||
$targetArg = $kernel->getContainer()->getParameter('kernel.project_dir').'/'.$targetArg; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we could also inject the project_dir in the command instead There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we reached consensus to use getParameter from the kernel container for cache_dir, project_dir etc. It can be an optional constructor arg.. thats a new feature to me. |
||
|
||
if (!is_dir($targetArg)) { | ||
throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target'))); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
namespace Symfony\Bundle\FrameworkBundle\Command; | ||
|
||
use Psr\Cache\CacheItemPoolInterface; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
@@ -23,23 +24,12 @@ | |
* | ||
* @author Nicolas Grekas <p@tchwork.com> | ||
*/ | ||
final class CachePoolClearCommand extends ContainerAwareCommand | ||
final class CachePoolClearCommand extends Command | ||
{ | ||
private $poolClearer; | ||
|
||
/** | ||
* @param Psr6CacheClearer $poolClearer | ||
*/ | ||
public function __construct($poolClearer = null) | ||
public function __construct(Psr6CacheClearer $poolClearer) | ||
{ | ||
if (!$poolClearer instanceof Psr6CacheClearer) { | ||
@trigger_error(sprintf('Passing a command name as the first argument of "%s" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED); | ||
|
||
parent::__construct($poolClearer); | ||
|
||
return; | ||
} | ||
|
||
parent::__construct(); | ||
|
||
$this->poolClearer = $poolClearer; | ||
|
@@ -70,12 +60,6 @@ protected function configure() | |
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
// BC to be removed in 4.0 | ||
if (null === $this->poolClearer) { | ||
$this->poolClearer = $this->getContainer()->get('cache.global_clearer'); | ||
$cacheDir = $this->getContainer()->getParameter('kernel.cache_dir'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same, isset($cacheDir) below can be removed |
||
} | ||
|
||
$io = new SymfonyStyle($input, $output); | ||
$kernel = $this->getApplication()->getKernel(); | ||
$pools = array(); | ||
|
@@ -99,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output) | |
|
||
foreach ($clearers as $id => $clearer) { | ||
$io->comment(sprintf('Calling cache clearer: <info>%s</info>', $id)); | ||
$clearer->clear(isset($cacheDir) ? $cacheDir : $kernel->getContainer()->getParameter('kernel.cache_dir')); | ||
$clearer->clear($kernel->getContainer()->getParameter('kernel.cache_dir')); | ||
} | ||
|
||
foreach ($pools as $id => $pool) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
|
||
namespace Symfony\Bundle\FrameworkBundle\Command; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
@@ -24,23 +25,12 @@ | |
* | ||
* @final since version 3.4 | ||
*/ | ||
class CacheWarmupCommand extends ContainerAwareCommand | ||
class CacheWarmupCommand extends Command | ||
{ | ||
private $cacheWarmer; | ||
|
||
/** | ||
* @param CacheWarmerAggregate $cacheWarmer | ||
*/ | ||
public function __construct($cacheWarmer = null) | ||
public function __construct(CacheWarmerAggregate $cacheWarmer) | ||
{ | ||
if (!$cacheWarmer instanceof CacheWarmerAggregate) { | ||
@trigger_error(sprintf('Passing a command name as the first argument of "%s" is deprecated since version 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED); | ||
|
||
parent::__construct($cacheWarmer); | ||
|
||
return; | ||
} | ||
|
||
parent::__construct(); | ||
|
||
$this->cacheWarmer = $cacheWarmer; | ||
|
@@ -77,12 +67,6 @@ protected function configure() | |
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
// BC to be removed in 4.0 | ||
if (null === $this->cacheWarmer) { | ||
$this->cacheWarmer = $this->getContainer()->get('cache_warmer'); | ||
$cacheDir = $this->getContainer()->getParameter('kernel.cache_dir'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same :) |
||
} | ||
|
||
$io = new SymfonyStyle($input, $output); | ||
|
||
$kernel = $this->getApplication()->getKernel(); | ||
|
@@ -92,7 +76,7 @@ protected function execute(InputInterface $input, OutputInterface $output) | |
$this->cacheWarmer->enableOptionalWarmers(); | ||
} | ||
|
||
$this->cacheWarmer->warmUp(isset($cacheDir) ? $cacheDir : $kernel->getContainer()->getParameter('kernel.cache_dir')); | ||
$this->cacheWarmer->warmUp($kernel->getContainer()->getParameter('kernel.cache_dir')); | ||
|
||
$io->success(sprintf('Cache for the "%s" environment (debug=%s) was successfully warmed.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it become final for real too ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
letting it
@final
is valid and I think the use case of adding extra info to theabout
output is too in factThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there is a use case for extending it and we want to support this use case, we must remove
@final
, to allow extending.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@final
is telling the intention to external users - extending internally is not an issue to me.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#23624 (comment) it's done for allowing proxiex/mocks solely.
For most commands i dont see it happen, yet we made containerdebug internal because of this :) and commands in components/bridges are also not marked final.
Last, some commands were already final for real.