};
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Typed property class@anonymous::$int must be int, string used in %s:6
+Fatal error: Uncaught TypeError: Cannot assign string to property class@anonymous::$int of type int in %s:%d
Stack trace:
-#0 %s(2): class@anonymous->__construct('PHP 7 is better...')
+#0 %s(%d): class@anonymous->__construct('PHP 7 is better...')
#1 {main}
- thrown in %s on line 6
+ thrown in %s on line %d
};
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Typed property class@anonymous::$std must be an instance of stdClass, Dummy used in %s:8
+Fatal error: Uncaught TypeError: Cannot assign Dummy to property class@anonymous::$std of type stdClass in %s:%d
Stack trace:
-#0 %s(4): class@anonymous->__construct(Object(Dummy))
+#0 %s(%d): class@anonymous->__construct(Object(Dummy))
#1 {main}
- thrown in %s on line 8
+ thrown in %s on line %d
var_dump($foo->bar);
?>
--EXPECT--
-Typed property Foo::$bar must be int, float used
+Cannot assign float to property Foo::$bar of type int
int(2)
$foo->bar = "1";
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Typed property Foo::$bar must be int, string used in %s:9
+Fatal error: Uncaught TypeError: Cannot assign string to property Foo::$bar of type int in %s:%d
Stack trace:
#0 {main}
- thrown in %s on line 9
+ thrown in %s on line %d
var_dump($foo->bar); # not okay, __get is nasty
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Typed property Foo::$bar must be int, string used in %s:16
+Fatal error: Uncaught TypeError: Cannot assign string to property Foo::$bar of type int in %s:%d
Stack trace:
#0 {main}
- thrown in %s on line 16
+ thrown in %s on line %d
?>
--EXPECT--
int(42)
-Typed property class@anonymous::$baz must be int, null used
+Cannot assign null to property class@anonymous::$baz of type int
int(1)
int(10)
int(10)
["bar"]=>
int(%d)
}
-string(60) "Typed property class@anonymous::$bar must be int, float used"
+string(65) "Cannot assign float to property class@anonymous::$bar of type int"
object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
["bar"]=>
int(%d)
}
-string(60) "Typed property class@anonymous::$bar must be int, float used"
+string(65) "Cannot assign float to property class@anonymous::$bar of type int"
object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Typed property A::$foo must be int, A used in %s:%d
+Fatal error: Uncaught TypeError: Cannot assign A to property A::$foo of type int in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
--EXPECTF--
string(3) "bar"
-Fatal error: Uncaught TypeError: Typed property Foo::$bar must be int, null used in %s:14
+Fatal error: Uncaught TypeError: Cannot assign null to property Foo::$bar of type int in %s:%d
Stack trace:
#0 {main}
- thrown in %s on line 14
+ thrown in %s on line %d
}
}
--EXPECT--
-Typed property Foo::$bbb must be int, string used
-Typed property Foo::$bbb must be int, string used
-Typed property Foo::$bbb must be int, string used
-Typed property Foo::$bbb must be int, string used
-Typed property Foo::$bbb must be int, string used
+Cannot assign string to property Foo::$bbb of type int
+Cannot assign string to property Foo::$bbb of type int
+Cannot assign string to property Foo::$bbb of type int
+Cannot assign string to property Foo::$bbb of type int
+Cannot assign string to property Foo::$bbb of type int
int(5)
NULL
Typed property Foo::$foo must not be accessed before initialization
-Typed property Foo::$foo must be int or null, string used
+Cannot assign string to property Foo::$foo of type ?int
?>
--EXPECT--
string(4) "okok"
-Typed property A::$a must be string, C used
+Cannot assign C to property A::$a of type string
unset($o);
?>
--EXPECT--
-Typed property A::$foo must be string, int used
+Cannot assign int to property A::$foo of type string
string(3) "100"
unset($o);
?>
--EXPECT--
-Typed property A::$foo must be string, int used
+Cannot assign int to property A::$foo of type string
string(3) "100"
-Typed property A::$foo must be string, int used
+Cannot assign int to property A::$foo of type string
string(3) "100"
?>
--EXPECT--
int(5)
-Typed property B::$foo must be string, int used
-Typed property B::$foo must be string, int used
+Cannot assign int to property B::$foo of type string
+Cannot assign int to property B::$foo of type string
--EXPECTF--
int(1)
-Fatal error: Uncaught TypeError: Typed property A::$a must be int, string used in %s:%d
+Fatal error: Uncaught TypeError: Cannot assign string to property A::$a of type int in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
Cannot assign null to reference held by property Foo::$i of type int
int(4)
int(4)
-Typed property Foo::$i must be int, null used
+Cannot assign null to property Foo::$i of type int
int(4)
int(4)
string(1) "5"
string(1) "5"
int(0)
int(0)
-Typed property Foo::$i must be int, string used
+Cannot assign string to property Foo::$i of type int
int(0)
string(1) "x"
Reference with value of type string held by property Foo::$s of type string is not compatible with property Foo::$i of type int
?>
--EXPECT--
-Typed property Foo::$i must be int, string used
+Cannot assign string to property Foo::$i of type int
Typed static property Foo::$i must not be accessed before initialization
string(1) "x"
string(2) "13"
string(2) "12"
int(1)
-Typed property Foo::$i must be int, float used
+Cannot assign float to property Foo::$i of type int
int(1)
-Typed property Foo::$i must be int, string used
+Cannot assign string to property Foo::$i of type int
int(1)
["val"]=>
uninitialized(int)
}
-Typed property Test::$val must be int, string used
+Cannot assign string to property Test::$val of type int
object(Test)#1 (1) {
["prop"]=>
&string(1) "x"
--EXPECT--
string(70) "Cannot increment property Foo::$bar of type int past its maximal value"
int(9223372036854775807)
-string(48) "Typed property Foo::$bar must be int, float used"
+string(53) "Cannot assign float to property Foo::$bar of type int"
int(9223372036854775807)
string(70) "Cannot increment property Foo::$bar of type int past its maximal value"
int(9223372036854775807)
-string(48) "Typed property Foo::$bar must be int, float used"
+string(53) "Cannot assign float to property Foo::$bar of type int"
int(9223372036854775807)
--EXPECT--
array(0) {
}
-string(89) "Typed property class@anonymous::$t must be an instance of Traversable or null, array used"
+string(72) "Cannot assign array to property class@anonymous::$t of type ?Traversable"
array(0) {
}
array(1) {
?>
--EXPECT--
-Typed property Test::$prop must be int, string used
+Cannot assign string to property Test::$prop of type int
object(Test)#2 (0) {
["prop"]=>
uninitialized(int)
?>
--EXPECT--
int(123)
-Typed property _ZendTestClass::$intProp must be int, string used
-Typed property _ZendTestClass::$classProp must be an instance of stdClass or null, _ZendTestClass used
+Cannot assign string to property _ZendTestClass::$intProp of type int
+Cannot assign _ZendTestClass to property _ZendTestClass::$classProp of type ?stdClass
object(_ZendTestClass)#1 (2) {
["intProp"]=>
int(456)
}
}
int(123)
-Typed property _ZendTestClass::$intProp must be int, string used
-Typed property _ZendTestClass::$classProp must be an instance of stdClass or null, Test used
+Cannot assign string to property _ZendTestClass::$intProp of type int
+Cannot assign Test to property _ZendTestClass::$classProp of type ?stdClass
object(Test)#4 (2) {
["intProp"]=>
int(456)
}
}
int(123)
-Typed property _ZendTestClass::$staticIntProp must be int, string used
+Cannot assign string to property _ZendTestClass::$staticIntProp of type int
int(456)
?>
--EXPECT--
-Typed property Test1::$prop must be an instance of Foobar, int used
+Cannot assign int to property Test1::$prop of type Foobar
object(Test1)#1 (1) {
["prop"]=>
uninitialized(Foobar)
return;
}
- // TODO Switch to a more standard error message?
- type_str = zend_type_to_string(ZEND_TYPE_WITHOUT_NULL(info->type));
- if (ZEND_TYPE_IS_CLASS(info->type)) {
- zend_type_error("Typed property %s::$%s must be an instance of %s%s, %s used",
- ZSTR_VAL(info->ce->name),
- zend_get_unmangled_property_name(info->name),
- ZSTR_VAL(type_str),
- ZEND_TYPE_ALLOW_NULL(info->type) ? " or null" : "",
- Z_TYPE_P(property) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE_P(property)->name) : zend_get_type_by_const(Z_TYPE_P(property)));
- } else {
- zend_type_error("Typed property %s::$%s must be %s%s, %s used",
- ZSTR_VAL(info->ce->name),
- zend_get_unmangled_property_name(info->name),
- ZSTR_VAL(type_str),
- ZEND_TYPE_ALLOW_NULL(info->type) ? " or null" : "",
- Z_TYPE_P(property) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE_P(property)->name) : zend_get_type_by_const(Z_TYPE_P(property)));
- }
+ type_str = zend_type_to_string(info->type);
+ zend_type_error("Cannot assign %s to property %s::$%s of type %s",
+ Z_TYPE_P(property) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE_P(property)->name) : zend_get_type_by_const(Z_TYPE_P(property)),
+ ZSTR_VAL(info->ce->name),
+ zend_get_unmangled_property_name(info->name),
+ ZSTR_VAL(type_str));
zend_string_release(type_str);
}