Skip to content

Commit 971fc47

Browse files
committed
Improve error message class type
Refer to interfaces/enums instead of classes in more places. Closes GH-7792
1 parent e3ef7bb commit 971fc47

15 files changed

+106
-13
lines changed

Zend/tests/class_alias_009.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ interface c extends a, b { }
1111

1212
?>
1313
--EXPECTF--
14-
Fatal error: Class c cannot implement previously implemented interface a in %s on line %d
14+
Fatal error: Interface c cannot implement previously implemented interface a in %s on line %d

Zend/tests/constants/final_constants/final_const12.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ interface I3 extends I1, I2
1919

2020
?>
2121
--EXPECTF--
22-
Fatal error: Class I3 inherits both I1::C and I2::C, which is ambiguous in %s on line %d
22+
Fatal error: Interface I3 inherits both I1::C and I2::C, which is ambiguous in %s on line %d

Zend/tests/enum/no-enum-implements-backed-enum.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ enum Foo: int implements BackedEnum {}
77

88
?>
99
--EXPECTF--
10-
Fatal error: Class Foo cannot implement previously implemented interface BackedEnum in %s on line %d
10+
Fatal error: Enum Foo cannot implement previously implemented interface BackedEnum in %s on line %d

Zend/tests/enum/no-enum-implements-unit-enum.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ enum Foo implements UnitEnum {}
77

88
?>
99
--EXPECTF--
10-
Fatal error: Class Foo cannot implement previously implemented interface UnitEnum in %s on line %d
10+
Fatal error: Enum Foo cannot implement previously implemented interface UnitEnum in %s on line %d

Zend/tests/gh7792_1.phpt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
GH-7792 (Refer to enum as enum instead of class)
3+
--FILE--
4+
<?php
5+
6+
interface A {
7+
public function a(): void;
8+
}
9+
10+
enum B implements A {}
11+
12+
?>
13+
--EXPECTF--
14+
Fatal error: Enum B must implement 1 abstract private method (A::a) in %s on line %d

Zend/tests/gh7792_2.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
GH-7792 (Refer to enum as enum instead of class)
3+
--FILE--
4+
<?php
5+
6+
enum Foo implements Throwable {}
7+
8+
?>
9+
--EXPECTF--
10+
Fatal error: Enum Foo cannot implement interface Throwable in %s on line %d

Zend/tests/gh7792_3.phpt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
GH-7792 (Refer to enum as enum instead of class)
3+
--FILE--
4+
<?php
5+
6+
interface A {
7+
const FOO = 'foo';
8+
}
9+
10+
interface B {
11+
const FOO = 'foo';
12+
}
13+
14+
enum Foo implements A, B {}
15+
16+
?>
17+
--EXPECTF--
18+
Fatal error: Enum Foo inherits both A::FOO and B::FOO, which is ambiguous in %s on line %d

Zend/tests/gh7792_4.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
GH-7792 (Refer to enum as enum instead of class)
3+
--FILE--
4+
<?php
5+
6+
interface A {}
7+
8+
enum Foo implements A, A {}
9+
10+
?>
11+
--EXPECTF--
12+
Fatal error: Enum Foo cannot implement previously implemented interface A in %s on line %d

Zend/tests/gh7792_5.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
GH-7792 (Refer to enum as enum instead of class)
3+
--FILE--
4+
<?php
5+
6+
enum Foo implements Traversable {}
7+
8+
?>
9+
--EXPECT--
10+
Fatal error: Enum Foo must implement interface Traversable as part of either Iterator or IteratorAggregate in Unknown on line 0

Zend/tests/objects_014.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ interface bar extends foo, foo {
1212
echo "Done\n";
1313
?>
1414
--EXPECTF--
15-
Fatal error: Class bar cannot implement previously implemented interface foo in %s on line %d
15+
Fatal error: Interface bar cannot implement previously implemented interface foo in %s on line %d

0 commit comments

Comments
 (0)