Skip to content

#441 refactor: Update brace level check to handle traits in function … - #448

Open
Ollec wants to merge 1 commit into
terryyin:masterfrom
Ollec:#441_trait_with_multiple_functions
Open

#441 refactor: Update brace level check to handle traits in function …#448
Ollec wants to merge 1 commit into
terryyin:masterfrom
Ollec:#441_trait_with_multiple_functions

Conversation

@Ollec

@Ollec Ollec commented Dec 6, 2025

Copy link
Copy Markdown
Contributor

Fix a bug where PHP traits with multiple functions only detected the first function, which incorrectly spanned the entire file. The issue was in _function_body() - the condition to detect function end used self.in_class but didn't account for self.in_trait. Functions inside traits now correctly end at brace level 1, same as classes. Fixes the issue reported for lizard 1.18.
Resolves: #441

@Ollec Ollec changed the title #411 refactor: Update brace level check to handle traits in function … #441 refactor: Update brace level check to handle traits in function … Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: PHP parsing of traits not working correctly

1 participant