Skip to content

Commit 07c0b65

Browse files
committed
Check NoDiscard together with Deprecated
1 parent c340424 commit 07c0b65

File tree

13 files changed

+81
-134
lines changed

13 files changed

+81
-134
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: (B)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: (B)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: (B)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: (A)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: (A)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: (A)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: (A)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: (B)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: (A)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: (A)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: (A)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
3637
__call(test)
3738

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

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

44-
Warning: (F)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: (A)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: 1 addition & 1 deletion
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: (B)The return value of function flock() is expected to be consumed, as locking the stream might have failed in %s on line %d
1616

1717
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

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: (A)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
@@ -14,8 +14,8 @@ fclose($f);
1414
?>
1515
--EXPECTF--
1616
<!-- internal enter tmpfile() -->
17-
<!-- internal enter flock() -->
1817
<!-- internal enter NoDiscard::__construct() -->
1918

2019
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+
<!-- 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: (F)The return value of function test() is expected to be consumed in %s on line %d
18+
Warning: (B)The return value of function test() is expected to be consumed 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: (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

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: (B)The return value of function test() is expected to be consumed, 1234 in %s on line %d

Zend/zend_compile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3927,15 +3927,15 @@ ZEND_API uint8_t zend_get_call_op(const zend_op *init_op, zend_function *fbc) /*
39273927
ZEND_ASSERT(!(fbc->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE));
39283928
if (fbc->type == ZEND_INTERNAL_FUNCTION && !(CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS)) {
39293929
if (init_op->opcode == ZEND_INIT_FCALL && !zend_execute_internal) {
3930-
if (!(fbc->common.fn_flags & ZEND_ACC_DEPRECATED)) {
3930+
if (!(fbc->common.fn_flags & (ZEND_ACC_DEPRECATED|ZEND_ACC_NODISCARD))) {
39313931
return ZEND_DO_ICALL;
39323932
} else {
39333933
return ZEND_DO_FCALL_BY_NAME;
39343934
}
39353935
}
39363936
} else if (!(CG(compiler_options) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS)){
39373937
if (zend_execute_ex == execute_ex) {
3938-
if (!(fbc->common.fn_flags & ZEND_ACC_DEPRECATED)) {
3938+
if (!(fbc->common.fn_flags & (ZEND_ACC_DEPRECATED|ZEND_ACC_NODISCARD))) {
39393939
return ZEND_DO_UCALL;
39403940
} else {
39413941
return ZEND_DO_FCALL_BY_NAME;

0 commit comments

Comments
 (0)