Skip to content

[Yaml] include file and line no in deprecation message #24357

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 28, 2017

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Sep 28, 2017

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

Now that we know the filename being parsed we can improve deprecation messages which is especially useful when trying to find the DI config file that triggers a particular deprecation.

@xabbuh
Copy link
Member Author

xabbuh commented Sep 28, 2017

IMO we should still discuss whether we want to merge #24191 to improve the situation in 3.3 applications though.

@xabbuh xabbuh force-pushed the yaml-deprecation-messages branch from 5a10a38 to f618e43 Compare September 28, 2017 10:55
$message .= ' in '.$this->filename;
}

$message .= ' on line '.($this->getRealCurrentLineNb() + 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it makes sense to specify the line if we don't know the filename.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it can be helpful if someone parses a big YAML file, but reads the file contents themselves (thus using Yaml::parse() instead of Yaml::parseFile()).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we reverted that before because it cluttered deprecation logs, so same pov as fab here to me

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the time we did that we didn't have the filenames. Now we have them because internally we use parseFile() instead of parse(). So having line numbers without filenames just affects users using the YAML parser in their own code (and there they probably know the filenames).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And by the way, when using the lint command you will get the line numbers too now (you wouldn't before).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, fair enough

@fabpot
Copy link
Member

fabpot commented Sep 28, 2017

Thank you @xabbuh.

@fabpot fabpot merged commit f618e43 into symfony:3.4 Sep 28, 2017
fabpot added a commit that referenced this pull request Sep 28, 2017
… (xabbuh)

This PR was merged into the 3.4 branch.

Discussion
----------

[Yaml] include file and line no in deprecation message

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

Now that we know the filename being parsed we can improve deprecation messages which is especially useful when trying to find the DI config file that triggers a particular deprecation.

Commits
-------

f618e43 include file and line no in deprecation message
@xabbuh xabbuh deleted the yaml-deprecation-messages branch September 28, 2017 13:24
This was referenced Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants