Skip to content

Commit 53f86f3

Browse files
committed
Remove prefix parameter from zend_nodiscard_function()
1 parent 6d37564 commit 53f86f3

14 files changed

+49
-51
lines changed

Zend/tests/attributes/nodiscard/001.phpt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,24 @@ $closure2();
6363

6464
?>
6565
--EXPECTF--
66-
Warning: (F)The return value of function test() is expected to be consumed in %s on line %d
66+
Warning: The return value of function test() is expected to be consumed in %s on line %d
6767

68-
Warning: (F)The return value of function test2() is expected to be consumed, this is important in %s on line %d
68+
Warning: The return value of function test2() is expected to be consumed, this is important in %s on line %d
6969

70-
Warning: (E)The return value of function test3() is expected to be consumed in %s on line %d
70+
Warning: The return value of function test3() is expected to be consumed in %s on line %d
7171

72-
Warning: (F)The return value of function test() is expected to be consumed in %s on line %d
72+
Warning: The return value of function test() is expected to be consumed in %s on line %d
7373

74-
Warning: (F)The return value of function test() is expected to be consumed in %s on line %d
74+
Warning: The return value of function test() is expected to be consumed in %s on line %d
7575

76-
Warning: (F)The return value of method Clazz::test() is expected to be consumed in %s on line %d
76+
Warning: The return value of method Clazz::test() is expected to be consumed in %s on line %d
7777

78-
Warning: (F)The return value of method Clazz::test2() is expected to be consumed, this is important in %s on line %d
78+
Warning: The return value of method Clazz::test2() is expected to be consumed, this is important in %s on line %d
7979

80-
Warning: (F)The return value of method Clazz::test3() is expected to be consumed in %s on line %d
80+
Warning: The return value of method Clazz::test3() is expected to be consumed in %s on line %d
8181

82-
Warning: (F)The return value of method Clazz::test() is expected to be consumed in %s on line %d
82+
Warning: The return value of method Clazz::test() is expected to be consumed in %s on line %d
8383

84-
Warning: (F)The return value of function {closure:%s:%d}() is expected to be consumed in %s on line %d
84+
Warning: The return value of function {closure:%s:%d}() is expected to be consumed in %s on line %d
8585

86-
Warning: (F)The return value of function {closure:%s:%d}() is expected to be consumed in %s on line %d
86+
Warning: The return value of function {closure:%s:%d}() is expected to be consumed in %s on line %d

Zend/tests/attributes/nodiscard/002.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ $cls('foo');
3535
--EXPECTF--
3636
__call(test)
3737

38-
Warning: (F)The return value of method Clazz::__call() is expected to be consumed in %s on line %d
38+
Warning: The return value of method Clazz::__call() is expected to be consumed in %s on line %d
3939
__callStatic(test)
4040

41-
Warning: (F)The return value of method Clazz::__callStatic() is expected to be consumed in %s on line %d
41+
Warning: The return value of method Clazz::__callStatic() is expected to be consumed in %s on line %d
4242
__invoke(foo)
4343

44-
Warning: (F)The return value of method Clazz::__invoke() is expected to be consumed in %s on line %d
44+
Warning: The return value of method Clazz::__invoke() is expected to be consumed in %s on line %d

Zend/tests/attributes/nodiscard/003.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ $cls->test();
1919

2020
?>
2121
--EXPECTF--
22-
Warning: (F)The return value of method Clazz::test() is expected to be consumed in %s on line %d
22+
Warning: The return value of method Clazz::test() is expected to be consumed in %s on line %d

Zend/tests/attributes/nodiscard/005.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ $date->setTimestamp(0);
1212

1313
?>
1414
--EXPECTF--
15-
Warning: (C)The return value of function flock() is expected to be consumed, as locking the stream might have failed in %s on line %d
15+
Warning: The return value of function flock() is expected to be consumed, as locking the stream might have failed in %s on line %d
1616

17-
Warning: (A)The return value of method DateTimeImmutable::setTimestamp() is expected to be consumed, as DateTimeImmutable::setTimestamp() does not modify the object itself in %s on line %d
17+
Warning: The return value of method DateTimeImmutable::setTimestamp() is expected to be consumed, as DateTimeImmutable::setTimestamp() does not modify the object itself in %s on line %d

Zend/tests/attributes/nodiscard/006.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ test();
1717

1818
?>
1919
--EXPECTF--
20-
Warning: (G)The return value of function test() is expected to be consumed in %s on line %d
20+
Warning: The return value of function test() is expected to be consumed in %s on line %d

Zend/tests/attributes/nodiscard/007.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ fclose($f);
1717
<!-- internal enter flock() -->
1818
<!-- internal enter NoDiscard::__construct() -->
1919

20-
Warning: (A)The return value of function flock() is expected to be consumed, as locking the stream might have failed in %s on line %d
20+
Warning: The return value of function flock() is expected to be consumed, as locking the stream might have failed in %s on line %d
2121
<!-- internal enter fclose() -->

Zend/tests/attributes/nodiscard/008.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ test();
1515
--EXPECTF--
1616
Deprecated: Function test() is deprecated in %s on line %d
1717

18-
Warning: (F)The return value of function test() is expected to be consumed in %s on line %d
18+
Warning: The return value of function test() is expected to be consumed in %s on line %d

Zend/tests/attributes/nodiscard/009.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ zend_test_deprecated_nodiscard();
1111
--EXPECTF--
1212
Deprecated: Function zend_test_deprecated_nodiscard() is deprecated, custom message in %s on line %d
1313

14-
Warning: (B)The return value of function zend_test_deprecated_nodiscard() is expected to be consumed, custom message 2 in %s on line %d
14+
Warning: The return value of function zend_test_deprecated_nodiscard() is expected to be consumed, custom message 2 in %s on line %d

Zend/tests/attributes/nodiscard/throwing_error_handler_001.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ try {
3131

3232
?>
3333
--EXPECT--
34-
Caught: (F)The return value of function test() is expected to be consumed
35-
Caught: (F)The return value of function test2() is expected to be consumed
34+
Caught: The return value of function test() is expected to be consumed
35+
Caught: The return value of function test2() is expected to be consumed

Zend/tests/attributes/nodiscard/type_validation_001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ test();
1212

1313
?>
1414
--EXPECTF--
15-
Warning: (F)The return value of function test() is expected to be consumed, 1234 in %s on line %d
15+
Warning: The return value of function test() is expected to be consumed, 1234 in %s on line %d

Zend/zend_execute.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,7 +1963,7 @@ ZEND_COLD static zend_result ZEND_FASTCALL get_nodiscard_suffix_from_attribute(H
19631963
return result;
19641964
}
19651965

1966-
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_nodiscard_function(char *prefix, const zend_function *fbc)
1966+
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_nodiscard_function(const zend_function *fbc)
19671967
{
19681968
zend_string *message_suffix = ZSTR_EMPTY_ALLOC();
19691969

@@ -1974,15 +1974,13 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_nodiscard_function(char *prefix, cons
19741974
int code = fbc->type == ZEND_INTERNAL_FUNCTION ? E_WARNING : E_USER_WARNING;
19751975

19761976
if (fbc->common.scope) {
1977-
zend_error_unchecked(code, "%sThe return value of method %s::%s() is expected to be consumed%S",
1978-
prefix,
1977+
zend_error_unchecked(code, "The return value of method %s::%s() is expected to be consumed%S",
19791978
ZSTR_VAL(fbc->common.scope->name),
19801979
ZSTR_VAL(fbc->common.function_name),
19811980
message_suffix
19821981
);
19831982
} else {
1984-
zend_error_unchecked(code, "%sThe return value of function %s() is expected to be consumed%S",
1985-
prefix,
1983+
zend_error_unchecked(code, "The return value of function %s() is expected to be consumed%S",
19861984
ZSTR_VAL(fbc->common.function_name),
19871985
message_suffix
19881986
);

Zend/zend_execute.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ extern ZEND_API const zend_internal_function zend_pass_function;
6262

6363
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_missing_arg_error(zend_execute_data *execute_data);
6464
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_deprecated_function(const zend_function *fbc);
65-
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_nodiscard_function(char *prefix, const zend_function *fbc);
65+
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_nodiscard_function(const zend_function *fbc);
6666
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_deprecated_class_constant(const zend_class_constant *c, const zend_string *constant_name);
6767
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_false_to_array_deprecated(void);
6868
ZEND_COLD void ZEND_FASTCALL zend_param_must_be_ref(const zend_function *func, uint32_t arg_num);

Zend/zend_vm_def.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2939,7 +2939,7 @@ ZEND_VM_HOT_HELPER(zend_leave_helper, ANY, ANY)
29392939

29402940
if (UNEXPECTED((EX(func)->common.fn_flags & ZEND_ACC_NODISCARD) != 0) && !EX(return_value)) {
29412941
zend_function *fbc = EX(func);
2942-
zend_nodiscard_function("(F)", fbc);
2942+
zend_nodiscard_function(fbc);
29432943
}
29442944

29452945
execute_data = EX(prev_execute_data);
@@ -2979,7 +2979,7 @@ ZEND_VM_HOT_HELPER(zend_leave_helper, ANY, ANY)
29792979
old_execute_data = execute_data;
29802980
if (UNEXPECTED((EX(func)->common.fn_flags & ZEND_ACC_NODISCARD) != 0) && !EX(return_value)) {
29812981
zend_function *fbc = EX(func);
2982-
zend_nodiscard_function("(E)", fbc);
2982+
zend_nodiscard_function(fbc);
29832983
}
29842984

29852985
execute_data = EX(prev_execute_data);
@@ -3026,7 +3026,7 @@ ZEND_VM_HOT_HELPER(zend_leave_helper, ANY, ANY)
30263026

30273027
if (UNEXPECTED((EX(func)->common.fn_flags & ZEND_ACC_NODISCARD) != 0) && !EX(return_value)) {
30283028
zend_function *fbc = EX(func);
3029-
zend_nodiscard_function("(G)", fbc);
3029+
zend_nodiscard_function(fbc);
30303030
}
30313031

30323032
i_free_compiled_variables(execute_data);
@@ -4128,7 +4128,7 @@ ZEND_VM_HOT_HANDLER(129, ZEND_DO_ICALL, ANY, ANY, SPEC(RETVAL,OBSERVER))
41284128

41294129
if (!RETURN_VALUE_USED(opline)) {
41304130
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_NODISCARD) != 0)) {
4131-
zend_nodiscard_function("(C)", fbc);
4131+
zend_nodiscard_function(fbc);
41324132
}
41334133
i_zval_ptr_dtor(ret);
41344134
}
@@ -4260,7 +4260,7 @@ ZEND_VM_C_LABEL(fcall_by_name_end):
42604260

42614261
if (!RETURN_VALUE_USED(opline)) {
42624262
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_NODISCARD) != 0)) {
4263-
zend_nodiscard_function("(B)", fbc);
4263+
zend_nodiscard_function(fbc);
42644264
}
42654265
i_zval_ptr_dtor(ret);
42664266
}
@@ -4377,7 +4377,7 @@ ZEND_VM_C_LABEL(fcall_end):
43774377

43784378
if (!RETURN_VALUE_USED(opline)) {
43794379
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_NODISCARD) != 0)) {
4380-
zend_nodiscard_function("(A)", fbc);
4380+
zend_nodiscard_function(fbc);
43814381
}
43824382
i_zval_ptr_dtor(ret);
43834383
}

Zend/zend_vm_execute.h

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)