1 | <?php |
||
5 | class DebugCode |
||
6 | { |
||
7 | /** |
||
8 | * @return bool |
||
9 | */ |
||
10 | public function testVarDumpUnexpected() |
||
11 | { |
||
12 | var_dump(1); |
||
13 | |||
14 | return true; |
||
15 | } |
||
16 | |||
17 | /** |
||
18 | * @return bool |
||
19 | */ |
||
20 | public function testVarDumpExpected() |
||
21 | { |
||
22 | /** |
||
23 | * @expected |
||
24 | */ |
||
25 | var_dump(1); |
||
26 | |||
27 | return true; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * @return bool |
||
32 | */ |
||
33 | public function testVarDumpWithSimpleComment() |
||
34 | { |
||
35 | /** |
||
36 | * Expected |
||
37 | */ |
||
38 | var_dump(1); |
||
39 | |||
40 | return true; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @return bool |
||
45 | */ |
||
46 | public function testVarExportUnexpected() |
||
47 | { |
||
48 | var_export(1); |
||
49 | |||
50 | return true; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return bool |
||
55 | */ |
||
56 | public function testVarExportExpected() |
||
57 | { |
||
58 | /** |
||
59 | * @expected |
||
60 | */ |
||
61 | var_export(1); |
||
62 | |||
63 | return true; |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * @return bool |
||
68 | */ |
||
69 | public function testVarExportWithSimpleComment() |
||
70 | { |
||
71 | /** |
||
72 | * Expected |
||
73 | */ |
||
74 | var_export(1); |
||
75 | |||
76 | return true; |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * @return bool |
||
81 | */ |
||
82 | public function testDebugZvalDumpUnexpected() |
||
83 | { |
||
84 | debug_zval_dump(1); |
||
85 | |||
86 | return true; |
||
87 | } |
||
88 | |||
89 | /** |
||
90 | * @return bool |
||
91 | */ |
||
92 | public function testDebugZvalDumpExpected() |
||
93 | { |
||
94 | /** |
||
95 | * @expected |
||
96 | */ |
||
97 | debug_zval_dump(1); |
||
98 | |||
99 | return true; |
||
100 | } |
||
101 | |||
102 | /** |
||
103 | * @return bool |
||
104 | */ |
||
105 | public function testDebugZvalDumpWithSimpleComment() |
||
106 | { |
||
107 | /** |
||
108 | * Expected |
||
109 | */ |
||
110 | debug_zval_dump(1); |
||
111 | |||
112 | return true; |
||
113 | } |
||
114 | } |
||
115 | |||
156 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.