From 1994ffe61a90d7d192fa3f89a36918d878c6a1ae Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Sun, 8 Sep 2019 22:35:18 -0400 Subject: [PATCH] remove legacy code from STDIN commands --- src/Symfony/Bridge/Twig/CHANGELOG.md | 1 + src/Symfony/Bridge/Twig/Command/LintCommand.php | 13 ++++--------- .../Bridge/Twig/Tests/Command/LintCommandTest.php | 3 --- src/Symfony/Component/Translation/CHANGELOG.md | 1 + .../Translation/Command/XliffLintCommand.php | 15 +++++---------- src/Symfony/Component/Yaml/CHANGELOG.md | 1 + .../Component/Yaml/Command/LintCommand.php | 15 +++++---------- 7 files changed, 17 insertions(+), 32 deletions(-) diff --git a/src/Symfony/Bridge/Twig/CHANGELOG.md b/src/Symfony/Bridge/Twig/CHANGELOG.md index 7227605312c94..c37b0f0f1552b 100644 --- a/src/Symfony/Bridge/Twig/CHANGELOG.md +++ b/src/Symfony/Bridge/Twig/CHANGELOG.md @@ -7,6 +7,7 @@ CHANGELOG * removed `TwigEngine` class, use `\Twig\Environment` instead. * removed `transChoice` filter and token * `HttpFoundationExtension` requires a `UrlHelper` on instantiation + * removed support for implicit STDIN usage in the `lint:twig` command, use `lint:twig -` (append a dash) instead to make it explicit. 4.4.0 ----- diff --git a/src/Symfony/Bridge/Twig/Command/LintCommand.php b/src/Symfony/Bridge/Twig/Command/LintCommand.php index 3e76b36dfa5cf..90955f8dbadcf 100644 --- a/src/Symfony/Bridge/Twig/Command/LintCommand.php +++ b/src/Symfony/Bridge/Twig/Command/LintCommand.php @@ -77,17 +77,12 @@ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $filenames = $input->getArgument('filename'); - $hasStdin = '-' === ($filenames[0] ?? ''); - if ($hasStdin || 0 === \count($filenames)) { - if ($hasStdin || 0 === ftell(STDIN)) { // remove 0 === ftell(STDIN) check in 5.0 - if (!$hasStdin) { - @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); - } - - return $this->display($input, $output, $io, [$this->validate($this->getStdin(), uniqid('sf_', true))]); - } + if ('-' === ($filenames[0] ?? '')) { + return $this->display($input, $output, $io, [$this->validate($this->getStdin(), uniqid('sf_', true))]); + } + if (0 === \count($filenames)) { $loader = $this->twig->getLoader(); if ($loader instanceof FilesystemLoader) { $paths = []; diff --git a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php index 3ac46512f182d..fe3a7231b4e83 100644 --- a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php @@ -66,9 +66,6 @@ public function testLintFileCompileTimeException() $this->assertRegExp('/ERROR in \S+ \(line /', trim($tester->getDisplay())); } - /** - * @group tty - */ public function testLintDefaultPaths() { $tester = $this->createCommandTester(); diff --git a/src/Symfony/Component/Translation/CHANGELOG.md b/src/Symfony/Component/Translation/CHANGELOG.md index 79d3a46e4ec04..3f3d81cd55b79 100644 --- a/src/Symfony/Component/Translation/CHANGELOG.md +++ b/src/Symfony/Component/Translation/CHANGELOG.md @@ -14,6 +14,7 @@ CHANGELOG * removed `FileDumper::setBackup()` and `TranslationWriter::disableBackup()` * removed `MessageFormatter::choiceFormat()` * added argument `$filename` to `PhpExtractor::parseTokens()` + * removed support for implicit STDIN usage in the `lint:xliff` command, use `lint:xliff -` (append a dash) instead to make it explicit. 4.4.0 ----- diff --git a/src/Symfony/Component/Translation/Command/XliffLintCommand.php b/src/Symfony/Component/Translation/Command/XliffLintCommand.php index 8137415e9927e..c77c2fa556912 100644 --- a/src/Symfony/Component/Translation/Command/XliffLintCommand.php +++ b/src/Symfony/Component/Translation/Command/XliffLintCommand.php @@ -83,20 +83,15 @@ protected function execute(InputInterface $input, OutputInterface $output) $filenames = (array) $input->getArgument('filename'); $this->format = $input->getOption('format'); $this->displayCorrectFiles = $output->isVerbose(); - $hasStdin = '-' === ($filenames[0] ?? ''); - - if ($hasStdin || 0 === \count($filenames)) { - if (!$hasStdin && 0 !== ftell(STDIN)) { // remove 0 !== ftell(STDIN) check in 5.0 - throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); - } - - if (!$hasStdin) { - @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); - } + if ('-' === ($filenames[0] ?? '')) { return $this->display($io, [$this->validate($this->getStdin())]); } + if (0 === \count($filenames)) { + throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); + } + $filesInfo = []; foreach ($filenames as $filename) { if (!$this->isReadable($filename)) { diff --git a/src/Symfony/Component/Yaml/CHANGELOG.md b/src/Symfony/Component/Yaml/CHANGELOG.md index 0879b28a45cfb..5627178c73246 100644 --- a/src/Symfony/Component/Yaml/CHANGELOG.md +++ b/src/Symfony/Component/Yaml/CHANGELOG.md @@ -5,6 +5,7 @@ CHANGELOG ----- * Removed support for mappings inside multi-line strings. + * removed support for implicit STDIN usage in the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit. 4.4.0 ----- diff --git a/src/Symfony/Component/Yaml/Command/LintCommand.php b/src/Symfony/Component/Yaml/Command/LintCommand.php index 2f3193ba1d243..32b2350dc9534 100644 --- a/src/Symfony/Component/Yaml/Command/LintCommand.php +++ b/src/Symfony/Component/Yaml/Command/LintCommand.php @@ -86,20 +86,15 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->format = $input->getOption('format'); $this->displayCorrectFiles = $output->isVerbose(); $flags = $input->getOption('parse-tags') ? Yaml::PARSE_CUSTOM_TAGS : 0; - $hasStdin = '-' === ($filenames[0] ?? ''); - - if ($hasStdin || 0 === \count($filenames)) { - if (!$hasStdin && 0 !== ftell(STDIN)) { // remove 0 !== ftell(STDIN) check in 5.0 - throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); - } - - if (!$hasStdin) { - @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); - } + if ('-' === ($filenames[0] ?? '')) { return $this->display($io, [$this->validate($this->getStdin(), $flags)]); } + if (0 === \count($filenames)) { + throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); + } + $filesInfo = []; foreach ($filenames as $filename) { if (!$this->isReadable($filename)) { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy