8000 SCA: minor code tweaks · symfony/symfony@8dbd927 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8dbd927

Browse files
author
vladimir.reznichenko
committed
SCA: minor code tweaks
1 parent 4877d60 commit 8dbd927

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -881,12 +881,9 @@ private function registerRequestConfiguration(array $config, ContainerBuilder $c
881881
if ($config['formats']) {
882882
$loader->load('request.xml');
883883

884-
$container->getDefinition('request.add_request_formats_listener')->setPrivate(true);
885-
886-
$container
887-
->getDefinition('request.add_request_formats_listener')
888-
->replaceArgument(0, $config['formats'])
889-
;
884+
$listener = $container->getDefinition('request.add_request_formats_listener');
885+
$listener->setPrivate(true);
886+
$listener->replaceArgument(0, $config['formats']);
890887
}
891888
}
892889

src/Symfony/Component/Config/Util/XmlUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public static function phpize($value)
240240
return '0x' === $value[0].$value[1] ? hexdec($value) : (float) $value;
241241
case preg_match('/^0x[0-9a-f]++$/i', $value):
242242
return hexdec($value);
243-
case preg_match('/^(-|\+)?[0-9]+(\.[0-9]+)?$/', $value):
243+
case preg_match('/^[+-]?[0-9]+(\.[0-9]+)?$/', $value):
244244
return (float) $value;
245245
default:
246246
return $value;

src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,8 @@ public function testPrototype()
635635
$resources = $container->getResources();
636636

637637
$fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR;
638-
$this->assertTrue(false !== array_search(new FileResource($fixturesDir.'xml'.\DIRECTORY_SEPARATOR.'services_prototype.xml'), $resources));
639-
$this->assertTrue(false !== array_search(new GlobResource($fixturesDir.'Prototype', '/*', true), $resources));
638+
$this->assertContains(new FileResource($fixturesDir . 'xml' . \DIRECTORY_SEPARATOR . 'services_prototype.xml'), $resources);
639+
$this->assertContains(new GlobResource($fixturesDir . 'Prototype', '/*', true), $resources);
640640
$resources = array_map('strval', $resources);
641641
$this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo', $resources);
642642
$this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar', $resources);

src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,8 @@ public function testPrototype()
394394
$resources = $container->getResources();
395395

396396
$fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR;
397-
$this->assertTrue(false !== array_search(new FileResource($fixturesDir.'yaml'.\DIRECTORY_SEPARATOR.'services_prototype.yml'), $resources));
398-
$this->assertTrue(false !== array_search(new GlobResource($fixturesDir.'Prototype', '', true), $resources));
397+
$this->assertContains(new FileResource($fixturesDir . 'yaml' . \DIRECTORY_SEPARATOR . 'services_prototype.yml'), $resources);
398+
$this->assertContains(new GlobResource($fixturesDir . 'Prototype', '', true), $resources);
399399
$resources = array_map('strval', $resources);
400400
$this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo', $resources);
401401
$this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar', $resources);

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ public function setEtag($etag = null, $weak = false)
974974
public function setCache(array $options)
975975
{
976976
if ($diff = array_diff(array_keys($options), array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'))) {
977-
throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', array_values($diff))));
977+
throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', $diff)));
978978
}
979979

980980
if (isset($options['etag'])) {

0 commit comments

Comments
 (0)
0