Skip to content

Commit 2079da0

Browse files
authored
Fix #13865 Improve parameter and return value related deprecation messages (#13913)
I added the function/method name to some compile-time deprecation messages which are related to parameters/return values. Consistently with the other similar error messages, I included the function/method name at the start of the message.
1 parent 0bc5cb6 commit 2079da0

24 files changed

+46
-40
lines changed

Zend/tests/bug71428.3.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ class B { public function m(A $a = NULL, $n) { echo "B.m";} };
77
class C extends B { public function m(A $a , $n) { echo "C.m";} };
88
?>
99
--EXPECTF--
10-
Deprecated: Implicitly marking parameter $a as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
10+
Deprecated: B::m(): Implicitly marking parameter $a as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
1111

1212
Fatal error: Declaration of C::m(A $a, $n) must be compatible with B::m(?A $a, $n) in %sbug71428.3.php on line 4

Zend/tests/call_user_func_005.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var_dump(call_user_func(array('foo', 'teste')));
1818

1919
?>
2020
--EXPECTF--
21-
Deprecated: Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in %s on line %d
21+
Deprecated: {closure}(): Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in %s on line %d
2222
string(1) "x"
2323
array(1) {
2424
[0]=>

Zend/tests/gh11488.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function c(
1616
) {}
1717
?>
1818
--EXPECTF--
19-
Deprecated: Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in %s on line %d
19+
Deprecated: a(): Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in %s on line %d
2020

21-
Deprecated: Implicitly marking parameter $c as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
21+
Deprecated: b(): Implicitly marking parameter $c as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
2222

23-
Deprecated: Optional parameter $e declared before required parameter $f is implicitly treated as a required parameter in %s on line %d
23+
Deprecated: c(): Optional parameter $e declared before required parameter $f is implicitly treated as a required parameter in %s on line %d

Zend/tests/ns_073.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $x(new \stdclass);
1414

1515
?>
1616
--EXPECTF--
17-
Deprecated: Implicitly marking parameter $x as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
17+
Deprecated: foo\{closure}(): Implicitly marking parameter $x as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
1818
NULL
1919
object(stdClass)#%d (0) {
2020
}

Zend/tests/required_param_after_optional.phpt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ function test3(Type $test3A = null, ?Type2 $test3B = null, $test3C) {}
99

1010
?>
1111
--EXPECTF--
12-
Deprecated: Optional parameter $testA declared before required parameter $testC is implicitly treated as a required parameter in %s on line %d
12+
Deprecated: test(): Optional parameter $testA declared before required parameter $testC is implicitly treated as a required parameter in %s on line %d
1313

14-
Deprecated: Optional parameter $testB declared before required parameter $testC is implicitly treated as a required parameter in %s on line %d
14+
Deprecated: test(): Optional parameter $testB declared before required parameter $testC is implicitly treated as a required parameter in %s on line %d
1515

16-
Deprecated: Implicitly marking parameter $test2A as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
16+
Deprecated: test2(): Implicitly marking parameter $test2A as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
1717

18-
Deprecated: Optional parameter $test2B declared before required parameter $test2C is implicitly treated as a required parameter in %s on line %d
18+
Deprecated: test2(): Optional parameter $test2B declared before required parameter $test2C is implicitly treated as a required parameter in %s on line %d
1919

20-
Deprecated: Implicitly marking parameter $test3A as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
20+
Deprecated: test3(): Implicitly marking parameter $test3A as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
2121

22-
Deprecated: Optional parameter $test3B declared before required parameter $test3C is implicitly treated as a required parameter in %s on line %d
22+
Deprecated: test3(): Optional parameter $test3B declared before required parameter $test3C is implicitly treated as a required parameter in %s on line %d

Zend/tests/required_param_after_optional_named_args.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ try {
1313

1414
?>
1515
--EXPECTF--
16-
Deprecated: Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in %s on line %d
16+
Deprecated: test(): Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in %s on line %d
1717
test(): Argument #1 ($a) not passed

Zend/tests/return_by_ref_from_void_function.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var_dump($r);
1111

1212
?>
1313
--EXPECTF--
14-
Deprecated: Returning by reference from a void function is deprecated in %s on line %d
14+
Deprecated: test(): Returning by reference from a void function is deprecated in %s on line %d
1515

1616
Notice: Only variable references should be returned by reference in %s on line %d
1717
NULL

Zend/tests/traits/bug60717.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ namespace HTML
7070
}
7171
?>
7272
--EXPECTF--
73-
Deprecated: Implicitly marking parameter $attributes as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
73+
Deprecated: HTML\Helper::attributes(): Implicitly marking parameter $attributes as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
7474

75-
Deprecated: Implicitly marking parameter $attributes as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
75+
Deprecated: HTML\TextArea::attributes(): Implicitly marking parameter $attributes as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
7676

77-
Deprecated: Implicitly marking parameter $attributes as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
77+
Deprecated: HTML\HTMLAttributes::attributes(): Implicitly marking parameter $attributes as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
7878
Done

Zend/tests/type_declarations/callable_003.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ foo("strpos", 123, "strpos");
1414
bar("substr");
1515
?>
1616
--EXPECTF--
17-
Deprecated: Implicitly marking parameter $a as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
17+
Deprecated: bar(): Implicitly marking parameter $a as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
1818
string(6) "strpos"
1919
int(123)
2020
string(6) "strpos"

Zend/tests/type_declarations/intersection_types/implicit_nullable_intersection_type.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ foo(null);
1111

1212
?>
1313
--EXPECTF--
14-
Deprecated: Implicitly marking parameter $foo as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
14+
Deprecated: foo(): Implicitly marking parameter $foo as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
1515
NULL

0 commit comments

Comments
 (0)