-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Remove unused local variables #34105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unused local variables #34105
Conversation
@@ -81,8 +89,10 @@ public function testConstructorThrowsExceptionIfNoRelatedForm() | |||
|
|||
$nodes = $dom->getElementsByTagName('input'); | |||
|
|||
$form = new Form($nodes->item(0), 'http://example.com'); | |||
$form = new Form($nodes->item(1), 'http://example.com'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second one is never tested since the first one throws an exception.
0f80fb6
to
b806624
Compare
b806624
to
c07cee8
Compare
@@ -130,7 +130,6 @@ public function update(Response $response) | |||
$response->headers->set('Cache-Control', implode(', ', array_keys($flags))); | |||
|
|||
$maxAge = null; | |||
$sMaxage = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$sMaxage
is assigned line 140 and only used in the if
.
@@ -49,7 +49,6 @@ public function collect(Request $request, Response $response, \Exception $except | |||
} | |||
} | |||
|
|||
$content = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$content
is directly assigned in the try and in the catch and there is not check on it.
@@ -59,7 +58,6 @@ public function collect(Request $request, Response $response, \Exception $except | |||
|
|||
$sessionMetadata = []; | |||
$sessionAttributes = []; | |||
$session = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$session
is assigned line 63 and only used in the if
.
@@ -196,7 +196,7 @@ public function testCachingWithDifferentNamesOrder() | |||
$cacheMock = $this->getMockBuilder('Psr\Cache\CacheItemPoolInterface')->getMock(); | |||
$cacheItemMock = $this->getMockBuilder('Psr\Cache\CacheItemInterface')->getMock(); | |||
$expressionLanguage = new ExpressionLanguage($cacheMock); | |||
$savedParsedExpressions = []; | |||
$savedParsedExpression = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is a fix on the test.
@@ -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"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resulting $c
is never reused so the assignation is useless.
@@ -404,7 +404,7 @@ private function darwinRealpath($real) | |||
} | |||
|
|||
if (isset($dirFiles[$file])) { | |||
return $real .= $dirFiles[$file]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning an assignation is useless, $real
is not passed by ref.
@@ -1043,8 +1043,6 @@ private function registerAssetsConfiguration(array $config, ContainerBuilder $co | |||
$container->getDefinition('assets.url_package')->setPrivate(true); | |||
$container->getDefinition('assets.static_version_strategy')->setPrivate(true); | |||
|
|||
$defaultVersion = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$defaultVersion
is always assigned in the if else block.
@@ -425,7 +425,6 @@ private function renderEventListenerTable(EventDispatcherInterface $eventDispatc | |||
$tableHeaders = ['Order', 'Callable', 'Priority']; | |||
$tableRows = []; | |||
|
|||
$order = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$order
is directly reassigned by the foreach.
@@ -28,7 +28,6 @@ public function compile(Compiler $compiler) | |||
|
|||
preg_match('/_([^_]+)$/', $this->getAttribute('name'), $matches); | |||
|
|||
$label = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$label
is assigned line 42 and only used in this code path.
@@ -132,9 +132,6 @@ public function testFindProcessInOpenBasedir() | |||
$this->assertSamePath(PHP_BINARY, $result); | |||
} | |||
|
|||
/** | |||
* @requires PHP 5.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Min PHP version is 5.5.9.
Thank you @fancyweb. |
This PR was merged into the 3.4 branch. Discussion ---------- Remove unused local variables | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - This PR removes useless assignations. There are also somes fixes in tests. Commits ------- c07cee8 Remove unused local variables in tests
This PR was merged into the 4.3 branch. Discussion ---------- [4.3] Remove unused local variables | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Follow up of #34105 on 4.3. Commits ------- 58161b8 [4.3] Remove unused local variables
This PR was merged into the 4.3 branch. Discussion ---------- [4.3] Remove unused local variables | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Follow up of symfony/symfony#34105 on 4.3. Commits ------- 58161b8eec [4.3] Remove unused local variables
This PR was merged into the 4.3 branch. Discussion ---------- [4.3] Remove unused local variables | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Follow up of symfony/symfony#34105 on 4.3. Commits ------- 58161b8eec [4.3] Remove unused local variables
This PR was merged into the 4.3 branch. Discussion ---------- [4.3] Remove unused local variables | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Follow up of symfony/symfony#34105 on 4.3. Commits ------- 58161b8eec [4.3] Remove unused local variables
This PR was merged into the 4.3 branch. Discussion ---------- [4.3] Remove unused local variables | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Follow up of symfony/symfony#34105 on 4.3. Commits ------- 58161b8eec [4.3] Remove unused local variables
This PR was merged into the 4.3 branch. Discussion ---------- [4.3] Remove unused local variables | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Follow up of symfony/symfony#34105 on 4.3. Commits ------- 58161b8eec [4.3] Remove unused local variables
This PR removes useless assignations. There are also somes fixes in tests.