Skip to content

Commit adfdfb2

Browse files
authored
Improvements in modifier parsing (php#9926)
Use a shared non-terminal for all class modifiers. This avoids conflicts when adding modifiers that are only valid for certain targets. This change is necessary for asymmetric visibility but might be useful for other future additions. Closes phpGH-9926
1 parent 2cf03b6 commit adfdfb2

21 files changed

+179
-76
lines changed

Zend/tests/access_modifiers_007.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ class test {
1010
echo "Done\n";
1111
?>
1212
--EXPECTF--
13-
Fatal error: Cannot use the final modifier on an abstract class member in %s on line %d
13+
Fatal error: Cannot use the final modifier on an abstract method in %s on line %d

Zend/tests/ctor_promotion_additional_modifiers.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ class Test {
99

1010
?>
1111
--EXPECTF--
12-
Parse error: syntax error, unexpected token "static", expecting variable in %s on line %d
12+
Fatal error: Cannot use the static modifier on a promoted property in %s on line %d

Zend/tests/errmsg_037.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ class test {
1010
echo "Done\n";
1111
?>
1212
--EXPECTF--
13-
Fatal error: Properties cannot be declared abstract in %s on line %d
13+
Fatal error: Cannot use the abstract modifier on a property in %s on line %d

Zend/tests/errmsg_038.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ class test {
1010
echo "Done\n";
1111
?>
1212
--EXPECTF--
13-
Fatal error: Cannot declare property test::$var final, the final modifier is allowed only for methods, classes, and class constants in %s on line %d
13+
Fatal error: Cannot use the final modifier on a property in %s on line %d

Zend/tests/readonly_props/readonly_const.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ class Test {
99

1010
?>
1111
--EXPECTF--
12-
Fatal error: Cannot use 'readonly' as constant modifier in %s on line %d
12+
Fatal error: Cannot use the readonly modifier on a class constant in %s on line %d

Zend/tests/readonly_props/readonly_method.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ class Test {
99

1010
?>
1111
--EXPECTF--
12-
Fatal error: Cannot use 'readonly' as method modifier in %s on line %d
12+
Fatal error: Cannot use the readonly modifier on a method in %s on line %d

Zend/tests/readonly_props/readonly_method_trait.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ class Test {
99

1010
?>
1111
--EXPECTF--
12-
Fatal error: Cannot use 'readonly' as method modifier in %s on line %d
12+
Fatal error: Cannot use the readonly modifier on a method in %s on line %d

Zend/tests/traits/error_013.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ var_dump($x->test());
1616

1717
?>
1818
--EXPECTF--
19-
Fatal error: Cannot use 'static' as method modifier in %s on line %d
19+
Fatal error: Cannot use "static" as method modifier in trait alias in %s on line %d

Zend/tests/traits/language018.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ class C1 {
1212
}
1313
?>
1414
--EXPECTF--
15-
Fatal error: Cannot use 'abstract' as method modifier in %s on line %d
15+
Fatal error: Cannot use "abstract" as method modifier in trait alias in %s on line %d

Zend/tests/traits/language019.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ class C1 {
1212
}
1313
?>
1414
--EXPECTF--
15-
Fatal error: Cannot use 'final' as method modifier in %s on line %d
15+
Fatal error: Cannot use "final" as method modifier in trait alias in %s on line %d

0 commit comments

Comments
 (0)