8000 minor #28994 SCA: minor code tweaks (vladimir.reznichenko, kalessil) · symfony/symfony@555f2d9 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 555f2d9

Browse files
minor #28994 SCA: minor code tweaks (vladimir.reznichenko, kalessil)
This PR was merged into the 3.4 branch. Discussion ---------- SCA: minor code tweaks | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Following tweaks included: - repetitive method calls - greedy regex - unnecessary function calls (simplifications) Commits ------- b12c89d SCA: fixed broken tests 42e96ff SCA: applied code style as per guidelines 8dbd927 SCA: minor code tweaks
2 parents faec031 + b12c89d commit 555f2d9

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,9 +635,9 @@ 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));
640638
$resources = array_map('strval', $resources);
639+
$this->assertContains((string) (new FileResource($fixturesDir.'xml'.\DIRECTORY_SEPARATOR.'services_prototype.xml')), $resources);
640+
$this->assertContains((string) (new GlobResource($fixturesDir.'Prototype', '/*', true)), $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);
643643
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,9 @@ 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));
399397
$resources = array_map('strval', $resources);
398+
$this->assertContains((string) (new FileResource($fixturesDir.'yaml'.\DIRECTORY_SEPARATOR.'services_prototype.yml')), $resources);
399+
$this->assertContains((string) (new GlobResource($fixturesDir.'Prototype', '', true)), $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);
402402
}

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