-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Normalize comment classes #867
base: master
Are you sure you want to change the base?
Conversation
Test failures are legitimate. |
@nikic yes, because
If you agree with these changes, I'll update the tests |
In the past, single-line comments were stored together with the trailing newline. Later we switched to the PHP8 comment representation, where the trailing newline is not part of the comment anymore. As such, there is also no need to trim here. This is split out from GH-867.
The change to trimming is fine -- to verify, I've landed it separately as 1f504d2. This was a leftover from an older implementation, when comments were expected to have a trailing newline. It's some of the other changes that cause problematic changes in formatting. |
@nikic hm... I'm don't see how other changes can fail tests - content changed only here |
@nikic tests failed because |
@nikic I'm fixed fake/incorrect data passing to |
@nikic added alternative check to test instances: || ($this->endLine === -1 && strpos($this->text, "\n") !== false) |
getReformattedText()
: fix@return
types, remove comment trimming to keep empty lines in comment at begin and end, optimize detection of multi-line commentsgetShortestWhitespacePrefixLen()
: replace floatINF
toPHP_INT_MAX
jsonSerialize()
: update@psalm-return
and remove redundant@return
, fixnodeType