Skip to content

Commit ce1d69a

Browse files
carusogabrielnikic
authored andcommitted
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".
1 parent 4861730 commit ce1d69a

File tree

627 files changed

+2941
-2941
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

627 files changed

+2941
-2941
lines changed

Zend/tests/bug73954.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ takes_int(log(tan(3.14)));
1616
float(NAN)
1717
bool(true)
1818

19-
Fatal error: Uncaught TypeError: Argument 1 passed to takes_int() must be of the type integer, float given, called in %s on line 9 and defined in %s:6
19+
Fatal error: Uncaught TypeError: Argument 1 passed to takes_int() must be of the type int, float given, called in %s on line 9 and defined in %s:6
2020
Stack trace:
2121
#0 %s(9): takes_int(NAN)
2222
#1 {main}

Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ Too few arguments to function bar(), 1 passed in %s and exactly 2 expected
4949
ArgumentCountError
5050
Too few arguments to function bat(), 1 passed in %s and exactly 2 expected
5151
TypeError
52-
Argument 1 passed to bat() must be of the type integer, string given, called in %s
52+
Argument 1 passed to bat() must be of the type int, string given, called in %s
5353
TypeError
54-
Argument 2 passed to bat() must be of the type string, integer given, called in %s
54+
Argument 2 passed to bat() must be of the type string, int given, called in %s

Zend/tests/generators/generator_with_type_check.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function gen(array $a) { yield; }
66
gen(42);
77
?>
88
--EXPECTF--
9-
Fatal error: Uncaught TypeError: Argument 1 passed to gen() must be of the type array, integer given, called in %sgenerator_with_type_check.php on line 3 and defined in %sgenerator_with_type_check.php:2
9+
Fatal error: Uncaught TypeError: Argument 1 passed to gen() must be of the type array, int given, called in %sgenerator_with_type_check.php on line 3 and defined in %sgenerator_with_type_check.php:2
1010
Stack trace:
1111
#0 %sgenerator_with_type_check.php(3): gen(42)
1212
#1 {main}

Zend/tests/generators/generator_with_type_check_2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ try {
1818
}
1919
?>
2020
--EXPECTF--
21-
Argument 1 passed to gen() must be of the type array, integer given, called in %sgenerator_with_type_check_2.php on line 4
22-
Argument 1 passed to gen() must be of the type array, integer given, called in %sgenerator_with_type_check_2.php on line 10
21+
Argument 1 passed to gen() must be of the type array, int given, called in %sgenerator_with_type_check_2.php on line 4
22+
Argument 1 passed to gen() must be of the type array, int given, called in %sgenerator_with_type_check_2.php on line 10

Zend/tests/object_types/return_type_in_class.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $three = new class extends Two {
1919
$three->a();
2020
--EXPECTF--
2121

22-
Fatal error: Uncaught TypeError: Return value of class@anonymous::a() must be an object, integer returned in %s:13
22+
Fatal error: Uncaught TypeError: Return value of class@anonymous::a() must be an object, int returned in %s:13
2323
Stack trace:
2424
#0 %s(16): class@anonymous->a()
2525
#1 {main}

Zend/tests/object_types/return_type_in_function.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function a() : object {
99
a();
1010
--EXPECTF--
1111

12-
Fatal error: Uncaught TypeError: Return value of a() must be an object, integer returned in %s:4
12+
Fatal error: Uncaught TypeError: Return value of a() must be an object, int returned in %s:4
1313
Stack trace:
1414
#0 %s(6): a()
1515
#1 {main}

Zend/tests/object_types/return_type_inheritance_in_class.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $three = new class extends Two {
1919
$three->a();
2020

2121
--EXPECTF--
22-
Fatal error: Uncaught TypeError: Return value of class@anonymous::a() must be an object, integer returned in %s:13
22+
Fatal error: Uncaught TypeError: Return value of class@anonymous::a() must be an object, int returned in %s:13
2323
Stack trace:
2424
#0 %s(16): class@anonymous->a()
2525
#1 {main}

Zend/tests/object_types/return_type_inheritance_in_interface.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $three = new class implements Two {
1919
$three->a();
2020

2121
--EXPECTF--
22-
Fatal error: Uncaught TypeError: Return value of class@anonymous::a() must be an object, integer returned in %s:13
22+
Fatal error: Uncaught TypeError: Return value of class@anonymous::a() must be an object, int returned in %s:13
2323
Stack trace:
2424
#0 %s(16): class@anonymous->a()
2525
#1 {main}

Zend/tests/object_types/type_hint_in_class_method.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $one->a(new One());
1212
$one->a(123);
1313
--EXPECTF--
1414

15-
Fatal error: Uncaught TypeError: Argument 1 passed to One::a() must be an object, integer given, called in %s:4
15+
Fatal error: Uncaught TypeError: Argument 1 passed to One::a() must be an object, int given, called in %s:4
1616
Stack trace:
1717
#0 %s(9): One->a(123)
1818
#1 {main}

Zend/tests/object_types/type_hint_in_function.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ a(new A());
1010
a(123);
1111
--EXPECTF--
1212

13-
Fatal error: Uncaught TypeError: Argument 1 passed to a() must be an object, integer given, called in %s.php on line 7 and defined in %s:4
13+
Fatal error: Uncaught TypeError: Argument 1 passed to a() must be an object, int given, called in %s.php on line 7 and defined in %s:4
1414
Stack trace:
1515
#0 %s(7): a(123)
1616
#1 {main}

0 commit comments

Comments
 (0)