-
-
Notifications
You must be signed in to change notification settings - Fork 10
Added support for return having a nl prefix if one was there previously #11
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
Conversation
WalkthroughAdds a protected pStmt_Return method to ArrayPrinter that inspects tokens before return statements to preserve blank lines after imports; inserts the method before array rendering. Adds tests and fixtures covering imported constants, enum value rendering, expressions, and include+return formatting. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant AF as ArrayFile
participant Parser as PHP Parser
participant TS as TokenStream
participant Printer as ArrayPrinter
Dev->>AF: set(...) and write()
AF->>Parser: parse file -> AST + tokens
AF->>Printer: request printing of AST
Printer->>TS: query tokens at node.startTokenPos and previous positions
TS-->>Printer: token sequence (including newlines/whitespace)
alt double newline detected before return
Printer->>Printer: prepend newline prefix to return rendering
end
Printer-->>AF: formatted PHP with preserved blank line and rendered return
AF-->>Dev: file written
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This PR adds support for including a NL prior to the return statement if one was there previously.
This should fix #10
Summary by CodeRabbit
New Features
Bug Fixes
Tests