Require exact match when reading from stdin with a dash
This commit is contained in:
parent
81ac674b61
commit
3d14b79dad
@ -77,9 +77,9 @@ EOF
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$filenames = $input->getArgument('filename');
|
||||
$hasStdin = '-' === ($filenames[0] ?? '');
|
||||
$hasStdin = ['-'] === $filenames;
|
||||
|
||||
if ($hasStdin || 0 === \count($filenames)) {
|
||||
if ($hasStdin || !$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);
|
||||
|
@ -83,9 +83,9 @@ EOF
|
||||
$filenames = (array) $input->getArgument('filename');
|
||||
$this->format = $input->getOption('format');
|
||||
$this->displayCorrectFiles = $output->isVerbose();
|
||||
$hasStdin = '-' === ($filenames[0] ?? '');
|
||||
$hasStdin = ['-'] === $filenames;
|
||||
|
||||
if ($hasStdin || 0 === \count($filenames)) {
|
||||
if ($hasStdin || !$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.');
|
||||
}
|
||||
|
@ -86,9 +86,9 @@ EOF
|
||||
$this->format = $input->getOption('format');
|
||||
$this->displayCorrectFiles = $output->isVerbose();
|
||||
$flags = $input->getOption('parse-tags') ? Yaml::PARSE_CUSTOM_TAGS : 0;
|
||||
$hasStdin = '-' === ($filenames[0] ?? '');
|
||||
$hasStdin = ['-'] === $filenames;
|
||||
|
||||
if ($hasStdin || 0 === \count($filenames)) {
|
||||
if ($hasStdin || !$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.');
|
||||
}
|
||||
|
Reference in New Issue
Block a user