Skip to content

Commit 784a0f9

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: fixed CS SCA with Php Inspections (EA Extended): 2.7 Remove deprecated each function Fixed PHPdoc return references in FormBuilderInterface [FrameworkBundle] Fix perf issue in CacheClearCommand::warmup()
2 parents f9fac11 + 70cbcce commit 784a0f9

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Command/CacheClearCommand.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = tr
147147
$safeTempKernel = str_replace('\\', '\\\\', get_class($tempKernel));
148148
$realKernelFQN = get_class($realKernel);
149149

150-
foreach (Finder::create()->files()->name('*.meta')->in($warmupDir) as $file) {
150+
foreach (Finder::create()->files()->depth('<3')->name('*.meta')->in($warmupDir) as $file) {
151151
file_put_contents($file, preg_replace(
152152
'/(C\:\d+\:)"'.$safeTempKernel.'"/',
153153
sprintf('$1"%s"', $realKernelFQN),
@@ -159,14 +159,16 @@ protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = tr
159159
$search = array($warmupDir, str_replace('\\', '\\\\', $warmupDir));
160160
$replace = str_replace('\\', '/', $realCacheDir);
161161
foreach (Finder::create()->files()->in($warmupDir) as $file) {
162-
$content = str_replace($search, $replace, file_get_contents($file));
163-
file_put_contents($file, $content);
162+
$content = str_replace($search, $replace, file_get_contents($file), $count);
163+
if ($count) {
164+
file_put_contents($file, $content);
165+
}
164166
}
165167

166168
// fix references to container's class
167169
$tempContainerClass = get_class($tempKernel->getContainer());
168170
$realContainerClass = get_class($realKernel->getContainer());
169-
foreach (Finder::create()->files()->name($tempContainerClass.'*')->in($warmupDir) as $file) {
171+
foreach (Finder::create()->files()->depth('<2')->name($tempContainerClass.'*')->in($warmupDir) as $file) {
170172
$content = str_replace($tempContainerClass, $realContainerClass, file_get_contents($file));
171173
file_put_contents($file, $content);
172174
rename($file, str_replace(DIRECTORY_SEPARATOR.$tempContainerClass, DIRECTORY_SEPARATOR.$realContainerClass, $file));

Templating/Helper/AssetsHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function getVersion($path = null, $packageName = null)
7878

7979
// packageName is null and path not, so path is a path or a packageName
8080
try {
81-
$package = $this->packages->getPackage($path);
81+
$this->packages->getPackage($path);
8282
} catch (\InvalidArgumentException $e) {
8383
// path is not a package, so it should be a path
8484
return $this->packages->getVersion($path);

0 commit comments

Comments
 (0)