Skip to content

[FrameworkBundle] remove dead conditions in Translation Commands #42390

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

Merged
merged 1 commit into from
Aug 6, 2021

Conversation

acran
Copy link
Contributor

@acran acran commented Aug 5, 2021

Q A
Branch? 5.4
Bug fix? no
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

This is just a trivial removal of unused code I stumbled upon while debugging #42361. In the original code:

$transPaths = [$path.'/translations'];
$codePaths = [$path.'/templates'];

if (!is_dir($transPaths[0]) && !isset($transPaths[1])) {
		throw new InvalidArgumentException(sprintf('"%s" is neither an enabled bundle nor a directory.', $transPaths[0]));
}

The second part of the condition isset($transPaths[1]) will always evaluate to true, since $targetPath is just set 3 lines above but only has a single element.

This check was originally to support legacy paths which was removed in b6eb1f4:

Rebased from 5.3 to 5.4, see #42362
/cc @fabpot

Since $targetPath is directly set just 3 lines above
!isset($targetPath[1]) will *always* evaluate to true.

This check was originally to support legacy paths which was removed in
b6eb1f4
@fabpot
Copy link
Member

fabpot commented Aug 6, 2021

Thank you @acran.

@fabpot fabpot merged commit 2f8ac04 into symfony:5.4 Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants