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
Generate only 1, not 2 newlines at the end of baseline #1243
Merged
ondrejmirtes
merged 6 commits into
phpstan:1.6.x
from
VasekPurchart:baseline-duplicate-eol
Apr 29, 2022
Merged
Generate only 1, not 2 newlines at the end of baseline #1243
ondrejmirtes
merged 6 commits into
phpstan:1.6.x
from
VasekPurchart:baseline-duplicate-eol
Apr 29, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VasekPurchart
force-pushed
the
baseline-duplicate-eol
branch
from
April 25, 2022 15:43
c539f1f
to
faaf346
Compare
VasekPurchart
force-pushed
the
baseline-duplicate-eol
branch
from
April 26, 2022 07:19
faaf346
to
c4fb213
Compare
ondrejmirtes
requested changes
Apr 27, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took this step so that this change can be properly testable: 3a3c69e
Wer're now free to change the formatErrors()
method signature to pass in an existing baseline file.
The desired behaviour can now be nicely tested in BaselineNeonErrorFormatterTest.
VasekPurchart
force-pushed
the
baseline-duplicate-eol
branch
from
April 28, 2022 10:49
c4fb213
to
1dda986
Compare
VasekPurchart
force-pushed
the
baseline-duplicate-eol
branch
2 times, most recently
from
April 28, 2022 11:03
df58865
to
7c535d4
Compare
VasekPurchart
force-pushed
the
baseline-duplicate-eol
branch
from
April 28, 2022 11:27
7c535d4
to
b51b05f
Compare
VasekPurchart
force-pushed
the
baseline-duplicate-eol
branch
from
April 28, 2022 15:35
18a7384
to
e944e72
Compare
ondrejmirtes
approved these changes
Apr 29, 2022
Thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have noticed, that baseline has two newlines at the end of file, which is weird because the convention for most text based files is to have one. I believe PHPStan follows it as well, even for neon, e.g.: https://github.com/phpstan/phpstan-src/blob/831469c9c406f18e537dd8c46b8b9b28a3897450/build/phpstan.neon .
But baseline is generated using
Neon::encode()
and this puts two newlines at the end of file. From my research I believe this is due to the fact that the encoding puts empty lines between array items and there is no exception for the last one.I do not believe that changing this in
Neon
is desirable - too big of a change for too little gain. Plus if it were to be omitted only after the last item, it could lead to uneven results with concatenating multiple separately encoded neons etc. On the other hand in PHPStan we already know the structure of the whole file, so we can solve it here easily.I included measures not to change the baseline file if this would be the only change in order to prevent bugging people with it. It will disappear with the next "real" change.