Skip to content

Commit a6b7a4b

Browse files
committed
minor #14937 Standardize the name of the exception variables (javiereguiluz)
This PR was squashed before being merged into the 2.3 branch (closes #14937). Discussion ---------- Standardize the name of the exception variables | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - See symfony/symfony-docs#4491 for the context of this change. In Symfony source code there are 410 `try ... catch` blocks. More than 95% of them use `$e` as the name of the exception variable. After applying these changes, 407 out of 410 variables are named `$e`. These are the three cases where I didn't change the name of the `$e` variable: * Nested exception in https://github.com/symfony/symfony/blob/2.3/src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php#L40. It uses `$e2` as the name of the nested variable. * Nested exception in https://github.com/symfony/symfony/blob/2.3/src/Symfony/Bundle/TwigBundle/TwigEngine.php#L82. I changed the name of the `$ex` variable to `$e2` to match the previous syntax. * https://github.com/symfony/symfony/blob/2.3/src/Symfony/Component/Console/Helper/DialogHelper.php#L463. I don't know if it's safe to change the name of the `$error` exception variable. Commits ------- e8b924c Standardize the name of the exception variables
2 parents 901ff88 + 0afb8dc commit a6b7a4b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Compiler/ResolveInvalidReferencesPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function process(ContainerBuilder $container)
4747
foreach ($definition->getMethodCalls() as $call) {
4848
try {
4949
$calls[] = array($call[0], $this->processArguments($call[1], true));
50-
} catch (RuntimeException $ignore) {
50+
} catch (RuntimeException $e) {
5151
// this call is simply removed
5252
}
5353
}
@@ -58,7 +58,7 @@ public function process(ContainerBuilder $container)
5858
try {
5959
$value = $this->processArguments(array($value), true);
6060
$properties[$name] = reset($value);
61-
} catch (RuntimeException $ignore) {
61+
} catch (RuntimeException $e) {
6262
// ignore property
6363
}
6464
}

0 commit comments

Comments
 (0)