mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
@@ -33,17 +34,15 @@ use Symfony\Component\HttpKernel\KernelInterface;
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[AsCommand(name: 'assets:install', description: 'Install bundle\'s web assets under a public directory')]
|
||||
class AssetsInstallCommand extends Command
|
||||
{
|
||||
public const METHOD_COPY = 'copy';
|
||||
public const METHOD_ABSOLUTE_SYMLINK = 'absolute symlink';
|
||||
public const METHOD_RELATIVE_SYMLINK = 'relative symlink';
|
||||
|
||||
protected static $defaultName = 'assets:install';
|
||||
protected static $defaultDescription = 'Install bundle\'s web assets under a public directory';
|
||||
|
||||
private $filesystem;
|
||||
private $projectDir;
|
||||
private Filesystem $filesystem;
|
||||
private string $projectDir;
|
||||
|
||||
public function __construct(Filesystem $filesystem, string $projectDir)
|
||||
{
|
||||
@@ -53,10 +52,7 @@ class AssetsInstallCommand extends Command
|
||||
$this->projectDir = $projectDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function configure()
|
||||
protected function configure(): void
|
||||
{
|
||||
$this
|
||||
->setDefinition([
|
||||
@@ -65,7 +61,6 @@ class AssetsInstallCommand extends Command
|
||||
->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlink the assets instead of copying them')
|
||||
->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks')
|
||||
->addOption('no-cleanup', null, InputOption::VALUE_NONE, 'Do not remove the assets of the bundles that no longer exist')
|
||||
->setDescription(self::$defaultDescription)
|
||||
->setHelp(<<<'EOT'
|
||||
The <info>%command.name%</info> command installs bundle assets into a given
|
||||
directory (e.g. the <comment>public</comment> directory).
|
||||
@@ -89,9 +84,6 @@ EOT
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
/** @var KernelInterface $kernel */
|
||||
@@ -204,7 +196,7 @@ EOT
|
||||
try {
|
||||
$this->symlink($originDir, $targetDir, true);
|
||||
$method = self::METHOD_RELATIVE_SYMLINK;
|
||||
} catch (IOException $e) {
|
||||
} catch (IOException) {
|
||||
$method = $this->absoluteSymlinkWithFallback($originDir, $targetDir);
|
||||
}
|
||||
|
||||
@@ -221,7 +213,7 @@ EOT
|
||||
try {
|
||||
$this->symlink($originDir, $targetDir);
|
||||
$method = self::METHOD_ABSOLUTE_SYMLINK;
|
||||
} catch (IOException $e) {
|
||||
} catch (IOException) {
|
||||
// fall back to copy
|
||||
$method = $this->hardCopy($originDir, $targetDir);
|
||||
}
|
||||
@@ -234,7 +226,7 @@ EOT
|
||||
*
|
||||
* @throws IOException if link cannot be created
|
||||
*/
|
||||
private function symlink(string $originDir, string $targetDir, bool $relative = false)
|
||||
private function symlink(string $originDir, string $targetDir, bool $relative = false): void
|
||||
{
|
||||
if ($relative) {
|
||||
$this->filesystem->mkdir(\dirname($targetDir));
|
||||
|
||||
Reference in New Issue
Block a user