com php-src: add tests for obj_read_r coerced value: Zend/tests/type_declarations/typed_properties_02 0.phpt
| From: | Bob Weinand | Date: | Wed, 09 Mar 2016 10:49:12 +0000 |
| Subject: | com php-src: add tests for obj_read_r coerced value: Zend/tests/type_declarations/typed_properties_02 0.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95589@lists.php.net to get a copy of this message | ||
Commit: 1fa810605808929088a9826ba68d24184b8f98bb
Author: Joe Watkins <krakjoe@php.net> Wed, 9 Mar 2016 10:49:12 +0000
Parents: c7306b55ae046852b35623b68f0dc13824721c29
Branches: typed_ref_properties
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1fa810605808929088a9826ba68d24184b8f98bb
Log:
add tests for obj_read_r coerced value
Changed paths:
A Zend/tests/type_declarations/typed_properties_020.phpt
Diff:
diff --git a/Zend/tests/type_declarations/typed_properties_020.phpt
b/Zend/tests/type_declarations/typed_properties_020.phpt
new file mode 100644
index 0000000..c73b3be
--- /dev/null
+++ b/Zend/tests/type_declarations/typed_properties_020.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test typed properties do not allow coerced values to be used
+--FILE--
+<?php
+class Foo {
+ public string $bar;
+
+ public function __construct() {
+ $this->bar += 1;
+
+ var_dump($this->bar);
+ }
+}
+
+$foo = new Foo();
+
+var_dump($foo->bar);
+?>
+--EXPECTF--
+Fatal error: Uncaught TypeError: Typed property Foo::$bar must be string, integer used in %s:8
+Stack trace:
+#0 %s(12): Foo->__construct()
+#1 {main}
+ thrown in %s on line 8
+
+
+
+
+