Skip to content

Commit 9dc344b

Browse files
committed
Explain how to suppress in warning message
1 parent d9c570d commit 9dc344b

11 files changed

+26
-26
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: The return value of function test() is expected to be consumed in %s on line %d
66+
Warning: The return value of function test() should either be used or intentionally ignored by casting it as (void) in %s on line %d
6767

68-
Warning: 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() should either be used or intentionally ignored by casting it as (void), this is important in %s on line %d
6969

70-
Warning: The return value of function test3() is expected to be consumed in %s on line %d
70+
Warning: The return value of function test3() should either be used or intentionally ignored by casting it as (void) in %s on line %d
7171

72-
Warning: The return value of function test() is expected to be consumed in %s on line %d
72+
Warning: The return value of function test() should either be used or intentionally ignored by casting it as (void) in %s on line %d
7373

74-
Warning: The return value of function test() is expected to be consumed in %s on line %d
74+
Warning: The return value of function test() should either be used or intentionally ignored by casting it as (void) in %s on line %d
7575

76-
Warning: 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() should either be used or intentionally ignored by casting it as (void) in %s on line %d
7777

78-
Warning: 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() should either be used or intentionally ignored by casting it as (void), this is important in %s on line %d
7979

80-
Warning: 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() should either be used or intentionally ignored by casting it as (void) in %s on line %d
8181

82-
Warning: 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() should either be used or intentionally ignored by casting it as (void) in %s on line %d
8383

84-
Warning: 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}() should either be used or intentionally ignored by casting it as (void) in %s on line %d
8585

86-
Warning: 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}() should either be used or intentionally ignored by casting it as (void) 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: 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() should either be used or intentionally ignored by casting it as (void) in %s on line %d
3737
__call(test)
3838

39-
Warning: 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() should either be used or intentionally ignored by casting it as (void) in %s on line %d
4040
__callStatic(test)
4141

42-
Warning: 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() should either be used or intentionally ignored by casting it as (void) 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: 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() should either be used or intentionally ignored by casting it as (void) 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: 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() should either be used or intentionally ignored by casting it as (void), as locking the stream might have failed in %s on line %d
1616

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
17+
Warning: The return value of method DateTimeImmutable::setTimestamp() should either be used or intentionally ignored by casting it as (void), 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: The return value of function test() is expected to be consumed in %s on line %d
20+
Warning: The return value of function test() should either be used or intentionally ignored by casting it as (void) 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: 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() should either be used or intentionally ignored by casting it as (void), 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: The return value of function test() is expected to be consumed in %s on line %d
18+
Warning: The return value of function test() should either be used or intentionally ignored by casting it as (void) 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: 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() should either be used or intentionally ignored by casting it as (void), 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: The return value of function test() is expected to be consumed
35-
Caught: The return value of function test2() is expected to be consumed
34+
Caught: The return value of function test() should either be used or intentionally ignored by casting it as (void)
35+
Caught: The return value of function test2() should either be used or intentionally ignored by casting it as (void)

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: 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() should either be used or intentionally ignored by casting it as (void), 1234 in %s on line %d

Zend/zend_execute.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,13 +1974,13 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_nodiscard_function(const zend_functio
19741974
int code = fbc->type == ZEND_INTERNAL_FUNCTION ? E_WARNING : E_USER_WARNING;
19751975

19761976
if (fbc->common.scope) {
1977-
zend_error_unchecked(code, "The return value of method %s::%s() is expected to be consumed%S",
1977+
zend_error_unchecked(code, "The return value of method %s::%s() should either be used or intentionally ignored by casting it as (void)%S",
19781978
ZSTR_VAL(fbc->common.scope->name),
19791979
ZSTR_VAL(fbc->common.function_name),
19801980
message_suffix
19811981
);
19821982
} else {
1983-
zend_error_unchecked(code, "The return value of function %s() is expected to be consumed%S",
1983+
zend_error_unchecked(code, "The return value of function %s() should either be used or intentionally ignored by casting it as (void)%S",
19841984
ZSTR_VAL(fbc->common.function_name),
19851985
message_suffix
19861986
);

0 commit comments

Comments
 (0)