diff options
Diffstat (limited to 'Zend/tests/type_declarations/typed_properties_004.phpt')
-rw-r--r-- | Zend/tests/type_declarations/typed_properties_004.phpt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Zend/tests/type_declarations/typed_properties_004.phpt b/Zend/tests/type_declarations/typed_properties_004.phpt new file mode 100644 index 0000000000..03d9e41aac --- /dev/null +++ b/Zend/tests/type_declarations/typed_properties_004.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test typed properties error condition (type mismatch) +--FILE-- +<?php +new class("PHP 7 is better than you, and it knows it ...") { + public int $int; + + public function __construct(string $string) { + $this->int = $string; + } +}; +?> +--EXPECTF-- +Fatal error: Uncaught TypeError: Typed property class@anonymous::$int must be int, string used in %s:6 +Stack trace: +#0 %s(2): class@anonymous->__construct('PHP 7 is better...') +#1 {main} + thrown in %s on line 6 |