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

Skip to content

Remove legacy code from STDIN commands #33509

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
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Symfony/Bridge/Twig/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
13 changes: 4 additions & 9 deletions src/Symfony/Bridge/Twig/Command/LintCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
3 changes: 0 additions & 3 deletions src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ public function testLintFileCompileTimeException()
$this->assertRegExp('/ERROR in \S+ \(line /', trim($tester->getDisplay()));
}

/**
* @group tty
*/
public function testLintDefaultPaths()
{
$tester = $this->createCommandTester();
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Translation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
15 changes: 5 additions & 10 deletions src/Symfony/Component/Translation/Command/XliffLintCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Yaml/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
15 changes: 5 additions & 10 deletions src/Symfony/Component/Yaml/Command/LintCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down