Skip to content

Commit

Permalink
SONARPHP-1605 Remove static scalar
Browse files Browse the repository at this point in the history
  • Loading branch information
GabinL21 committed Jan 6, 2025
1 parent a2f39d7 commit 0dc3a7d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 48 deletions.
19 changes: 6 additions & 13 deletions php-frontend/src/main/java/org/sonar/php/parser/PHPGrammar.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,22 +217,22 @@ public VariableDeclarationTree MEMBER_CONST_DECLARATION() {
return b.<VariableDeclarationTree>nonterminal(PHPLexicalGrammar.MEMBER_CONST_DECLARATION).is(
f.memberConstDeclaration(
b.token(PHPLexicalGrammar.IDENTIFIER_OR_KEYWORD),
b.optional(f.newTuple(b.token(EQU), STATIC_SCALAR()))));
b.optional(f.newTuple(b.token(EQU), EXPRESSION()))));
}

public VariableDeclarationTree CONST_VAR() {
return b.<VariableDeclarationTree>nonterminal(PHPLexicalGrammar.CONSTANT_VAR).is(
f.constDeclaration(
b.token(PHPLexicalGrammar.IDENTIFIER),
b.token(EQU),
STATIC_SCALAR()));
EXPRESSION()));
}

public VariableDeclarationTree VARIABLE_DECLARATION() {
return b.<VariableDeclarationTree>nonterminal(PHPLexicalGrammar.VARIABLE_DECLARATION).is(
f.variableDeclaration(
b.token(PHPLexicalGrammar.REGULAR_VAR_IDENTIFIER),
b.optional(f.newTuple(b.token(EQU), STATIC_SCALAR()))));
b.optional(f.newTuple(b.token(EQU), EXPRESSION()))));
}

public NamespaceNameTree NAMESPACE_NAME() {
Expand Down Expand Up @@ -358,7 +358,7 @@ public EnumCaseTree ENUM_CASE() {
b.zeroOrMore(ATTRIBUTE_GROUP()),
b.token(CASE),
NAME_IDENTIFIER_OR_KEYWORD(),
b.optional(f.newTuple(b.token(EQU), STATIC_SCALAR())),
b.optional(f.newTuple(b.token(EQU), EXPRESSION())),
EOS()));
}

Expand Down Expand Up @@ -509,7 +509,7 @@ public ParameterTree PARAMETER() {
b.optional(
f.newTuple(
b.token(PHPPunctuator.EQU),
STATIC_SCALAR())),
EXPRESSION())),
b.optional(PROPERTY_HOOK_LIST())));
}

Expand Down Expand Up @@ -798,7 +798,7 @@ public VariableDeclarationTree STATIC_VAR() {
return b.<VariableDeclarationTree>nonterminal(PHPLexicalGrammar.STATIC_VAR).is(
f.staticVar(
b.token(PHPLexicalGrammar.REGULAR_VAR_IDENTIFIER),
b.optional(f.newTuple(b.token(EQU), STATIC_SCALAR()))));
b.optional(f.newTuple(b.token(EQU), EXPRESSION()))));
}

public DeclareStatementTree DECLARE_STATEMENT() {
Expand Down Expand Up @@ -1816,13 +1816,6 @@ public VariableTree LEXICAL_VARIABLE() {
VARIABLE_IDENTIFIER()));
}

public ExpressionTree STATIC_SCALAR() {
return b.<ExpressionTree>nonterminal(PHPLexicalGrammar.STATIC_SCALAR).is(
b.firstOf(
f.combinedScalarOffset(ARRAY_INITIALIZER(), b.zeroOrMore(DIMENSIONAL_OFFSET())),
EXPRESSION()));
}

public FunctionCallTree INTERNAL_FUNCTION() {
return b.<FunctionCallTree>nonterminal(PHPLexicalGrammar.INTERNAL_FUNCTION).is(
b.firstOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ public enum PHPLexicalGrammar implements GrammarRuleKey {
OBJECT_MEMBER_ACCESS,
FUNCTION_CALL_PARAMETER_LIST,
DIMENSIONAL_OFFSET,
STATIC_SCALAR,
ARRAY_INIALIZER,
COMMON_SCALAR,
YIELD_SCALAR,
Expand Down

This file was deleted.

0 comments on commit 0dc3a7d

Please sign in to comment.