You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Typed class constants (incompatible composition; traits)
3
+
--FILE--
4
+
<?php
5
+
6
+
trait T {
7
+
publicconst ?arrayCONST1 = [];
8
+
}
9
+
10
+
class C {
11
+
use T;
12
+
13
+
publicconstCONST1 = [];
14
+
}
15
+
16
+
?>
17
+
--EXPECTF--
18
+
Fatal error: C and T define the same constant (CONST1) in the composition of C. However, the definition differs and is considered incompatible. Class was composed in %s on line %d
Typed class constants (incompatible covariant composition; traits)
3
+
--FILE--
4
+
<?php
5
+
6
+
trait T {
7
+
publicconst ?arrayCONST1 = [];
8
+
}
9
+
10
+
class C {
11
+
use T;
12
+
13
+
publicconstarrayCONST1 = [];
14
+
}
15
+
16
+
?>
17
+
--EXPECTF--
18
+
Fatal error: C and T define the same constant (CONST1) in the composition of C. However, the definition differs and is considered incompatible. Class was composed in %s on line %d
Typed class constants (incompatible contravariant composition; traits)
3
+
--FILE--
4
+
<?php
5
+
6
+
trait T {
7
+
publicconstarrayCONST1 = [];
8
+
}
9
+
10
+
class C {
11
+
use T;
12
+
13
+
publicconst ?arrayCONST1 = [];
14
+
}
15
+
16
+
?>
17
+
--EXPECTF--
18
+
Fatal error: C and T define the same constant (CONST1) in the composition of C. However, the definition differs and is considered incompatible. Class was composed in %s on line %d
"%s and %s define the same constant (%s) in the composition of %s. However, the definition differs and is considered incompatible. Class was composed",
if (!check_trait_property_or_constant_value_compatibility(ce, &trait_constant->value, &existing_constant->value)) {
2270
2299
/* There is an existing constant of the same name, and it conflicts with the new one, so let's throw a fatal error */
2271
-
zend_error_noreturn(E_COMPILE_ERROR,
2272
-
"%s and %s define the same constant (%s) in the composition of %s. However, the definition differs and is considered incompatible. Class was composed",
0 commit comments