From 413a2c0cae6a1a5d8720bdfeebc0dbbfac24155d Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Thu, 24 Oct 2019 14:44:17 +0200 Subject: [PATCH] Remove unused local variables in tests --- Dumper/PhpDumper.php | 2 +- Tests/Compiler/AnalyzeServiceReferencesPassTest.php | 10 +++++----- Tests/Compiler/IntegrationTest.php | 2 +- Tests/Compiler/ResolveChildDefinitionsPassTest.php | 2 +- Tests/Compiler/ResolveClassPassTest.php | 4 ++-- Tests/ContainerBuilderTest.php | 6 +++--- Tests/Dumper/PhpDumperTest.php | 3 +-- Tests/Loader/XmlFileLoaderTest.php | 1 - 8 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Dumper/PhpDumper.php b/Dumper/PhpDumper.php index b6d0b03b2..7596b9953 100644 --- a/Dumper/PhpDumper.php +++ b/Dumper/PhpDumper.php @@ -219,7 +219,7 @@ public function dump(array $options = []) foreach ($ids as $id) { $c .= ' '.$this->doExport($id)." => true,\n"; } - $files['removed-ids.php'] = $c .= "];\n"; + $files['removed-ids.php'] = $c."];\n"; } foreach ($this->generateServiceFiles() as $file => $c) { diff --git a/Tests/Compiler/AnalyzeServiceReferencesPassTest.php b/Tests/Compiler/AnalyzeServiceReferencesPassTest.php index 0bd94a3e6..66b6e19cc 100644 --- a/Tests/Compiler/AnalyzeServiceReferencesPassTest.php +++ b/Tests/Compiler/AnalyzeServiceReferencesPassTest.php @@ -25,28 +25,28 @@ public function testProcess() { $container = new ContainerBuilder(); - $a = $container + $container ->register('a') ->addArgument($ref1 = new Reference('b')) ; - $b = $container + $container ->register('b') ->addMethodCall('setA', [$ref2 = new Reference('a')]) ; - $c = $container + $container ->register('c') ->addArgument($ref3 = new Reference('a')) ->addArgument($ref4 = new Reference('b')) ; - $d = $container + $container ->register('d') ->setProperty('foo', $ref5 = new Reference('b')) ; - $e = $container + $container ->register('e') ->setConfigurator([$ref6 = new Reference('b'), 'methodName']) ; diff --git a/Tests/Compiler/IntegrationTest.php b/Tests/Compiler/IntegrationTest.php index 10c34aa48..348d1d7f5 100644 --- a/Tests/Compiler/IntegrationTest.php +++ b/Tests/Compiler/IntegrationTest.php @@ -43,7 +43,7 @@ public function testProcessRemovesAndInlinesRecursively() ->addArgument(new Reference('c')) ; - $b = $container + $container ->register('b', '\stdClass') ->addArgument(new Reference('c')) ->setPublic(false) diff --git a/Tests/Compiler/ResolveChildDefinitionsPassTest.php b/Tests/Compiler/ResolveChildDefinitionsPassTest.php index 27bb9157c..eee4cf730 100644 --- a/Tests/Compiler/ResolveChildDefinitionsPassTest.php +++ b/Tests/Compiler/ResolveChildDefinitionsPassTest.php @@ -390,7 +390,7 @@ public function testBindings() ->setBindings(['a' => '1', 'b' => '2']) ; - $child = $container->setDefinition('child', new ChildDefinition('parent')) + $container->setDefinition('child', new ChildDefinition('parent')) ->setBindings(['b' => 'B', 'c' => 'C']) ; diff --git a/Tests/Compiler/ResolveClassPassTest.php b/Tests/Compiler/ResolveClassPassTest.php index 0ab630316..81e05fb28 100644 --- a/Tests/Compiler/ResolveClassPassTest.php +++ b/Tests/Compiler/ResolveClassPassTest.php @@ -87,8 +87,8 @@ public function testAmbiguousChildDefinition() $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException'); $this->expectExceptionMessage('Service definition "App\Foo\Child" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.'); $container = new ContainerBuilder(); - $parent = $container->register('App\Foo', null); - $child = $container->setDefinition('App\Foo\Child', new ChildDefinition('App\Foo')); + $container->register('App\Foo', null); + $container->setDefinition('App\Foo\Child', new ChildDefinition('App\Foo')); (new ResolveClassPass())->process($container); } diff --git a/Tests/ContainerBuilderTest.php b/Tests/ContainerBuilderTest.php index 199179c9b..f2666ef96 100644 --- a/Tests/ContainerBuilderTest.php +++ b/Tests/ContainerBuilderTest.php @@ -1265,7 +1265,7 @@ public function testNoClassFromGlobalNamespaceClassId() $this->expectExceptionMessage('The definition for "DateTime" has no class attribute, and appears to reference a class or interface in the global namespace.'); $container = new ContainerBuilder(); - $definition = $container->register(\DateTime::class); + $container->register(\DateTime::class); $container->compile(); } @@ -1295,7 +1295,7 @@ public function testNoClassFromNonClassId() $this->expectExceptionMessage('The definition for "123_abc" has no class.'); $container = new ContainerBuilder(); - $definition = $container->register('123_abc'); + $container->register('123_abc'); $container->compile(); } @@ -1305,7 +1305,7 @@ public function testNoClassFromNsSeparatorId() $this->expectExceptionMessage('The definition for "\foo" has no class.'); $container = new ContainerBuilder(); - $definition = $container->register('\\foo'); + $container->register('\\foo'); $container->compile(); } diff --git a/Tests/Dumper/PhpDumperTest.php b/Tests/Dumper/PhpDumperTest.php index 4e6083d99..b2cbb3caf 100644 --- a/Tests/Dumper/PhpDumperTest.php +++ b/Tests/Dumper/PhpDumperTest.php @@ -886,7 +886,7 @@ public function testInlineSelfRef() ->setPublic(true) ->addArgument($baz); - $passConfig = $container->getCompiler()->getPassConfig(); + $container->getCompiler()->getPassConfig(); $container->compile(); $dumper = new PhpDumper($container); @@ -978,7 +978,6 @@ public function testAdawsonContainer() $container->compile(); $dumper = new PhpDumper($container); - $dump = $dumper->dump(); $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_adawson.php', $dumper->dump()); } diff --git a/Tests/Loader/XmlFileLoaderTest.php b/Tests/Loader/XmlFileLoaderTest.php index 1b6e51c56..2b963968d 100644 --- a/Tests/Loader/XmlFileLoaderTest.php +++ b/Tests/Loader/XmlFileLoaderTest.php @@ -808,7 +808,6 @@ public function testTsantosContainer() $container->compile(); $dumper = new PhpDumper($container); - $dump = $dumper->dump(); $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_tsantos.php', $dumper->dump()); }