Skip to content

Commit be733d9

Browse files
committed
Remove prefix parameter from zend_nodiscard_function()
1 parent 7a1395c commit be733d9

14 files changed

+36
-38
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: (B)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: (B)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: (B)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: (A)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: (A)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: (A)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: (A)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: (B)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: (A)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: (A)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: (A)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
@@ -33,12 +33,12 @@ $cls('foo');
3333

3434
?>
3535
--EXPECTF--
36-
Warning: (A)The return value of method Clazz::test() is expected to be consumed in %s on line %d
36+
Warning: The return value of method Clazz::test() is expected to be consumed in %s on line %d
3737
__call(test)
3838

39-
Warning: (A)The return value of method Clazz::test() is expected to be consumed in %s on line %d
39+
Warning: The return value of method Clazz::test() is expected to be consumed in %s on line %d
4040
__callStatic(test)
4141

42-
Warning: (A)The return value of method Clazz::__invoke() is expected to be consumed in %s on line %d
42+
Warning: The return value of method Clazz::__invoke() is expected to be consumed in %s on line %d
4343
__invoke(foo)
4444

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: (A)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: (B)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: (A)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
@@ -16,6 +16,6 @@ fclose($f);
1616
<!-- internal enter tmpfile() -->
1717
<!-- internal enter NoDiscard::__construct() -->
1818

19-
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
19+
Warning: The return value of function flock() is expected to be consumed, as locking the stream might have failed in %s on line %d
2020
<!-- internal enter flock() -->
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: (B)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: (B)The return value of function test() is expected to be consumed
35-
Caught: (B)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: (B)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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4161,7 +4161,7 @@ ZEND_VM_HOT_HANDLER(131, ZEND_DO_FCALL_BY_NAME, ANY, ANY, SPEC(RETVAL,OBSERVER))
41614161
zend_deprecated_function(fbc);
41624162
}
41634163
if (EG(exception) == NULL && (fbc->common.fn_flags & ZEND_ACC_NODISCARD) != 0 && !RETURN_VALUE_USED(opline)) {
4164-
zend_nodiscard_function("(B)", fbc);
4164+
zend_nodiscard_function(fbc);
41654165
}
41664166
if (UNEXPECTED(EG(exception) != NULL)) {
41674167
UNDEF_RESULT();
@@ -4270,7 +4270,7 @@ ZEND_VM_HOT_HANDLER(60, ZEND_DO_FCALL, ANY, ANY, SPEC(RETVAL,OBSERVER))
42704270
zend_deprecated_function(fbc);
42714271
}
42724272
if (EG(exception) == NULL && (fbc->common.fn_flags & ZEND_ACC_NODISCARD) != 0 && !RETURN_VALUE_USED(opline)) {
4273-
zend_nodiscard_function("(A)", fbc);
4273+
zend_nodiscard_function(fbc);
42744274
}
42754275
if (UNEXPECTED(EG(exception) != NULL)) {
42764276
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_CLOSURE)) {

Zend/zend_vm_execute.h

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

0 commit comments

Comments
 (0)