com php-src: Add error case with invalid type declaration default value: Zend/tests/typehints/scalar_constant_defaults_error.php t

From: Date: Wed, 18 Mar 2015 20:53:45 +0000
Subject: com php-src: Add error case with invalid type declaration default value: Zend/tests/typehints/scalar_constant_defaults_error.php t
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-85705@lists.php.net to get a copy of this message
Commit: f04053844828044a5fd2092e253aa7fa0d566c20 Author: Anthony Ferrara <ircmaxell@gmail.com> Wed, 18 Mar 2015 16:53:45 -0400 Parents: 94fe6c42faad2c814d84b5e2c807e41ef46065e0 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f04053844828044a5fd2092e253aa7fa0d566c20 Log: Add error case with invalid type declaration default value Changed paths: A Zend/tests/typehints/scalar_constant_defaults_error.phpt Diff: diff --git a/Zend/tests/typehints/scalar_constant_defaults_error.phpt b/Zend/tests/typehints/scalar_constant_defaults_error.phpt new file mode 100644 index 0000000..53938d7 --- /dev/null +++ b/Zend/tests/typehints/scalar_constant_defaults_error.phpt @@ -0,0 +1,16 @@ +--TEST-- +Scalar type hint - default via constants - error condition +--FILE-- +<?php + +const STRING_VAL = "test"; + +function int_val(int $a = STRING_VAL): int { + return $a; +} + +var_dump(int_val()); + +?> +--EXPECTF-- +Fatal error: Argument 1 passed to int_val() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d \ No newline at end of file

« previous php.cvs (#85705) next »