summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGabriel Caruso <carusogabriel34@gmail.com>2018-02-04 11:33:49 -0200
committerNikita Popov <nikita.ppv@gmail.com>2018-02-04 19:08:23 +0100
commitce1d69a1f6dcf15d43029301059c25e5bc09a577 (patch)
tree3df785771b4bfa07a9e270b04750840ed47f1cbf /tests
parent4861730a945908208a049b0c037ddf4a339f999a (diff)
downloadphp-git-ce1d69a1f6dcf15d43029301059c25e5bc09a577.tar.gz
Use int instead of integer in type errors
PHP requires integer typehints to be written "int" and does not allow "integer" as an alias. This changes type error messages to match the actual type name and avoids confusing messages like "must be of the type integer, integer given".
Diffstat (limited to 'tests')
-rw-r--r--tests/classes/type_hinting_003.phpt2
-rw-r--r--tests/classes/type_hinting_004.phpt20
-rw-r--r--tests/lang/bug24658.phpt2
-rw-r--r--tests/lang/func_get_arg_variation.phpt2
-rw-r--r--tests/output/ob_implicit_flush_variation_001.phpt24
-rw-r--r--tests/output/ob_start_error_001.phpt4
6 files changed, 27 insertions, 27 deletions
diff --git a/tests/classes/type_hinting_003.phpt b/tests/classes/type_hinting_003.phpt
index 50de31e44b..fb788e3d9c 100644
--- a/tests/classes/type_hinting_003.phpt
+++ b/tests/classes/type_hinting_003.phpt
@@ -57,7 +57,7 @@ array(1) {
int(25)
}
-Fatal error: Uncaught TypeError: Argument 1 passed to Test::f1() must be of the type array, integer given, called in %s on line %d and defined in %s:%d
+Fatal error: Uncaught TypeError: Argument 1 passed to Test::f1() must be of the type array, int given, called in %s on line %d and defined in %s:%d
Stack trace:
#0 %s(%d): Test::f1(1)
#1 {main}
diff --git a/tests/classes/type_hinting_004.phpt b/tests/classes/type_hinting_004.phpt
index 95df6264dd..174664c02f 100644
--- a/tests/classes/type_hinting_004.phpt
+++ b/tests/classes/type_hinting_004.phpt
@@ -7,7 +7,7 @@ Ensure type hints are enforced for functions invoked as callbacks.
echo "$errno: $errstr - $errfile($errline)\n";
return true;
}
-
+
echo "---> Type hints with callback function:\n";
class A { }
function f1(A $a) {
@@ -46,7 +46,7 @@ Ensure type hints are enforced for functions invoked as callbacks.
} catch (Error $ex) {
echo "{$ex->getCode()}: {$ex->getMessage()} - {$ex->getFile()}({$ex->getLine()})\n\n";
}
-
+
echo "\n\n---> Type hints with callback static method:\n";
class C {
static function f1(A $a) {
@@ -95,7 +95,7 @@ Ensure type hints are enforced for functions invoked as callbacks.
} catch (Error $ex) {
echo "{$ex->getCode()}: {$ex->getMessage()} - {$ex->getFile()}({$ex->getLine()})\n\n";
}
-
+
echo "\n\n---> Type hints with callback instance method:\n";
class D {
function f1(A $a) {
@@ -145,14 +145,14 @@ Ensure type hints are enforced for functions invoked as callbacks.
} catch (Error $ex) {
echo "{$ex->getCode()}: {$ex->getMessage()} - {$ex->getFile()}({$ex->getLine()})\n\n";
}
-
+
?>
--EXPECTF--
---> Type hints with callback function:
-0: Argument 1 passed to f1() must be an instance of A, integer given%s(%d)
+0: Argument 1 passed to f1() must be an instance of A, int given%s(%d)
in f1;
-0: Argument 1 passed to f2() must be an instance of A or null, integer given%s(%d)
+0: Argument 1 passed to f2() must be an instance of A or null, int given%s(%d)
in f2;
in f2;
@@ -160,10 +160,10 @@ in f2;
---> Type hints with callback static method:
-0: Argument 1 passed to C::f1() must be an instance of A, integer given%s(%d)
+0: Argument 1 passed to C::f1() must be an instance of A, int given%s(%d)
in C::f1 (static);
-0: Argument 1 passed to C::f2() must be an instance of A or null, integer given%s(%d)
+0: Argument 1 passed to C::f2() must be an instance of A or null, int given%s(%d)
in C::f2 (static);
in C::f2 (static);
@@ -171,10 +171,10 @@ in C::f2 (static);
---> Type hints with callback instance method:
-0: Argument 1 passed to D::f1() must be an instance of A, integer given%s(%d)
+0: Argument 1 passed to D::f1() must be an instance of A, int given%s(%d)
in C::f1 (instance);
-0: Argument 1 passed to D::f2() must be an instance of A or null, integer given%s(%d)
+0: Argument 1 passed to D::f2() must be an instance of A or null, int given%s(%d)
in C::f2 (instance);
in C::f2 (instance);
diff --git a/tests/lang/bug24658.phpt b/tests/lang/bug24658.phpt
index b089569d91..a53457d5d9 100644
--- a/tests/lang/bug24658.phpt
+++ b/tests/lang/bug24658.phpt
@@ -53,7 +53,7 @@ int(2)
object(foo)#%d (0) {
}
-Fatal error: Uncaught TypeError: Argument 1 passed to typehint() must be an instance of foo, integer given in %s:%d
+Fatal error: Uncaught TypeError: Argument 1 passed to typehint() must be an instance of foo, int given in %s:%d
Stack trace:
#0 [internal function]: typehint(1, 1)
#1 %s(%d): array_walk(Array, 'typehint')
diff --git a/tests/lang/func_get_arg_variation.phpt b/tests/lang/func_get_arg_variation.phpt
index 3dab69f246..83b20848fe 100644
--- a/tests/lang/func_get_arg_variation.phpt
+++ b/tests/lang/func_get_arg_variation.phpt
@@ -20,7 +20,7 @@ Warning: func_get_arg() expects exactly 1 parameter, 0 given in %s on line %d
Warning: func_get_arg() expects exactly 1 parameter, 2 given in %s on line %d
-Warning: func_get_arg() expects parameter 1 to be integer, string given in %s on line %d
+Warning: func_get_arg() expects parameter 1 to be int, string given in %s on line %d
Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
diff --git a/tests/output/ob_implicit_flush_variation_001.phpt b/tests/output/ob_implicit_flush_variation_001.phpt
index 64c911d447..8f2442f8f8 100644
--- a/tests/output/ob_implicit_flush_variation_001.phpt
+++ b/tests/output/ob_implicit_flush_variation_001.phpt
@@ -122,19 +122,19 @@ NULL
NULL
--empty array--
-Error: 2 - ob_implicit_flush() expects parameter 1 to be integer, array given, %s(97)
+Error: 2 - ob_implicit_flush() expects parameter 1 to be int, array given, %s(97)
NULL
--int indexed array--
-Error: 2 - ob_implicit_flush() expects parameter 1 to be integer, array given, %s(97)
+Error: 2 - ob_implicit_flush() expects parameter 1 to be int, array given, %s(97)
NULL
--associative array--
-Error: 2 - ob_implicit_flush() expects parameter 1 to be integer, array given, %s(97)
+Error: 2 - ob_implicit_flush() expects parameter 1 to be int, array given, %s(97)
NULL
--nested arrays--
-Error: 2 - ob_implicit_flush() expects parameter 1 to be integer, array given, %s(97)
+Error: 2 - ob_implicit_flush() expects parameter 1 to be int, array given, %s(97)
NULL
--uppercase NULL--
@@ -156,35 +156,35 @@ NULL
NULL
--empty string DQ--
-Error: 2 - ob_implicit_flush() expects parameter 1 to be integer, string given, %s(97)
+Error: 2 - ob_implicit_flush() expects parameter 1 to be int, string given, %s(97)
NULL
--empty string SQ--
-Error: 2 - ob_implicit_flush() expects parameter 1 to be integer, string given, %s(97)
+Error: 2 - ob_implicit_flush() expects parameter 1 to be int, string given, %s(97)
NULL
--string DQ--
-Error: 2 - ob_implicit_flush() expects parameter 1 to be integer, string given, %s(97)
+Error: 2 - ob_implicit_flush() expects parameter 1 to be int, string given, %s(97)
NULL
--string SQ--
-Error: 2 - ob_implicit_flush() expects parameter 1 to be integer, string given, %s(97)
+Error: 2 - ob_implicit_flush() expects parameter 1 to be int, string given, %s(97)
NULL
--mixed case string--
-Error: 2 - ob_implicit_flush() expects parameter 1 to be integer, string given, %s(97)
+Error: 2 - ob_implicit_flush() expects parameter 1 to be int, string given, %s(97)
NULL
--heredoc--
-Error: 2 - ob_implicit_flush() expects parameter 1 to be integer, string given, %s(97)
+Error: 2 - ob_implicit_flush() expects parameter 1 to be int, string given, %s(97)
NULL
--instance of classWithToString--
-Error: 2 - ob_implicit_flush() expects parameter 1 to be integer, object given, %s(97)
+Error: 2 - ob_implicit_flush() expects parameter 1 to be int, object given, %s(97)
NULL
--instance of classWithoutToString--
-Error: 2 - ob_implicit_flush() expects parameter 1 to be integer, object given, %s(97)
+Error: 2 - ob_implicit_flush() expects parameter 1 to be int, object given, %s(97)
NULL
--undefined var--
diff --git a/tests/output/ob_start_error_001.phpt b/tests/output/ob_start_error_001.phpt
index 34aa13d802..92372c7747 100644
--- a/tests/output/ob_start_error_001.phpt
+++ b/tests/output/ob_start_error_001.phpt
@@ -44,10 +44,10 @@ bool(false)
- Arg 2 wrong type
-Warning: ob_start() expects parameter 2 to be integer, string given in %s on line 23
+Warning: ob_start() expects parameter 2 to be int, string given in %s on line 23
NULL
- Arg 3 wrong type
-Warning: ob_start() expects parameter 3 to be integer, string given in %s on line 26
+Warning: ob_start() expects parameter 3 to be int, string given in %s on line 26
NULL