Skip to content

Commit 36a8194

Browse files
committed
merged branch alexpods/patch-1 (PR symfony#7891)
This PR was merged into the master branch. Discussion ---------- [FrameworkBundle] Place initialization of $bundlesDir out of the foreach loop. Code enhancement. $bundlesDir variable doesn't need any bundle information for initialization. So it must be placed out of the loop to not process unnecessary operations. Commits ------- 9cca065 [FrameworkBundle] Place initialization of $bundlesDir out of foreach loop
2 parents 1284714 + 9cca065 commit 36a8194

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
8080
$filesystem = $this->getContainer()->get('filesystem');
8181

8282
// Create the bundles directory otherwise symlink will fail.
83-
$filesystem->mkdir($targetArg.'/bundles/', 0777);
83+
$bundlesDir = $targetArg.'/bundles/';
84+
$filesystem->mkdir($bundlesDir, 0777);
8485

8586
$output->writeln(sprintf("Installing assets using the <comment>%s</comment> option", $input->getOption('symlink') ? 'symlink' : 'hard copy'));
8687

8788
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
8889
if (is_dir($originDir = $bundle->getPath().'/Resources/public')) {
89-
$bundlesDir = $targetArg.'/bundles/';
9090
$targetDir = $bundlesDir.preg_replace('/bundle$/', '', strtolower($bundle->getName()));
9191

9292
$output->writeln(sprintf('Installing assets for <comment>%s</comment> into <comment>%s</comment>', $bundle->getNamespace(), $targetDir));

0 commit comments

Comments
 (0)