forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path001.phpt
86 lines (62 loc) · 2.3 KB
/
001.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
--TEST--
#[\NoDiscard]: Basic test.
--FILE--
<?php
#[\NoDiscard]
function test(): int {
return 0;
}
#[\NoDiscard("this is important")]
function test2(): int {
return 0;
}
#[\NoDiscard]
function test3(...$args): int {
return 0;
}
class Clazz {
#[\NoDiscard]
function test(): int {
return 0;
}
#[\NoDiscard("this is important")]
function test2(): int {
return 0;
}
#[\NoDiscard]
static function test3(): int {
return 0;
}
}
$closure = #[\NoDiscard] function(): int {
return 0;
};
$closure2 = #[\NoDiscard] function(): int {
return 0;
};
test();
test2();
test3(1, 2, named: 3);
call_user_func("test");
$fcc = test(...);
$fcc();
$cls = new Clazz();
$cls->test();
$cls->test2();
Clazz::test3();
call_user_func([$cls, "test"]);
$closure();
$closure2();
?>
--EXPECTF--
Warning: The return value of function test() should either be used or intentionally ignored by casting it as (void) in %s on line %d
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
Warning: The return value of function test3() should either be used or intentionally ignored by casting it as (void) in %s on line %d
Warning: The return value of function test() should either be used or intentionally ignored by casting it as (void) in %s on line %d
Warning: The return value of function test() should either be used or intentionally ignored by casting it as (void) in %s on line %d
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
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
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
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
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
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