Skip to content

Commit 5bc4ef0

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 311cc8a + 78f028c commit 5bc4ef0

File tree

10 files changed

+19
-17
lines changed

10 files changed

+19
-17
lines changed

src/Symfony/Bundle/FrameworkBundle/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));

src/Symfony/Bundle/FrameworkBundle/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);

src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ protected function findTemplate($template, $throw = true)
7575
}
7676

7777
$file = null;
78-
$previous = null;
7978
try {
8079
$file = parent::findTemplate($logicalName);
8180
} catch (LoaderError $e) {

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,10 @@ public function testGlobalsWithDifferentTypesAndValues()
170170

171171
$calls = $container->getDefinition('twig')->getMethodCalls();
172172
foreach (array_slice($calls, 1) as $call) {
173-
list($name, $value) = each($globals);
174-
$this->assertEquals($name, $call[1][0]);
175-
$this->assertSame($value, $call[1][1]);
173+
$this->assertEquals(key($globals), $call[1][0]);
174+
$this->assertSame(current($globals), $call[1][1]);
175+
176+
next($globals);
176177
}
177178
}
178179

src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function testGet()
120120
$this->assertEquals('Circular reference detected for service "baz", path: "baz".', $e->getMessage(), '->get() throws a LogicException if the service has a circular reference to itself');
121121
}
122122

123-
$this->assertTrue($builder->get('bar') === $builder->get('bar'), '->get() always returns the same instance if the service is shared');
123+
$this->assertSame($builder->get('bar'), $builder->get('bar'), '->get() always returns the same instance if the service is shared');
124124
}
125125

126126
public function testNonSharedServicesReturnsDifferentInstances()

src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testErrorHandlingInLockIfLockPathBecomesUnwritable()
4949
$this->markTestSkipped('This test cannot run on Windows.');
5050
}
5151

52-
$lockPath = sys_get_temp_dir().'/'.uniqid();
52+
$lockPath = sys_get_temp_dir().'/'.uniqid('', true);
5353
$e = null;
5454
$wrongMessage = null;
5555

src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
8989

9090
if (!is_callable($preferredChoices) && !empty($preferredChoices)) {
9191
$preferredChoices = function ($choice) use ($preferredChoices) {
92-
return false !== array_search($choice, $preferredChoices, true);
92+
return in_array($choice, $preferredChoices, true);
9393
};
9494
}
9595

src/Symfony/Component/Form/FormBuilderInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuild
2727
* @param string|FormTypeInterface $type
2828
* @param array $options
2929
*
30-
* @return $this
30+
* @return self
3131
*/
3232
public function add($child, $type = null, array $options = array());
3333

@@ -58,7 +58,7 @@ public function get($name);
5858
*
5959
* @param string $name
6060
*
61-
* @return $this
61+
* @return self
6262
*/
6363
public function remove($name);
6464

src/Symfony/Component/Form/FormRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,6 @@ public function searchAndRenderBlock(FormView $view, $blockNameSuffix, array $va
316316
*/
317317
public function humanize($text)
318318
{
319-
return ucfirst(trim(strtolower(preg_replace(array('/([A-Z])/', '/[_\s]+/'), array('_$1', ' '), $text))));
319+
return ucfirst(strtolower(trim(preg_replace(array('/([A-Z])/', '/[_\s]+/'), array('_$1', ' '), $text))));
320320
}
321321
}

src/Symfony/Component/VarDumper/Dumper/CliDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ public function dumpScalar(Cursor $cursor, $type, $value)
123123
$style = 'num';
124124

125125
switch (true) {
126-
case INF === $value: $value = 'INF'; break;
126+
case INF === $value: $value = 'INF'; break;
127127
case -INF === $value: $value = '-INF'; break;
128-
case is_nan($value): $value = 'NAN'; break;
128+
case is_nan($value): $value = 'NAN'; break;
129129
default:
130130
$value = (string) $value;
131131
if (false === strpos($value, $this->decimalPoint)) {

0 commit comments

Comments
 (0)