Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit afe5188

Browse files
committed
minor #33509 Remove legacy code from STDIN commands (yceruto)
This PR was merged into the 5.0-dev branch. Discussion ---------- Remove legacy code from STDIN commands | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - See #33496 Commits ------- 1994ffe remove legacy code from STDIN commands
2 parents 6b6562c + 1994ffe commit afe5188

File tree

7 files changed

+17
-32
lines changed

7 files changed

+17
-32
lines changed

src/Symfony/Bridge/Twig/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* removed `TwigEngine` class, use `\Twig\Environment` instead.
88
* removed `transChoice` filter and token
99
* `HttpFoundationExtension` requires a `UrlHelper` on instantiation
10+
* removed support for implicit STDIN usage in the `lint:twig` command, use `lint:twig -` (append a dash) instead to make it explicit.
1011

1112
4.4.0
1213
-----

src/Symfony/Bridge/Twig/Command/LintCommand.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
7777
{
7878
$io = new SymfonyStyle($input, $output);
7979
$filenames = $input->getArgument('filename');
80-
$hasStdin = '-' === ($filenames[0] ?? '');
8180

82-
if ($hasStdin || 0 === \count($filenames)) {
83-
if ($hasStdin || 0 === ftell(STDIN)) { // remove 0 === ftell(STDIN) check in 5.0
84-
if (!$hasStdin) {
85-
@trigger_error('Calling to the "lint:twig" command providing pipe file content to STDIN without passing the dash symbol "-" explicitly is deprecated since Symfony 4.4.', E_USER_DEPRECATED);
86-
}
87-
88-
return $this->display($input, $output, $io, [$this->validate($this->getStdin(), uniqid('sf_', true))]);
89-
}
81+
if ('-' === ($filenames[0] ?? '')) {
82+
return $this->display($input, $output, $io, [$this->validate($this->getStdin(), uniqid('sf_', true))]);
83+
}
9084

85+
if (0 === \count($filenames)) {
9186
$loader = $this->twig->getLoader();
9287
if ($loader instanceof FilesystemLoader) {
9388
$paths = [];

src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ public function testLintFileCompileTimeException()
6666
$this->assertRegExp('/ERROR in \S+ \(line /', trim($tester->getDisplay()));
6767
}
6868

69-
/**
70-
* @group tty
71-
*/
7269
public function testLintDefaultPaths()
7370
{
7471
$tester = $this->createCommandTester();

src/Symfony/Component/Translation/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ CHANGELOG
1414
* removed `FileDumper::setBackup()` and `TranslationWriter::disableBackup()`
1515
* removed `MessageFormatter::choiceFormat()`
1616
* added argument `$filename` to `PhpExtractor::parseTokens()`
17+
* removed support for implicit STDIN usage in the `lint:xliff` command, use `lint:xliff -` (append a dash) instead to make it explicit.
1718

1819
4.4.0
1920
-----

src/Symfony/Component/Translation/Command/XliffLintCommand.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
8383
$filenames = (array) $input->getArgument('filename');
8484
$this->format = $input->getOption('format');
8585
$this->displayCorrectFiles = $output->isVerbose();
86-
$hasStdin = '-' === ($filenames[0] ?? '');
87-
88-
if ($hasStdin || 0 === \count($filenames)) {
89-
if (!$hasStdin && 0 !== ftell(STDIN)) { // remove 0 !== ftell(STDIN) check in 5.0
90-
throw new RuntimeException('Please provide a filename or pipe file content to STDIN.');
91-
}
92-
93-
if (!$hasStdin) {
94-
@trigger_error('Calling to the "lint:xliff" command providing pipe file content to STDIN without passing the dash symbol "-" explicitly is deprecated since Symfony 4.4.', E_USER_DEPRECATED);
95-
}
9686

87+
if ('-' === ($filenames[0] ?? '')) {
9788
return $this->display($io, [$this->validate($this->getStdin())]);
9889
}
9990

91+
if (0 === \count($filenames)) {
92+
throw new RuntimeException('Please provide a filename or pipe file content to STDIN.');
93+
}
94+
10095
$filesInfo = [];
10196
foreach ($filenames as $filename) {
10297
if (!$this->isReadable($filename)) {

src/Symfony/Component/Yaml/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
-----
66

77
* Removed support for mappings inside multi-line strings.
8+
* removed support for implicit STDIN usage in the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit.
89

910
4.4.0
1011
-----

src/Symfony/Component/Yaml/Command/LintCommand.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
8686
$this->format = $input->getOption('format');
8787
$this->displayCorrectFiles = $output->isVerbose();
8888
$flags = $input->getOption('parse-tags') ? Yaml::PARSE_CUSTOM_TAGS : 0;
89-
$hasStdin = '-' === ($filenames[0] ?? '');
90-
91-
if ($hasStdin || 0 === \count($filenames)) {
92-
if (!$hasStdin && 0 !== ftell(STDIN)) { // remove 0 !== ftell(STDIN) check in 5.0
93-
throw new RuntimeException('Please provide a filename or pipe file content to STDIN.');
94-
}
95-
96-
if (!$hasStdin) {
97-
@trigger_error('Calling to the "lint:yaml" command providing pipe file content to STDIN without passing the dash symbol "-" explicitly is deprecated since Symfony 4.4.', E_USER_DEPRECATED);
98-
}
9989

90+
if ('-' === ($filenames[0] ?? '')) {
10091
return $this->display($io, [$this->validate($this->getStdin(), $flags)]);
10192
}
10293

94+
if (0 === \count($filenames)) {
95+
throw new RuntimeException('Please provide a filename or pipe file content to STDIN.');
96+
}
97+
10398
$filesInfo = [];
10499
foreach ($filenames as $filename) {
105100
if (!$this->isReadable($filename)) {

0 commit comments

Comments
 (0)