int(1)
*** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d
*** Trying int(%d)
int(%d)
*** Trying float(NAN)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d
*** Trying bool(true)
int(1)
int(0)
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type integer, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, array given, called in %s on line %d
*** Trying object(stdClass)#%s (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d
*** Trying object(Stringable)#%s (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d
*** Trying resource(%d) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d
Testing 'float' typehint:
float(1)
*** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
*** Trying int(%d)
float(%s)
float(0)
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d
*** Trying object(stdClass)#%s (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
*** Trying object(Stringable)#%s (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
*** Trying resource(%d) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d
Testing 'string' typehint:
string(0) ""
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d
*** Trying object(stdClass)#%s (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d
*** Trying object(Stringable)#%s (0) {
}
string(6) "foobar"
*** Trying resource(%d) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d
Testing 'bool' typehint:
bool(false)
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, array given, called in %s on line %d
*** Trying object(stdClass)#%s (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d
*** Trying object(Stringable)#%s (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d
*** Trying resource(%d) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, resource given, called in %s on line %d
Done
\ No newline at end of file
echo PHP_EOL . "Done";
--EXPECTF--
Testing int:
-*** Caught Argument 1 passed to {closure}() must be of the type integer, none given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, none given, called in %s on line %d
Testing float:
-*** Caught Argument 1 passed to {closure}() must be of the type float, none given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, none given, called in %s on line %d
Testing string:
-*** Caught Argument 1 passed to {closure}() must be of the type string, none given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, none given, called in %s on line %d
Testing bool:
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, none given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, none given, called in %s on line %d
Testing int nullable:
NULL
Testing float nullable:
?>
--EXPECTF--
Testing int:
-*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d
Testing float:
-*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d
Testing string:
-*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d
Testing bool:
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d
Testing int nullable:
NULL
Testing float nullable:
--- /dev/null
+--TEST--
+Scalar type hint - disallow relative typehints
+--FILE--
+<?php
+
+function foo(bar\int $a): int {
+ return $a;
+}
+
+foo(10);
+
+?>
+--EXPECTF--
+Fatal error: Argument 1 passed to foo() must be an instance of bar\int, integer given, called in %s on line %d and defined in %s on line %d
\ No newline at end of file
int(1)
*** Trying string(1) "1"
-*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d
*** Trying float(1)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d
*** Trying float(1.5)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d
*** Trying string(2) "1a"
-*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d
*** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d
*** Trying int(9223372036854775807)
int(9223372036854775807)
*** Trying float(NAN)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d
*** Trying bool(true)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d
*** Trying bool(false)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type integer, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, array given, called in %s on line %d
*** Trying object(stdClass)#6 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d
*** Trying object(Stringable)#7 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d
Testing 'float' typehint:
float(1)
*** Trying string(1) "1"
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
*** Trying float(1)
float(1)
float(1.5)
*** Trying string(2) "1a"
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
*** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
*** Trying int(9223372036854775807)
float(9.2233720368548E+18)
float(NAN)
*** Trying bool(true)
-*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d
*** Trying bool(false)
-*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d
*** Trying object(stdClass)#6 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
*** Trying object(Stringable)#7 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d
Testing 'string' typehint:
*** Trying int(1)
-*** Caught Argument 1 passed to {closure}() must be of the type string, integer given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, integer given, called in %s on line %d
*** Trying string(1) "1"
string(1) "1"
*** Trying float(1)
-*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d
*** Trying float(1.5)
-*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d
*** Trying string(2) "1a"
string(2) "1a"
string(0) ""
*** Trying int(9223372036854775807)
-*** Caught Argument 1 passed to {closure}() must be of the type string, integer given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, integer given, called in %s on line %d
*** Trying float(NAN)
-*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d
*** Trying bool(true)
-*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d
*** Trying bool(false)
-*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d
*** Trying object(stdClass)#6 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d
*** Trying object(Stringable)#7 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d
Testing 'bool' typehint:
*** Trying int(1)
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, integer given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, integer given, called in %s on line %d
*** Trying string(1) "1"
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d
*** Trying float(1)
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d
*** Trying float(1.5)
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d
*** Trying string(2) "1a"
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d
*** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d
*** Trying int(9223372036854775807)
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, integer given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, integer given, called in %s on line %d
*** Trying float(NAN)
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d
*** Trying bool(true)
bool(true)
bool(false)
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, array given, called in %s on line %d
*** Trying object(stdClass)#6 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d
*** Trying object(Stringable)#7 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, resource given, called in %s on line %d
Done
\ No newline at end of file
int(1)
*** Trying float value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d
*** Trying string value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d
*** Trying true value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d
*** Trying false value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d
*** Trying null value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d
*** Trying array value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, array given, called in %s on line %d
*** Trying object value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d
*** Trying resource value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d
Testing 'float' typehint:
float(1)
*** Trying string value
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
*** Trying true value
-*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d
*** Trying false value
-*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d
*** Trying null value
-*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d
*** Trying array value
-*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d
*** Trying object value
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
*** Trying resource value
-*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d
Testing 'string' typehint:
*** Trying integer value
-*** Caught Argument 1 passed to {closure}() must be of the type string, integer given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, integer given, called in %s on line %d
*** Trying float value
-*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d
*** Trying string value
string(1) "1"
*** Trying true value
-*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d
*** Trying false value
-*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d
*** Trying null value
-*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d
*** Trying array value
-*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d
*** Trying object value
-*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d
*** Trying resource value
-*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d
Testing 'bool' typehint:
*** Trying integer value
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, integer given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, integer given, called in %s on line %d
*** Trying float value
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d
*** Trying string value
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d
*** Trying true value
bool(true)
bool(false)
*** Trying null value
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d
*** Trying array value
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, array given, called in %s on line %d
*** Trying object value
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d
*** Trying resource value
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, resource given, called in %s on line %d
Done
\ No newline at end of file
?>
--EXPECTF--
-string(%d) "Argument 3 passed to test() must be of the type array, integer given, called in %s on line %d and defined in %s on line %d"
+string(%d) "Argument 3 passed to test() must be of the type array, integer given, called in %s on line %d"
}
/* }}} */
-struct _scalar_typehint_info {
+typedef struct _scalar_typehint_info {
const char* name;
const size_t name_len;
const zend_uchar type;
-};
+} scalar_typehint_info;
-static const struct _scalar_typehint_info scalar_typehints[] = {
+static const scalar_typehint_info scalar_typehints[] = {
{"int", sizeof("int") - 1, IS_LONG},
{"float", sizeof("float") - 1, IS_DOUBLE},
{"string", sizeof("string") - 1, IS_STRING},
{NULL, 0, IS_UNDEF}
};
-static zend_always_inline const struct _scalar_typehint_info* zend_find_scalar_typehint(const zend_string *const_name) /* {{{ */
+static zend_always_inline const scalar_typehint_info* zend_find_scalar_typehint(const zend_string *const_name) /* {{{ */
{
- const struct _scalar_typehint_info *info = &scalar_typehints[0];
- const char *uqname;
- size_t uqname_len;
+ const scalar_typehint_info *info = &scalar_typehints[0];
- if (!zend_get_unqualified_name(const_name, &uqname, &uqname_len)) {
- uqname = const_name->val;
- uqname_len = const_name->len;
- }
-
while (info->name) {
- if (uqname_len == info->name_len && zend_binary_strcasecmp(uqname, uqname_len, info->name, info->name_len) == 0) {
+ if (const_name->len == info->name_len && zend_binary_strcasecmp(const_name->val, const_name->len, info->name, info->name_len) == 0) {
break;
}
info++;
ZEND_API void zend_assert_valid_class_name(const zend_string *const_name) /* {{{ */
{
- const struct _scalar_typehint_info *info = zend_find_scalar_typehint(const_name);
+ const scalar_typehint_info *info = zend_find_scalar_typehint(const_name);
if (info) {
zend_error_noreturn(E_COMPILE_ERROR, "\"%s\" cannot be used as a class name", info->name);
static zend_always_inline zend_uchar zend_lookup_scalar_typehint_by_name(const zend_string *const_name) /* {{{ */
{
- const struct _scalar_typehint_info *info = zend_find_scalar_typehint(const_name);
+ const scalar_typehint_info *info = zend_find_scalar_typehint(const_name);
if (info) {
return info->type;
zend_long line = zval_get_long(GET_PROPERTY_SILENT(&exception, "line"));
zend_long code = zval_get_long(GET_PROPERTY_SILENT(&exception, "code"));
- zend_error_helper(code, file->val, line, "%s", message->val);
+ if (ce_exception == type_exception_ce) {
+ zend_error_helper(code, file->val, line, "%s and defined", message->val);
+ } else {
+ zend_error_helper(code, file->val, line, "%s", message->val);
+ }
+
zend_string_release(file);
zend_string_release(message);
OBJ_RELEASE(ex);
}
if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) {
- zend_type_error("Argument %d passed to %s%s%s() must %s%s, %s%s given, called in %s on line %d and defined in %s on line %d",
+ zend_type_error("Argument %d passed to %s%s%s() must %s%s, %s%s given, called in %s on line %d",
arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind,
- ptr->func->op_array.filename->val, ptr->opline->lineno,
- zf->op_array.filename->val, EG(current_execute_data)->opline->lineno);
+ ptr->func->op_array.filename->val, ptr->opline->lineno);
} else {
zend_type_error("Argument %d passed to %s%s%s() must %s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind);
}