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 https://github.com/symfony/symfony/pull/33496
Commits
-------
1994ffe61a
remove legacy code from STDIN commands
This commit is contained in:
commit
afe5188ff5
@ -7,6 +7,7 @@ CHANGELOG
|
|||||||
* removed `TwigEngine` class, use `\Twig\Environment` instead.
|
* removed `TwigEngine` class, use `\Twig\Environment` instead.
|
||||||
* removed `transChoice` filter and token
|
* removed `transChoice` filter and token
|
||||||
* `HttpFoundationExtension` requires a `UrlHelper` on instantiation
|
* `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
|
4.4.0
|
||||||
-----
|
-----
|
||||||
|
@ -77,17 +77,12 @@ EOF
|
|||||||
{
|
{
|
||||||
$io = new SymfonyStyle($input, $output);
|
$io = new SymfonyStyle($input, $output);
|
||||||
$filenames = $input->getArgument('filename');
|
$filenames = $input->getArgument('filename');
|
||||||
$hasStdin = '-' === ($filenames[0] ?? '');
|
|
||||||
|
|
||||||
if ($hasStdin || 0 === \count($filenames)) {
|
if ('-' === ($filenames[0] ?? '')) {
|
||||||
if ($hasStdin || 0 === ftell(STDIN)) { // remove 0 === ftell(STDIN) check in 5.0
|
return $this->display($input, $output, $io, [$this->validate($this->getStdin(), uniqid('sf_', true))]);
|
||||||
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 (0 === \count($filenames)) {
|
||||||
$loader = $this->twig->getLoader();
|
$loader = $this->twig->getLoader();
|
||||||
if ($loader instanceof FilesystemLoader) {
|
if ($loader instanceof FilesystemLoader) {
|
||||||
$paths = [];
|
$paths = [];
|
||||||
|
@ -66,9 +66,6 @@ class LintCommandTest extends TestCase
|
|||||||
$this->assertRegExp('/ERROR in \S+ \(line /', trim($tester->getDisplay()));
|
$this->assertRegExp('/ERROR in \S+ \(line /', trim($tester->getDisplay()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @group tty
|
|
||||||
*/
|
|
||||||
public function testLintDefaultPaths()
|
public function testLintDefaultPaths()
|
||||||
{
|
{
|
||||||
$tester = $this->createCommandTester();
|
$tester = $this->createCommandTester();
|
||||||
|
@ -14,6 +14,7 @@ CHANGELOG
|
|||||||
* removed `FileDumper::setBackup()` and `TranslationWriter::disableBackup()`
|
* removed `FileDumper::setBackup()` and `TranslationWriter::disableBackup()`
|
||||||
* removed `MessageFormatter::choiceFormat()`
|
* removed `MessageFormatter::choiceFormat()`
|
||||||
* added argument `$filename` to `PhpExtractor::parseTokens()`
|
* 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
|
4.4.0
|
||||||
-----
|
-----
|
||||||
|
@ -83,20 +83,15 @@ EOF
|
|||||||
$filenames = (array) $input->getArgument('filename');
|
$filenames = (array) $input->getArgument('filename');
|
||||||
$this->format = $input->getOption('format');
|
$this->format = $input->getOption('format');
|
||||||
$this->displayCorrectFiles = $output->isVerbose();
|
$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())]);
|
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 = [];
|
$filesInfo = [];
|
||||||
foreach ($filenames as $filename) {
|
foreach ($filenames as $filename) {
|
||||||
if (!$this->isReadable($filename)) {
|
if (!$this->isReadable($filename)) {
|
||||||
|
@ -5,6 +5,7 @@ CHANGELOG
|
|||||||
-----
|
-----
|
||||||
|
|
||||||
* Removed support for mappings inside multi-line strings.
|
* 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
|
4.4.0
|
||||||
-----
|
-----
|
||||||
|
@ -86,20 +86,15 @@ EOF
|
|||||||
$this->format = $input->getOption('format');
|
$this->format = $input->getOption('format');
|
||||||
$this->displayCorrectFiles = $output->isVerbose();
|
$this->displayCorrectFiles = $output->isVerbose();
|
||||||
$flags = $input->getOption('parse-tags') ? Yaml::PARSE_CUSTOM_TAGS : 0;
|
$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)]);
|
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 = [];
|
$filesInfo = [];
|
||||||
foreach ($filenames as $filename) {
|
foreach ($filenames as $filename) {
|
||||||
if (!$this->isReadable($filename)) {
|
if (!$this->isReadable($filename)) {
|
||||||
|
Reference in New Issue
Block a user