1 | <?php |
||
5 | class Casts |
||
6 | { |
||
7 | public function testIntToInt() |
||
12 | |||
13 | public function testStrToInt() |
||
18 | |||
19 | public function testNullToUnset() |
||
24 | |||
25 | public function testIntToUnset() |
||
30 | |||
31 | public function testArrToArr() |
||
36 | |||
37 | public function testIntToArr() |
||
42 | |||
43 | public function testBoolToBool() |
||
48 | |||
49 | public function testIntToBool() |
||
54 | |||
55 | public function testDoubleToDouble() |
||
60 | |||
61 | public function testIntToDouble() |
||
66 | |||
67 | public function testStringToString() |
||
72 | |||
73 | public function testIntToString() |
||
78 | |||
79 | public function testObjectToObject() |
||
84 | |||
85 | public function testIntToObject() |
||
90 | } |
||
91 | ?> |
||
137 |
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.