Skip to content
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

Require exact match when reading from stdin with a dash #33511

Merged
merged 1 commit into from Sep 9, 2019

Conversation

@nicolas-grekas
Copy link
Member

commented Sep 9, 2019

Q A
Branch? 4.4
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

I think reading from stdin should happen only when the argument is exactly a dash, with no other files on the command line.

The alternative is to allow a dash at any position in the list of files, but I'm not sure that'd make sense.

@nicolas-grekas nicolas-grekas added this to the next milestone Sep 9, 2019

@stof

This comment has been minimized.

Copy link
Member

commented Sep 9, 2019

I agree with that. Mixing STDIN with other filenames looks weird to me.

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);

This comment has been minimized.

Copy link
@stof

stof Sep 9, 2019

Member

should we trigger a deprecation warning here, or display a warning on STDERR ? I don't think CLI deprecations are visible to users properly.

This comment has been minimized.

Copy link
@nicolas-grekas

nicolas-grekas Sep 9, 2019

Author Member

I wondered the same in the original PR and deprecations are now displayed when using -vv. We used to call $io->caution() explicitly in 2.8, but I didn't find any usage in 3.4 anymore. Thus the current state.

@chalasr
chalasr approved these changes Sep 9, 2019
@chalasr

This comment has been minimized.

Copy link
Member

commented Sep 9, 2019

Thank you @nicolas-grekas.

chalasr added a commit that referenced this pull request Sep 9, 2019
minor #33511 Require exact match when reading from stdin with a dash …
…(nicolas-grekas)

This PR was merged into the 4.4 branch.

Discussion
----------

Require exact match when reading from stdin with a dash

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

I think reading from stdin should happen only when the argument is exactly a dash, with no other files on the command line.

The alternative is to allow a dash at any position in the list of files, but I'm not sure that'd make sense.

Commits
-------

3d14b79 Require exact match when reading from stdin with a dash

@chalasr chalasr merged commit 3d14b79 into symfony:4.4 Sep 9, 2019

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details

@nicolas-grekas nicolas-grekas deleted the nicolas-grekas:lint-cleanup branch Sep 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.