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 2f8ac04

Browse filesBrowse files
committed
minor #42390 [FrameworkBundle] remove dead conditions in Translation Commands (acran)
This PR was merged into the 5.4 branch. Discussion ---------- [FrameworkBundle] remove dead conditions in Translation Commands | 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](https://github.com/symfony/symfony/blob/e617a9b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php#L165-L170): ~~~php $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: * in [`TranslationDebugCommand.php`](b6eb1f4#diff-67afa5b8860d0df4e44f1e1fc89f444b7ac77de515b698a6824dd5403a0acdbcL187-L194) * in [`TranslationUpdateCommand.php `](b6eb1f4#diff-a01c7858e84f1868a427634740511da7c8c73e56772baa78bdcd98200d7125c0L180-L187) Rebased from 5.3 to 5.4, see #42362 /cc `@fabpot` Commits ------- 22db5ad [FrameworkBundle] remove dead conditions in Translation Commands
2 parents 2d42a8a + 22db5ad commit 2f8ac04
Copy full SHA for 2f8ac04

File tree

Expand file treeCollapse file tree

2 files changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+2
-2
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
165165
$transPaths = [$path.'/translations'];
166166
$codePaths = [$path.'/templates'];
167167

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

‎src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
197197
$transPaths = [$path.'/translations'];
198198
$codePaths = [$path.'/templates'];
199199

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.