Skip to content

Commit

Permalink
Handle anonymous classes (#3399)
Browse files Browse the repository at this point in the history
  • Loading branch information
AJenbo authored Jun 27, 2024
1 parent e382382 commit 1a9c502
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions CodeLite/PHPSourceFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,14 +774,17 @@ void PHPSourceFile::OnClass(const phpLexerToken& tok)
bool isAbstractClass = LookBackTokensContains(kPHP_T_ABSTRACT);

// Read until we get the class name
wxString name;
phpLexerToken token;
while(NextToken(token)) {
if(token.IsAnyComment())
continue;
if(token.type != kPHP_T_IDENTIFIER) {
// expecting the class name
return;
// Anonymous classes
name = "@anonymous/" + m_filename.GetFullPath() + "/" + wxString::Format(wxT("%i"), token.lineNumber);
break;
}
name = PrependCurrentScope(token.Text());
break;
}

Expand All @@ -796,7 +799,7 @@ void PHPSourceFile::OnClass(const phpLexerToken& tok)
pClass->SetIsInterface(tok.type == kPHP_T_INTERFACE);
pClass->SetIsAbstractClass(isAbstractClass);
pClass->SetIsTrait(tok.type == kPHP_T_TRAIT);
pClass->SetFullName(PrependCurrentScope(token.Text()));
pClass->SetFullName(name);
pClass->SetLine(token.lineNumber);

if (tok.type == kPHP_T_ENUM) {
Expand Down

0 comments on commit 1a9c502

Please sign in to comment.